diff --git a/Makefile b/Makefile index 123a85085..45cb6742a 100644 --- a/Makefile +++ b/Makefile @@ -172,7 +172,7 @@ PREFIX=/usr/local # directory MODLINK=$(LIBMODS:%=$(ECOLAB_HOME)/lib/%) MODEL_OBJS=autoLayout.o cairoItems.o canvas.o CSVDialog.o dataOp.o equationDisplay.o godleyIcon.o godleyTable.o godleyTableWindow.o grid.o group.o item.o intOp.o lasso.o lock.o minsky.o operation.o operationRS.o operationRS1.o operationRS2.o phillipsDiagram.o plotWidget.o port.o pubTab.o ravelWrap.o renderNativeWindow.o selection.o sheet.o SVGItem.o switchIcon.o userFunction.o userFunction_units.o variableInstanceList.o variable.o variablePane.o windowInformation.o wire.o -ENGINE_OBJS=clipboard.o databaseIngestor.o derivative.o equationDisplayRender.o equations.o evalGodley.o evalOp.o flowCoef.o \ +ENGINE_OBJS=clipboard.o cairoShimCairo.o databaseIngestor.o derivative.o equationDisplayRender.o equations.o evalGodley.o evalOp.o flowCoef.o \ godleyExport.o latexMarkup.o valueId.o variableValue.o node_latex.o node_matlab.o CSVParser.o \ minskyTensorOps.o mdlReader.o saver.o rungeKutta.o SCHEMA_OBJS=schema3.o schema2.o schema1.o schema0.o schemaHelper.o variableType.o \ diff --git a/RESTService/RESTMinsky.cc b/RESTService/RESTMinsky.cc index 79b6cb5a0..3787a9620 100644 --- a/RESTService/RESTMinsky.cc +++ b/RESTService/RESTMinsky.cc @@ -51,3 +51,4 @@ namespace minsky } } + diff --git a/RESTService/typescriptAPI.cc b/RESTService/typescriptAPI.cc index 1962a85f7..b3a56a74a 100644 --- a/RESTService/typescriptAPI.cc +++ b/RESTService/typescriptAPI.cc @@ -280,7 +280,7 @@ int main() api.addSubclass(); api.addSubclass(); api.addSubclass(); - api.addSubclass(); + api.addSubclass(); api.addSubclass(); api.addSubclass(); api.addSubclass(); @@ -317,10 +317,11 @@ int main() cout << "class classdesc__pack_t {}\n"; cout << "class classdesc__RESTProcess_t {}\n"; cout << "class ecolab__cairo__Surface {}\n"; + cout << "class ICairoShim {}\n"; cout< exportFirst{"EventInterface","Item","OperationBase","RenderNativeWindow","VariableBase"}; + vector exportFirst{"EventInterface","Item","OperationBase","RenderNativeWindow","VariableBase","Wire"}; for (auto& i: exportFirst) exportClass(i,api[i]); cout << "class minsky__Variable extends VariableBase {}\n"; diff --git a/engine/cairoShim.h b/engine/cairoShim.h deleted file mode 100644 index d185fa836..000000000 --- a/engine/cairoShim.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - Because Cairo built with Visual C++ appears to be unstable when used - with the Win32 surface, we abstract the cairo interface here, and - provide 2 implementations: a Cairo one, and one directly in GDI. - - Using static polymorphism. - - Pimpl pattern deployed to prevent leakage of platform specific details -*/ -#ifndef CAIROSHIM_H -#define CAIROSHIM_H -#include -#include - -namespace minsky -{ - class ICairoShim - { - public: - virtual ~ICairoShim() = default; - virtual void moveTo(double x, double y)=0; - virtual void lineTo(double x, double y)=0; - virtual void relMoveTo(double x, double y)=0; - virtual void relLineTo(double x, double y)=0; - virtual void arc(double x, double y, double radius, double start, double end)=0; - - virtual void setLineWidth(double)=0; - - // paths - virtual void newPath()=0; - virtual void closePath()=0; - virtual void fill()=0; - virtual void clip()=0; - virtual void stroke()=0; - virtual void strokePreserve()=0; - - // sources - virtual void setSourceRGB(double r, double g, double b)=0; - virtual void setSourceRGBA(double r, double g, double b, double a)=0; - - // text. Argument is in UTF8 encoding - virtual void showText(const std::string&)=0; - virtual void setTextExtents(const std::string&)=0; - virtual double textWidth() const=0; - virtual double textHeight() const=0; - - // matrix transformation - virtual void identityMatrix()=0; - virtual void translate(double x, double y)=0; - virtual void scale(double sx, double sy)=0; - virtual void rotate(double angle)=0; ///< angle in radians - - // context manipulation - virtual void save()=0; - virtual void restore()=0; - - }; - -} -#endif diff --git a/engine/cairoShimCairo.cc b/engine/cairoShimCairo.cc index 267e9ad49..e14dc2927 100644 --- a/engine/cairoShimCairo.cc +++ b/engine/cairoShimCairo.cc @@ -1,91 +1,168 @@ -#include "cairoShim.h" +#include "cairoShimCairo.h" +#include "minsky_epilogue.h" #define CAIRO_WIN32_STATIC_BUILD #include #undef CAIRO_WIN32_STATIC_BUILD +#include +#include + +// if not #ifdef protected, you get a deprecated warning, which is +// made fatal by -Werror +#ifndef RSVG_CAIRO_H +#include +#endif using namespace std; -namespace ravel +namespace minsky { - void CairoShimCairo::moveTo(double x, double y) + CairoShimCairo::CairoShimCairo(cairo_t* c) : cairo(c) {} + + CairoShimCairo::~CairoShimCairo() = default; + + // Drawing operations + void CairoShimCairo::moveTo(double x, double y) const {cairo_move_to(cairo,x,y);} - void CairoShimCairo::lineTo(double x, double y) + void CairoShimCairo::lineTo(double x, double y) const {cairo_line_to(cairo,x,y);} - void CairoShimCairo::relMoveTo(double x, double y) + void CairoShimCairo::relMoveTo(double x, double y) const {cairo_rel_move_to(cairo,x,y);} - void CairoShimCairo::relLineTo(double x, double y) + void CairoShimCairo::relLineTo(double x, double y) const {cairo_rel_line_to(cairo,x,y);} - void CairoShimCairo::arc - (double x, double y, double radius, double start, double end) + void CairoShimCairo::arc(double x, double y, double radius, double start, double end) const {cairo_arc(cairo,x,y,radius,start,end);} - // paths - void CairoShimCairo::newPath() + void CairoShimCairo::curveTo(double x1, double y1, double x2, double y2, double x3, double y3) const + {cairo_curve_to(cairo,x1,y1,x2,y2,x3,y3);} + + void CairoShimCairo::rectangle(double x, double y, double width, double height) const + {cairo_rectangle(cairo,x,y,width,height);} + + // Path operations + void CairoShimCairo::newPath() const {cairo_new_path(cairo);} - void CairoShimCairo::closePath() + void CairoShimCairo::newSubPath() const + {cairo_new_sub_path(cairo);} + + void CairoShimCairo::closePath() const {cairo_close_path(cairo);} - void CairoShimCairo::fill() + void CairoShimCairo::getCurrentPoint(double& x, double& y) const + {cairo_get_current_point(cairo, &x, &y);} + + // Fill and stroke operations + void CairoShimCairo::fill() const {cairo_fill(cairo);} + + void CairoShimCairo::fillPreserve() const + {cairo_fill_preserve(cairo);} - void CairoShimCairo::clip() + void CairoShimCairo::clip() const {cairo_clip(cairo);} - void CairoShimCairo::stroke() + void CairoShimCairo::resetClip() const + {cairo_reset_clip(cairo);} + + void CairoShimCairo::stroke() const {cairo_stroke(cairo);} - void CairoShimCairo::strokePreserve() + void CairoShimCairo::strokePreserve() const {cairo_stroke_preserve(cairo);} - void CairoShimCairo::setLineWidth(double w) + void CairoShimCairo::paint() const + {cairo_paint(cairo);} + + // Line properties + void CairoShimCairo::setLineWidth(double w) const {cairo_set_line_width(cairo, w);} - // sources - void CairoShimCairo::setSourceRGB - (double r, double g, double b) + double CairoShimCairo::getLineWidth() const + {return cairo_get_line_width(cairo);} + + void CairoShimCairo::setDash(const double* dashes, int num_dashes, double offset) const + {cairo_set_dash(cairo, dashes, num_dashes, offset);} + + void CairoShimCairo::setFillRule(cairo_fill_rule_t fill_rule) const + {cairo_set_fill_rule(cairo, fill_rule);} + + // Color operations + void CairoShimCairo::setSourceRGB(double r, double g, double b) const {cairo_set_source_rgb(cairo,r,g,b);} - void CairoShimCairo::setSourceRGBA - (double r, double g, double b, double a) + void CairoShimCairo::setSourceRGBA(double r, double g, double b, double a) const {cairo_set_source_rgba(cairo,r,g,b,a);} - // text. Argument is in UTF8 encoding - void CairoShimCairo::showText(const std::string& text) + // Text operations + void CairoShimCairo::showText(const std::string& text) const {cairo_show_text(cairo,text.c_str());} - void CairoShimCairo::setTextExtents(const std::string& text) - {cairo_text_extents(cairo,text.c_str(),&extents);} + void CairoShimCairo::setFontSize(double size) const + {cairo_set_font_size(cairo, size);} - double CairoShimCairo::textWidth() const - {return extents.width;} + void CairoShimCairo::selectFontFace(const std::string& family, cairo_font_slant_t slant, cairo_font_weight_t weight) const + {cairo_select_font_face(cairo, family.c_str(), slant, weight);} - double CairoShimCairo::textHeight() const - {return extents.height;} + void CairoShimCairo::textExtents(const std::string& text, cairo_text_extents_t& extents) const + {cairo_text_extents(cairo,text.c_str(),&extents);} - // matrix transformation - void CairoShimCairo::identityMatrix() + // Transformation operations + void CairoShimCairo::identityMatrix() const {cairo_identity_matrix(cairo);} - void CairoShimCairo::translate(double x, double y) + void CairoShimCairo::translate(double x, double y) const {cairo_translate(cairo,x,y);} - void CairoShimCairo::scale(double sx, double sy) + void CairoShimCairo::scale(double sx, double sy) const {cairo_scale(cairo,sx,sy);} - void CairoShimCairo::rotate(double angle) + void CairoShimCairo::rotate(double angle) const {cairo_rotate(cairo,angle);} - // context manipulation - void CairoShimCairo::save() + void CairoShimCairo::userToDevice(double& x, double& y) const + {cairo_user_to_device(cairo, &x, &y);} + + // Context state operations + void CairoShimCairo::save() const {cairo_save(cairo);} - void CairoShimCairo::restore() + void CairoShimCairo::restore() const {cairo_restore(cairo);} - + // Tolerance + void CairoShimCairo::setTolerance(double tolerance) const + {cairo_set_tolerance(cairo, tolerance);} + + // Pango support + ecolab::Pango& CairoShimCairo::pango() const + { + if (!m_pango) newPango(); + return *m_pango; + } + ecolab::Pango& CairoShimCairo::newPango() const + { + m_pango.reset(new ecolab::Pango(cairo)); + return *m_pango; + } + + // SVG rendering support + void CairoShimCairo::renderSVG(const SVGRenderer& svgRenderer, double width, double height) const + { +#ifdef MXE // MXE doesn't currently have a Rust compiler, so librsvg can be no later than 2.40.21 + RsvgDimensionData dims; + rsvg_handle_get_dimensions(svgRenderer.svg, &dims); + cairo_scale(cairo, width/dims.width, height/dims.height); + rsvg_handle_render_cairo(svgRenderer.svg, cairo); +#else + GError* err=nullptr; + const RsvgRectangle rect{0,0,width,height}; + rsvg_handle_render_document(svgRenderer.svg, cairo, &rect, &err); + if (err) + g_error_free(err); +#endif + } } diff --git a/engine/cairoShimCairo.h b/engine/cairoShimCairo.h index 72aeefd6c..9b9935e03 100644 --- a/engine/cairoShimCairo.h +++ b/engine/cairoShimCairo.h @@ -1,57 +1,92 @@ #ifndef CAIROSHIMCAIRO_H #define CAIROSHIMCAIRO_H -#include "cairoShim.h" +#include "ICairoShim.h" +#include "SVGItem.h" #include +#include +#include + +namespace ecolab { class Pango; } namespace minsky { + /// Concrete implementation of ICairoShim using actual Cairo library class CairoShimCairo: public ICairoShim { - cairo_t* cairo; + cairo_t* cairo; + mutable std::unique_ptr m_pango; CairoShimCairo(const CairoShimCairo&)=delete; void operator=(const CairoShimCairo&)=delete; public: - // template parameter G = cairo_t* or HDC - CairoShim(cairo_t*); - ~CairoShim(); - - void moveTo(double x, double y); - void lineTo(double x, double y); - void relMoveTo(double x, double y); - void relLineTo(double x, double y); - void arc(double x, double y, double radius, double start, double end); - - void setLineWidth(double); - - // paths - void newPath(); - void closePath(); - void fill(); - void clip(); - void stroke(); - void strokePreserve(); - - // sources - void setSourceRGB(double r, double g, double b); - void setSourceRGBA(double r, double g, double b, double a); + CairoShimCairo(cairo_t* c); + ~CairoShimCairo() override; + + // Drawing operations + void moveTo(double x, double y) const override; + void lineTo(double x, double y) const override; + void relMoveTo(double x, double y) const override; + void relLineTo(double x, double y) const override; + void arc(double x, double y, double radius, double start, double end) const override; + void curveTo(double x1, double y1, double x2, double y2, double x3, double y3) const override; + void rectangle(double x, double y, double width, double height) const override; + + // Path operations + void newPath() const override; + void newSubPath() const override; + void closePath() const override; + void getCurrentPoint(double& x, double& y) const override; + + // Fill and stroke operations + void fill() const override; + void fillPreserve() const override; + void stroke() const override; + void strokePreserve() const override; + void clip() const override; + void resetClip() const override; + void paint() const override; + + // Line properties + void setLineWidth(double width) const override; + double getLineWidth() const override; + void setDash(const double* dashes, int num_dashes, double offset) const override; + void setFillRule(cairo_fill_rule_t fill_rule) const override; + + // Color operations + void setSourceRGB(double r, double g, double b) const override; + void setSourceRGBA(double r, double g, double b, double a) const override; + + // Text operations + void showText(const std::string& text) const override; + void setFontSize(double size) const override; + void selectFontFace(const std::string& family, cairo_font_slant_t slant, cairo_font_weight_t weight) const override; + void textExtents(const std::string& text, cairo_text_extents_t& extents) const override; + + // Transformation operations + void identityMatrix() const override; + void translate(double x, double y) const override; + void scale(double sx, double sy) const override; + void rotate(double angle) const override; + void userToDevice(double& x, double& y) const override; + + // Context state operations + void save() const override; + void restore() const override; + + // Tolerance + void setTolerance(double tolerance) const override; + + // Pango support + ecolab::Pango& pango() const override; + ecolab::Pango& newPango() const override; - // text. Argument is in UTF8 encoding - void showText(const std::string&); - void setTextExtents(const std::string&); - double textWidth() const; - double textHeight() const; - - // matrix transformation - void identityMatrix(); - void translate(double x, double y); - void scale(double sx, double sy); - void rotate(double angle); ///< angle in radians - - // context manipulation - void save(); - void restore(); + // SVG rendering support + void renderSVG(const SVGRenderer& svgRenderer, double width, double height) const override; + // TEMPORARY: Internal accessor for migration - to be removed once all implementations are updated + cairo_t* _internalGetCairoContext() const { return cairo; } }; } + +#include "cairoShimCairo.xcd" #endif diff --git a/engine/slider.h b/engine/slider.h index 08d3870b3..23a88385b 100644 --- a/engine/slider.h +++ b/engine/slider.h @@ -19,6 +19,9 @@ #ifndef SLIDER_H #define SLIDER_H +#include +#include + namespace minsky { constexpr float sliderHandleRadius=3; @@ -36,7 +39,7 @@ namespace minsky /// ensure there are at most 10000 steps between sliderMin and Max. see ticket 1255. double maxSliderSteps() const { - if (!isfinite(sliderStep) || sliderMax-sliderMin > 1.0e04*sliderStep) return (sliderMax-sliderMin)/1.0e04; + if (!std::isfinite(sliderStep) || sliderMax-sliderMin > 1.0e04*sliderStep) return (sliderMax-sliderMin)/1.0e04; return sliderStep; } }; diff --git a/gui-js/libs/shared/src/lib/backend/minsky.ts b/gui-js/libs/shared/src/lib/backend/minsky.ts index ab5229b49..dbbd20a86 100644 --- a/gui-js/libs/shared/src/lib/backend/minsky.ts +++ b/gui-js/libs/shared/src/lib/backend/minsky.ts @@ -17,6 +17,7 @@ class classdesc__json_pack_t {} class classdesc__pack_t {} class classdesc__RESTProcess_t {} class ecolab__cairo__Surface {} +class ICairoShim {} export class EventInterface extends CppClass { item: Item; @@ -64,11 +65,11 @@ export class Item extends CppClass { async detailedText(...args: any[]): Promise {return this.$callMethod('detailedText',...args);} async disableDelayedTooltip(): Promise {return this.$callMethod('disableDelayedTooltip');} async displayDelayedTooltip(a1: number,a2: number): Promise {return this.$callMethod('displayDelayedTooltip',a1,a2);} - async displayTooltip(a1: minsky__dummy,a2: string): Promise {return this.$callMethod('displayTooltip',a1,a2);} - async draw(a1: minsky__dummy): Promise {return this.$callMethod('draw',a1);} - async drawPorts(a1: minsky__dummy): Promise {return this.$callMethod('drawPorts',a1);} - async drawResizeHandles(a1: minsky__dummy): Promise {return this.$callMethod('drawResizeHandles',a1);} - async drawSelected(a1: minsky__dummy): Promise {return this.$callMethod('drawSelected',a1);} + async displayTooltip(a1: ICairoShim,a2: string): Promise {return this.$callMethod('displayTooltip',a1,a2);} + async draw(a1: ICairoShim): Promise {return this.$callMethod('draw',a1);} + async drawPorts(a1: ICairoShim): Promise {return this.$callMethod('drawPorts',a1);} + async drawResizeHandles(a1: ICairoShim): Promise {return this.$callMethod('drawResizeHandles',a1);} + async drawSelected(a1: ICairoShim): Promise {return this.$callMethod('drawSelected',a1);} async dummyDraw(): Promise {return this.$callMethod('dummyDraw');} async editorMode(): Promise {return this.$callMethod('editorMode');} async ensureBBValid(): Promise {return this.$callMethod('ensureBBValid');} @@ -137,11 +138,11 @@ export class OperationBase extends Item { async classify(a1: string): Promise {return this.$callMethod('classify',a1);} async create(a1: string): Promise {return this.$callMethod('create',a1);} async dimensions(): Promise {return this.$callMethod('dimensions');} - async draw(a1: minsky__dummy): Promise {return this.$callMethod('draw',a1);} - async drawResizeHandles(a1: minsky__dummy): Promise {return this.$callMethod('drawResizeHandles',a1);} - async drawUserFunction(a1: minsky__dummy): Promise {return this.$callMethod('drawUserFunction',a1);} + async draw(a1: ICairoShim): Promise {return this.$callMethod('draw',a1);} + async drawResizeHandles(a1: ICairoShim): Promise {return this.$callMethod('drawResizeHandles',a1);} + async drawUserFunction(a1: ICairoShim): Promise {return this.$callMethod('drawUserFunction',a1);} async h(...args: number[]): Promise {return this.$callMethod('h',...args);} - async iconDraw(a1: minsky__dummy): Promise {return this.$callMethod('iconDraw',a1);} + async iconDraw(a1: ICairoShim): Promise {return this.$callMethod('iconDraw',a1);} async l(...args: number[]): Promise {return this.$callMethod('l',...args);} async multiWire(): Promise {return this.$callMethod('multiWire');} async numPorts(): Promise {return this.$callMethod('numPorts');} @@ -221,11 +222,11 @@ export class VariableBase extends Item { async dims(): Promise {return this.$callMethod('dims');} async disableDelayedTooltip(): Promise {return this.$callMethod('disableDelayedTooltip');} async displayDelayedTooltip(a1: number,a2: number): Promise {return this.$callMethod('displayDelayedTooltip',a1,a2);} - async displayTooltip(a1: minsky__dummy,a2: string): Promise {return this.$callMethod('displayTooltip',a1,a2);} - async draw(a1: minsky__dummy): Promise {return this.$callMethod('draw',a1);} - async drawPorts(a1: minsky__dummy): Promise {return this.$callMethod('drawPorts',a1);} - async drawResizeHandles(a1: minsky__dummy): Promise {return this.$callMethod('drawResizeHandles',a1);} - async drawSelected(a1: minsky__dummy): Promise {return this.$callMethod('drawSelected',a1);} + async displayTooltip(a1: ICairoShim,a2: string): Promise {return this.$callMethod('displayTooltip',a1,a2);} + async draw(a1: ICairoShim): Promise {return this.$callMethod('draw',a1);} + async drawPorts(a1: ICairoShim): Promise {return this.$callMethod('drawPorts',a1);} + async drawResizeHandles(a1: ICairoShim): Promise {return this.$callMethod('drawResizeHandles',a1);} + async drawSelected(a1: ICairoShim): Promise {return this.$callMethod('drawSelected',a1);} async dummyDraw(): Promise {return this.$callMethod('dummyDraw');} async editorMode(): Promise {return this.$callMethod('editorMode');} async enableSlider(...args: any[]): Promise {return this.$callMethod('enableSlider',...args);} @@ -319,6 +320,35 @@ export class VariableBase extends Item { async zoomFactor(): Promise {return this.$callMethod('zoomFactor');} } +export class Wire extends CppClass { + constructor(prefix: string){ + super(prefix); + } + async adjustBookmark(): Promise {return this.$callMethod('adjustBookmark');} + async bookmark(...args: boolean[]): Promise {return this.$callMethod('bookmark',...args);} + async coords(...args: any[]): Promise {return this.$callMethod('coords',...args);} + async deleteHandle(a1: number,a2: number): Promise {return this.$callMethod('deleteHandle',a1,a2);} + async detailedText(...args: any[]): Promise {return this.$callMethod('detailedText',...args);} + async draw(a1: ICairoShim,a2: boolean): Promise {return this.$callMethod('draw',a1,a2);} + async editHandle(a1: number,a2: number,a3: number): Promise {return this.$callMethod('editHandle',a1,a2,a3);} + async from(): Promise {return this.$callMethod('from');} + async insertHandle(a1: number,a2: number,a3: number): Promise {return this.$callMethod('insertHandle',a1,a2,a3);} + async mouseFocus(...args: boolean[]): Promise {return this.$callMethod('mouseFocus',...args);} + async moveIntoGroup(a1: Group): Promise {return this.$callMethod('moveIntoGroup',a1);} + async moveToPorts(a1: Port,a2: Port): Promise {return this.$callMethod('moveToPorts',a1,a2);} + async near(a1: number,a2: number): Promise {return this.$callMethod('near',a1,a2);} + async nearestHandle(a1: number,a2: number): Promise {return this.$callMethod('nearestHandle',a1,a2);} + async selected(...args: boolean[]): Promise {return this.$callMethod('selected',...args);} + async split(): Promise {return this.$callMethod('split');} + async storeCairoCoords(a1: minsky__dummy): Promise {return this.$callMethod('storeCairoCoords',a1);} + async straighten(): Promise {return this.$callMethod('straighten');} + async to(): Promise {return this.$callMethod('to');} + async tooltip(...args: any[]): Promise {return this.$callMethod('tooltip',...args);} + async units(a1: boolean): Promise {return this.$callMethod('units',a1);} + async updateBoundingBox(): Promise {return this.$callMethod('updateBoundingBox');} + async visible(): Promise {return this.$callMethod('visible');} +} + class minsky__Variable extends VariableBase {} export class Bookmark extends CppClass { constructor(prefix: string){ @@ -713,7 +743,7 @@ export class GodleyIcon extends Item { async currency(...args: string[]): Promise {return this.$callMethod('currency',...args);} async deleteRow(a1: number): Promise {return this.$callMethod('deleteRow',a1);} async destroyFrame(): Promise {return this.$callMethod('destroyFrame');} - async draw(a1: minsky__dummy): Promise {return this.$callMethod('draw',a1);} + async draw(a1: ICairoShim): Promise {return this.$callMethod('draw',a1);} async editorMode(): Promise {return this.$callMethod('editorMode');} async flowSignature(a1: number): Promise {return this.$callMethod('flowSignature',a1);} async flowVars(): Promise> {return this.$callMethod('flowVars');} @@ -819,7 +849,7 @@ export class GodleyTableEditor extends CppClass { async deleteStockVar(a1: number): Promise {return this.$callMethod('deleteStockVar',a1);} async deleteStockVarByCol(a1: number): Promise {return this.$callMethod('deleteStockVarByCol',a1);} async disableButtons(): Promise {return this.$callMethod('disableButtons');} - async draw(a1: minsky__dummy): Promise {return this.$callMethod('draw',a1);} + async draw(...args: any[]): Promise {return this.$callMethod('draw',...args);} async drawButtons(...args: boolean[]): Promise {return this.$callMethod('drawButtons',...args);} async enableButtons(): Promise {return this.$callMethod('enableButtons');} async godleyIcon(): Promise {return this.$callMethod('godleyIcon');} @@ -1043,15 +1073,15 @@ export class Group extends Item { async displayContents(): Promise {return this.$callMethod('displayContents');} async displayContentsChanged(): Promise {return this.$callMethod('displayContentsChanged');} async displayDelayedTooltip(a1: number,a2: number): Promise {return this.$callMethod('displayDelayedTooltip',a1,a2);} - async displayTooltip(a1: minsky__dummy,a2: string): Promise {return this.$callMethod('displayTooltip',a1,a2);} + async displayTooltip(a1: ICairoShim,a2: string): Promise {return this.$callMethod('displayTooltip',a1,a2);} async displayZoom(...args: number[]): Promise {return this.$callMethod('displayZoom',...args);} - async draw(a1: minsky__dummy): Promise {return this.$callMethod('draw',a1);} + async draw(a1: ICairoShim): Promise {return this.$callMethod('draw',a1);} async draw1edge(a1: Sequence,a2: minsky__dummy,a3: number): Promise {return this.$callMethod('draw1edge',a1,a2,a3);} async drawEdgeVariables(a1: minsky__dummy): Promise {return this.$callMethod('drawEdgeVariables',a1);} async drawIORegion(a1: minsky__dummy): Promise {return this.$callMethod('drawIORegion',a1);} - async drawPorts(a1: minsky__dummy): Promise {return this.$callMethod('drawPorts',a1);} - async drawResizeHandles(a1: minsky__dummy): Promise {return this.$callMethod('drawResizeHandles',a1);} - async drawSelected(a1: minsky__dummy): Promise {return this.$callMethod('drawSelected',a1);} + async drawPorts(a1: ICairoShim): Promise {return this.$callMethod('drawPorts',a1);} + async drawResizeHandles(a1: ICairoShim): Promise {return this.$callMethod('drawResizeHandles',a1);} + async drawSelected(a1: ICairoShim): Promise {return this.$callMethod('drawSelected',a1);} async dummyDraw(): Promise {return this.$callMethod('dummyDraw');} async edgeScale(): Promise {return this.$callMethod('edgeScale');} async editorMode(): Promise {return this.$callMethod('editorMode');} @@ -1211,7 +1241,7 @@ export class IntOp extends Item { } async coupled(): Promise {return this.$callMethod('coupled');} async description(...args: string[]): Promise {return this.$callMethod('description',...args);} - async draw(a1: minsky__dummy): Promise {return this.$callMethod('draw',a1);} + async draw(a1: ICairoShim): Promise {return this.$callMethod('draw',a1);} async intVarOffset(...args: number[]): Promise {return this.$callMethod('intVarOffset',...args);} async onKeyPress(a1: number,a2: string,a3: number): Promise {return this.$callMethod('onKeyPress',a1,a2,a3);} async pack(a1: classdesc__pack_t,a2: string): Promise {return this.$callMethod('pack',a1,a2);} @@ -1250,7 +1280,7 @@ export class Lock extends Item { } async addPorts(): Promise {return this.$callMethod('addPorts');} async applyLockedStateToRavel(): Promise {return this.$callMethod('applyLockedStateToRavel');} - async draw(a1: minsky__dummy): Promise {return this.$callMethod('draw',a1);} + async draw(a1: ICairoShim): Promise {return this.$callMethod('draw',a1);} async locked(): Promise {return this.$callMethod('locked');} async ravelInput(): Promise {return this.$callMethod('ravelInput');} async toggleLocked(): Promise {return this.$callMethod('toggleLocked');} @@ -1489,9 +1519,9 @@ export class PhillipsDiagram extends RenderNativeWindow { async zoomFactor(): Promise {return this.$callMethod('zoomFactor');} } -export class PhillipsFlow extends Item { +export class PhillipsFlow extends Wire { maxFlow: Map; - constructor(prefix: string|Item){ + constructor(prefix: string|Wire){ if (typeof prefix==='string') super(prefix) else @@ -1499,30 +1529,9 @@ export class PhillipsFlow extends Item { this.maxFlow=new Map(this.$prefix()+'.maxFlow'); } async addTerm(a1: number,a2: string): Promise {return this.$callMethod('addTerm',a1,a2);} - async adjustBookmark(): Promise {return this.$callMethod('adjustBookmark');} - async bookmark(...args: boolean[]): Promise {return this.$callMethod('bookmark',...args);} - async coords(...args: any[]): Promise {return this.$callMethod('coords',...args);} - async deleteHandle(a1: number,a2: number): Promise {return this.$callMethod('deleteHandle',a1,a2);} - async detailedText(...args: any[]): Promise {return this.$callMethod('detailedText',...args);} - async draw(...args: any[]): Promise {return this.$callMethod('draw',...args);} - async editHandle(a1: number,a2: number,a3: number): Promise {return this.$callMethod('editHandle',a1,a2,a3);} - async from(): Promise {return this.$callMethod('from');} - async insertHandle(a1: number,a2: number,a3: number): Promise {return this.$callMethod('insertHandle',a1,a2,a3);} - async mouseFocus(...args: boolean[]): Promise {return this.$callMethod('mouseFocus',...args);} - async moveIntoGroup(a1: Group): Promise {return this.$callMethod('moveIntoGroup',a1);} - async moveToPorts(a1: Port,a2: Port): Promise {return this.$callMethod('moveToPorts',a1,a2);} - async near(a1: number,a2: number): Promise {return this.$callMethod('near',a1,a2);} - async nearestHandle(a1: number,a2: number): Promise {return this.$callMethod('nearestHandle',a1,a2);} - async selected(...args: boolean[]): Promise {return this.$callMethod('selected',...args);} - async split(): Promise {return this.$callMethod('split');} - async storeCairoCoords(a1: minsky__dummy): Promise {return this.$callMethod('storeCairoCoords',a1);} - async straighten(): Promise {return this.$callMethod('straighten');} - async to(): Promise {return this.$callMethod('to');} - async tooltip(...args: any[]): Promise {return this.$callMethod('tooltip',...args);} - async units(...args: boolean[]): Promise {return this.$callMethod('units',...args);} - async updateBoundingBox(): Promise {return this.$callMethod('updateBoundingBox');} + async draw(a1: ICairoShim,a2: boolean): Promise {return this.$callMethod('draw',a1,a2);} + async units(): Promise {return this.$callMethod('units');} async value(): Promise {return this.$callMethod('value');} - async visible(): Promise {return this.$callMethod('visible');} } export class PhillipsStock extends Item { @@ -1536,7 +1545,7 @@ export class PhillipsStock extends Item { } async classType(): Promise {return this.$callMethod('classType');} async clone(): Promise> {return this.$callMethod('clone');} - async draw(a1: minsky__dummy): Promise {return this.$callMethod('draw',a1);} + async draw(a1: ICairoShim): Promise {return this.$callMethod('draw',a1);} async numPorts(): Promise {return this.$callMethod('numPorts');} async type(): Promise {return this.$callMethod('type');} } @@ -1781,7 +1790,7 @@ export class Ravel extends Item { async dimensionUnitsFormat(...args: any[]): Promise {return this.$callMethod('dimensionUnitsFormat',...args);} async displayDelayedTooltip(a1: number,a2: number): Promise {return this.$callMethod('displayDelayedTooltip',a1,a2);} async displayFilterCaliper(): Promise {return this.$callMethod('displayFilterCaliper');} - async draw(a1: minsky__dummy): Promise {return this.$callMethod('draw',a1);} + async draw(a1: ICairoShim): Promise {return this.$callMethod('draw',a1);} async editorMode(): Promise {return this.$callMethod('editorMode');} async exportAsCSV(a1: string,a2: boolean): Promise {return this.$callMethod('exportAsCSV',a1,a2);} async flipped(...args: boolean[]): Promise {return this.$callMethod('flipped',...args);} @@ -1963,15 +1972,15 @@ export class Selection extends CppClass { async displayContents(): Promise {return this.$callMethod('displayContents');} async displayContentsChanged(): Promise {return this.$callMethod('displayContentsChanged');} async displayDelayedTooltip(a1: number,a2: number): Promise {return this.$callMethod('displayDelayedTooltip',a1,a2);} - async displayTooltip(a1: minsky__dummy,a2: string): Promise {return this.$callMethod('displayTooltip',a1,a2);} + async displayTooltip(a1: ICairoShim,a2: string): Promise {return this.$callMethod('displayTooltip',a1,a2);} async displayZoom(...args: number[]): Promise {return this.$callMethod('displayZoom',...args);} - async draw(a1: minsky__dummy): Promise {return this.$callMethod('draw',a1);} + async draw(a1: ICairoShim): Promise {return this.$callMethod('draw',a1);} async draw1edge(a1: Sequence,a2: minsky__dummy,a3: number): Promise {return this.$callMethod('draw1edge',a1,a2,a3);} async drawEdgeVariables(a1: minsky__dummy): Promise {return this.$callMethod('drawEdgeVariables',a1);} async drawIORegion(a1: minsky__dummy): Promise {return this.$callMethod('drawIORegion',a1);} - async drawPorts(a1: minsky__dummy): Promise {return this.$callMethod('drawPorts',a1);} - async drawResizeHandles(a1: minsky__dummy): Promise {return this.$callMethod('drawResizeHandles',a1);} - async drawSelected(a1: minsky__dummy): Promise {return this.$callMethod('drawSelected',a1);} + async drawPorts(a1: ICairoShim): Promise {return this.$callMethod('drawPorts',a1);} + async drawResizeHandles(a1: ICairoShim): Promise {return this.$callMethod('drawResizeHandles',a1);} + async drawSelected(a1: ICairoShim): Promise {return this.$callMethod('drawSelected',a1);} async dummyDraw(): Promise {return this.$callMethod('dummyDraw');} async edgeScale(): Promise {return this.$callMethod('edgeScale');} async editorMode(): Promise {return this.$callMethod('editorMode');} @@ -2083,8 +2092,8 @@ export class Sheet extends Item { async computeValue(): Promise {return this.$callMethod('computeValue');} async contains(a1: number,a2: number): Promise {return this.$callMethod('contains',a1,a2);} async corners(): Promise {return this.$callMethod('corners');} - async draw(a1: minsky__dummy): Promise {return this.$callMethod('draw',a1);} - async drawResizeHandles(a1: minsky__dummy): Promise {return this.$callMethod('drawResizeHandles',a1);} + async draw(a1: ICairoShim): Promise {return this.$callMethod('draw',a1);} + async drawResizeHandles(a1: ICairoShim): Promise {return this.$callMethod('drawResizeHandles',a1);} async exportAsCSV(a1: string,a2: boolean): Promise {return this.$callMethod('exportAsCSV',a1,a2);} async inItem(a1: number,a2: number): Promise {return this.$callMethod('inItem',a1,a2);} async inRavel(a1: number,a2: number): Promise {return this.$callMethod('inRavel',a1,a2);} @@ -2106,7 +2115,7 @@ export class SwitchIcon extends Item { else super(prefix.$prefix()) } - async draw(a1: minsky__dummy): Promise {return this.$callMethod('draw',a1);} + async draw(a1: ICairoShim): Promise {return this.$callMethod('draw',a1);} async flip(): Promise {return this.$callMethod('flip');} async flipped(...args: boolean[]): Promise {return this.$callMethod('flipped',...args);} async numCases(): Promise {return this.$callMethod('numCases');} @@ -2143,8 +2152,8 @@ export class UserFunction extends Item { async compile(): Promise {return this.$callMethod('compile');} async create(a1: string): Promise {return this.$callMethod('create',a1);} async description(...args: any[]): Promise {return this.$callMethod('description',...args);} - async displayTooltip(a1: minsky__dummy,a2: string): Promise {return this.$callMethod('displayTooltip',a1,a2);} - async draw(a1: minsky__dummy): Promise {return this.$callMethod('draw',a1);} + async displayTooltip(a1: ICairoShim,a2: string): Promise {return this.$callMethod('displayTooltip',a1,a2);} + async draw(a1: ICairoShim): Promise {return this.$callMethod('draw',a1);} async evaluate(a1: number,a2: number): Promise {return this.$callMethod('evaluate',a1,a2);} async expression(...args: string[]): Promise {return this.$callMethod('expression',...args);} async name(): Promise {return this.$callMethod('name');} @@ -2326,35 +2335,6 @@ export class VariableValues extends Map { async validEntries(): Promise {return this.$callMethod('validEntries');} } -export class Wire extends CppClass { - constructor(prefix: string){ - super(prefix); - } - async adjustBookmark(): Promise {return this.$callMethod('adjustBookmark');} - async bookmark(...args: boolean[]): Promise {return this.$callMethod('bookmark',...args);} - async coords(...args: any[]): Promise {return this.$callMethod('coords',...args);} - async deleteHandle(a1: number,a2: number): Promise {return this.$callMethod('deleteHandle',a1,a2);} - async detailedText(...args: any[]): Promise {return this.$callMethod('detailedText',...args);} - async draw(a1: minsky__dummy,a2: boolean): Promise {return this.$callMethod('draw',a1,a2);} - async editHandle(a1: number,a2: number,a3: number): Promise {return this.$callMethod('editHandle',a1,a2,a3);} - async from(): Promise {return this.$callMethod('from');} - async insertHandle(a1: number,a2: number,a3: number): Promise {return this.$callMethod('insertHandle',a1,a2,a3);} - async mouseFocus(...args: boolean[]): Promise {return this.$callMethod('mouseFocus',...args);} - async moveIntoGroup(a1: Group): Promise {return this.$callMethod('moveIntoGroup',a1);} - async moveToPorts(a1: Port,a2: Port): Promise {return this.$callMethod('moveToPorts',a1,a2);} - async near(a1: number,a2: number): Promise {return this.$callMethod('near',a1,a2);} - async nearestHandle(a1: number,a2: number): Promise {return this.$callMethod('nearestHandle',a1,a2);} - async selected(...args: boolean[]): Promise {return this.$callMethod('selected',...args);} - async split(): Promise {return this.$callMethod('split');} - async storeCairoCoords(a1: minsky__dummy): Promise {return this.$callMethod('storeCairoCoords',a1);} - async straighten(): Promise {return this.$callMethod('straighten');} - async to(): Promise {return this.$callMethod('to');} - async tooltip(...args: any[]): Promise {return this.$callMethod('tooltip',...args);} - async units(a1: boolean): Promise {return this.$callMethod('units',a1);} - async updateBoundingBox(): Promise {return this.$callMethod('updateBoundingBox');} - async visible(): Promise {return this.$callMethod('visible');} -} - export class civita__Conversions extends Map { constructor(prefix: string|Map){ if (typeof prefix==='string') diff --git a/minsky_epilogue.h b/minsky_epilogue.h index 7b37273c1..f0cacc73c 100644 --- a/minsky_epilogue.h +++ b/minsky_epilogue.h @@ -145,6 +145,18 @@ namespace classdesc_access template <> struct access_RESTProcess: public classdesc::NullDescriptor {}; + +#ifdef SVGITEM_H +#define CLASSDESC_json_pack___RsvgHandle + template <> struct access_json_pack: + classdesc::NullDescriptor {}; +#define CLASSDESC_json_unpack___RsvgHandle + template <> struct access_json_unpack: + classdesc::NullDescriptor {}; +#define CLASSDESC_RESTProcess___RsvgHandle + template <> struct access_RESTProcess: + classdesc::NullDescriptor {}; +#endif } #ifdef CIVITA_XVECTOR_H diff --git a/model/ICairoShim.h b/model/ICairoShim.h new file mode 100644 index 000000000..4e86223b0 --- /dev/null +++ b/model/ICairoShim.h @@ -0,0 +1,111 @@ +/* + Abstract interface for Cairo operations to enable testing and mocking + @copyright Steve Keen 2012 + @author Russell Standish + This file is part of Minsky. + + Minsky is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Minsky is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Minsky. If not, see . +*/ +#ifndef ICAIROSHIM_H +#define ICAIROSHIM_H + +#include +#include + +// Forward declarations +namespace ecolab { class Pango; } + +namespace minsky +{ + class SVGRenderer; + + /// Abstract interface for Cairo drawing operations + class ICairoShim + { + public: + virtual ~ICairoShim() = default; + + // Drawing operations + virtual void moveTo(double x, double y) const = 0; + virtual void lineTo(double x, double y) const = 0; + virtual void relMoveTo(double x, double y) const = 0; + virtual void relLineTo(double x, double y) const = 0; + virtual void arc(double x, double y, double radius, double start, double end) const = 0; + virtual void curveTo(double x1, double y1, double x2, double y2, double x3, double y3) const = 0; + virtual void rectangle(double x, double y, double width, double height) const = 0; + + // Path operations + virtual void newPath() const = 0; + virtual void newSubPath() const = 0; + virtual void closePath() const = 0; + virtual void getCurrentPoint(double& x, double& y) const = 0; + + // Fill and stroke operations + virtual void fill() const = 0; + virtual void fillPreserve() const = 0; + virtual void stroke() const = 0; + virtual void strokePreserve() const = 0; + virtual void clip() const = 0; + virtual void resetClip() const = 0; + virtual void paint() const = 0; + + // Line properties + virtual void setLineWidth(double width) const = 0; + virtual double getLineWidth() const = 0; + virtual void setDash(const double* dashes, int num_dashes, double offset) const = 0; + virtual void setFillRule(cairo_fill_rule_t fill_rule) const = 0; + + // Color operations + virtual void setSourceRGB(double r, double g, double b) const = 0; + virtual void setSourceRGBA(double r, double g, double b, double a) const = 0; + + // Text operations + virtual void showText(const std::string& text) const = 0; + virtual void setFontSize(double size) const = 0; + virtual void selectFontFace(const std::string& family, cairo_font_slant_t slant, cairo_font_weight_t weight) const = 0; + virtual void textExtents(const std::string& text, cairo_text_extents_t& extents) const = 0; + + // Transformation operations + virtual void identityMatrix() const = 0; + virtual void translate(double x, double y) const = 0; + virtual void scale(double sx, double sy) const = 0; + virtual void rotate(double angle) const = 0; + virtual void userToDevice(double& x, double& y) const = 0; + + // Context state operations + virtual void save() const = 0; + virtual void restore() const = 0; + + // Tolerance + virtual void setTolerance(double tolerance) const = 0; + + // TODO: this needs to be fixed with a proper text rendering interface. + // For now use a newPango call that resets the pango + // Pango support for text rendering + virtual ecolab::Pango& pango() const = 0; + virtual ecolab::Pango& newPango() const = 0; + + // SVG rendering support + /// Render an SVG resource into a region of size width x height + /// @param svgRenderer - Reference to SVGRenderer containing the loaded SVG resource + /// @param width - target width for rendering + /// @param height - target height for rendering + virtual void renderSVG(const SVGRenderer& svgRenderer, double width, double height) const = 0; + }; + + +} + +#include "ICairoShim.xcd" +#endif // ICAIROSHIM_H diff --git a/model/SVGItem.cc b/model/SVGItem.cc index fd9acd5a6..5d2de4a32 100644 --- a/model/SVGItem.cc +++ b/model/SVGItem.cc @@ -98,3 +98,5 @@ namespace minsky } CLASSDESC_ACCESS_EXPLICIT_INSTANTIATION(minsky::SVGRenderer); + + diff --git a/model/SVGItem.h b/model/SVGItem.h index c90121d14..188ae7fe2 100644 --- a/model/SVGItem.h +++ b/model/SVGItem.h @@ -33,6 +33,7 @@ namespace minsky #ifdef MXE double m_width=0, m_height=0; #endif + friend class CairoShimCairo; public: SVGRenderer() {} SVGRenderer(const std::string& resource) {setResource(resource);} @@ -49,6 +50,16 @@ namespace minsky } +namespace classdesc +{ +#define CLASSDESC_TYPENAME___RsvgHandle + template <> + struct tn { + static string name() {return "RsvgHandle";} + }; +} + + #include "SVGItem.cd" #include "SVGItem.xcd" #endif diff --git a/model/cairoItems.cc b/model/cairoItems.cc index 9482bd812..b594cf710 100644 --- a/model/cairoItems.cc +++ b/model/cairoItems.cc @@ -28,6 +28,7 @@ #include "minsky.h" #include "cairoItems.h" +#include "../engine/cairoShimCairo.h" #include "operation.h" #include "latexMarkup.h" #include @@ -83,8 +84,8 @@ RenderVariable::RenderVariable(const VariableBase& var, cairo_t* cairo): void RenderVariable::draw() { - var.draw(cairo); - + CairoShimCairo shim(cairo); + var.draw(shim); } bool RenderVariable::inImage(float x, float y) @@ -121,3 +122,18 @@ void minsky::drawTriangle cairo_fill(cairo); } +void minsky::drawTriangle +(const ICairoShim& cairoShim, double x, double y, const cairo::Colour& col, double angle) +{ + cairoShim.save(); + cairoShim.newPath(); + cairoShim.setSourceRGBA(col.r,col.g,col.b,col.a); + cairoShim.translate(x,y); + cairoShim.rotate(angle); + cairoShim.moveTo(10,0); + cairoShim.lineTo(0,-3); + cairoShim.lineTo(0,3); + cairoShim.fill(); + cairoShim.restore(); +} + diff --git a/model/cairoItems.h b/model/cairoItems.h index 08881a20f..a4137445a 100644 --- a/model/cairoItems.h +++ b/model/cairoItems.h @@ -54,5 +54,6 @@ namespace minsky }; void drawTriangle(cairo_t* cairo, double x, double y, const ecolab::cairo::Colour& col, double angle=0); + void drawTriangle(const ICairoShim& cairoShim, double x, double y, const ecolab::cairo::Colour& col, double angle=0); } #endif diff --git a/model/canvas.cc b/model/canvas.cc index 75daea5d0..01f5ebe18 100644 --- a/model/canvas.cc +++ b/model/canvas.cc @@ -26,6 +26,7 @@ #include "ravelWrap.h" #include +#include "cairoShimCairo.h" #include "canvas.rcd" #include "canvas.xcd" #include "eventInterface.rcd" @@ -852,7 +853,8 @@ namespace minsky cairo_translate(cairo,it.x(), it.y()); try { - it.draw(cairo); + CairoShimCairo shim(cairo); + it.draw(shim); } catch (const std::exception& ex) { @@ -873,7 +875,10 @@ namespace minsky const CairoSave cs(cairo); cairo_identity_matrix(cairo); cairo_translate(cairo,it.x(), it.y()); - it.draw(cairo); + { + CairoShimCairo shim(cairo); + it.draw(shim); + } } return false; }); @@ -885,7 +890,8 @@ namespace minsky { const Wire& w=**i; if (w.visible()) { - w.draw(cairo); + CairoShimCairo shim(cairo); + w.draw(shim); } return false; }); diff --git a/model/dataOp.h b/model/dataOp.h index 3163273b9..fe1385227 100644 --- a/model/dataOp.h +++ b/model/dataOp.h @@ -31,11 +31,11 @@ namespace minsky CLASSDESC_ACCESS(DataOp); friend struct SchemaHelper; void updateBB() override {bb.update(*this);} - void draw(cairo_t* cairo) const override { + void draw(const ICairoShim& cairoShim) const override { if (description().empty()) - OperationBase::draw(cairo); + OperationBase::draw(cairoShim); else - drawUserFunction(cairo); + drawUserFunction(cairoShim); } public: diff --git a/model/godleyIcon.cc b/model/godleyIcon.cc index 20df647c3..fad68f239 100644 --- a/model/godleyIcon.cc +++ b/model/godleyIcon.cc @@ -27,6 +27,7 @@ #include #include #include +#include "../engine/cairoShimCairo.h" #include "godleyIcon.rcd" #include "itemT.rcd" #include "godleyTableWindow.xcd" @@ -50,23 +51,22 @@ namespace minsky {assert(x&&y); return x->valueId() < y->valueId();} }; - struct DrawVars + struct DrawVarsShim { - cairo_t* cairo; - float x, y; // position of this icon - DrawVars(cairo_t* cairo, float x, float y): - cairo(cairo), x(x), y(y) {} - + const ICairoShim& cairoShim; + float x, y; + DrawVarsShim(const ICairoShim& cairoShim, float x, float y): + cairoShim(cairoShim), x(x), y(y) {} + void operator()(const GodleyIcon::Variables& vars) const { - for (GodleyIcon::Variables::const_iterator v=vars.begin(); - v!=vars.end(); ++v) + for (const auto& v: vars) { - const ecolab::cairo::CairoSave cs(cairo); - const VariableBase& vv=**v; - // coordinates of variable within the cairo context - cairo_translate(cairo, vv.x()-x, vv.y()-y); - vv.draw(cairo); + cairoShim.save(); + const VariableBase& vv=*v; + cairoShim.translate(vv.x()-x, vv.y()-y); + vv.draw(cairoShim); + cairoShim.restore(); } } }; @@ -438,8 +438,7 @@ namespace minsky return r; } - - void GodleyIcon::draw(cairo_t* cairo) const + void GodleyIcon::draw(const ICairoShim& cairoShim) const { positionVariables(); const float z=zoomFactor()*scaleFactor(); @@ -448,50 +447,55 @@ namespace minsky if (m_editorMode) { - const CairoSave cs(cairo); - cairo_rectangle(cairo, left, top, w, h); - cairo_rectangle(cairo, left-border*z, top-border*z, w+2*border*z, h+2*border*z); - cairo_stroke_preserve(cairo); + cairoShim.save(); + cairoShim.rectangle(left, top, w, h); + cairoShim.rectangle(left-border*z, top-border*z, w+2*border*z, h+2*border*z); + cairoShim.strokePreserve(); if (onBorder) { // shadow the border when mouse is over it - const cairo::CairoSave cs(cairo); - cairo_set_source_rgba(cairo,0.5,0.5,0.5,0.5); - cairo_set_fill_rule(cairo,CAIRO_FILL_RULE_EVEN_ODD); - cairo_fill(cairo); + cairoShim.save(); + cairoShim.setSourceRGBA(0.5,0.5,0.5,0.5); + cairoShim.setFillRule(CAIRO_FILL_RULE_EVEN_ODD); + cairoShim.fill(); + cairoShim.restore(); } - cairo_new_path(cairo); - cairo_rectangle(cairo, left, top, w, h); - cairo_clip(cairo); - cairo_translate(cairo,left+border*z+leftMargin(),top+border*z+titleOffs()/* space for title*/); + cairoShim.newPath(); + cairoShim.rectangle(left, top, w, h); + cairoShim.clip(); + cairoShim.translate(left+border*z+leftMargin(),top+border*z+titleOffs()/* space for title*/); // render to a recording surface to determine size of editor table // TODO - maybe move this stuff into update() const Surface surf(cairo_recording_surface_create(CAIRO_CONTENT_COLOR, nullptr)); const_cast(editor).zoomFactor=1; const_cast(editor).draw(surf.cairo()); const_cast(editor).zoomFactor=min((w-leftMargin()-2*border*z)/surf.width(),(h-bottomMargin()-2*border*z-titleOffs())/surf.height()); - const_cast(editor).draw(cairo); + const_cast(editor).draw(cairoShim); titley=-0.5*h; w+=2*border*z; h+=2*border*z; left-=border*z; top-=border*z; + cairoShim.restore(); } else { - const CairoSave cs(cairo); - cairo_translate(cairo,left+leftMargin(),top); - svgRenderer.render(cairo, w-leftMargin(), h-bottomMargin()); + cairoShim.save(); + cairoShim.translate(left+leftMargin(),top); + // Render SVG using ICairoShim abstraction + cairoShim.renderSVG(svgRenderer, w-leftMargin(), h-bottomMargin()); titley=top+0.1*(h-bottomMargin()); + cairoShim.restore(); } if (!table.title.empty()) { - const CairoSave cs(cairo); - Pango pango(cairo); + cairoShim.save(); + auto& pango = cairoShim.pango(); pango.setMarkup(""+latexToPango(table.title)+""); pango.setFontSize(titleOffs()); - cairo_move_to(cairo,-0.5*(pango.width()-leftMargin()), titley); + cairoShim.moveTo(-0.5*(pango.width()-leftMargin()), titley); pango.show(); + cairoShim.restore(); } @@ -499,23 +503,23 @@ namespace minsky if (m_variableDisplay && (!m_editorMode || wiresAttached())) { // render the variables - const DrawVars drawVars(cairo,x(),y()); - drawVars(m_flowVars); - drawVars(m_stockVars); + const DrawVarsShim drawVars(cairoShim,x(),y()); + drawVars(m_flowVars); + drawVars(m_stockVars); } if (mouseFocus) { - drawPorts(cairo); - displayTooltip(cairo,tooltip()); - drawResizeHandles(cairo); + drawPorts(cairoShim); + displayTooltip(cairoShim,tooltip()); + drawResizeHandles(cairoShim); } - cairo_rectangle(cairo, left,top, w, h); - cairo_clip(cairo); + cairoShim.rectangle(left,top, w, h); + cairoShim.clip(); if (selected) { - drawSelected(cairo); + drawSelected(cairoShim); } } diff --git a/model/godleyIcon.h b/model/godleyIcon.h index 933efd03c..694a03d04 100644 --- a/model/godleyIcon.h +++ b/model/godleyIcon.h @@ -132,7 +132,7 @@ namespace minsky ClickType::Type clickType(float x, float y) const override; /// draw icon to \a context - void draw(cairo_t* cairo) const override; + void draw(const ICairoShim& cairoShim) const override; /// return the A-L-E row sum for \a row std::string rowSum(int row) const; diff --git a/model/godleyTableWindow.cc b/model/godleyTableWindow.cc index bced409c4..84274bd72 100644 --- a/model/godleyTableWindow.cc +++ b/model/godleyTableWindow.cc @@ -20,6 +20,7 @@ #include "cairoItems.h" #include "minsky.h" #include "godleyTableWindow.h" +#include "../engine/cairoShimCairo.h" #include "selection.h" #include "latexMarkup.h" #include @@ -1219,6 +1220,19 @@ namespace { } + template + void ButtonWidget::draw(const ICairoShim& cairoShim) + { + auto& shimImpl = dynamic_cast(cairoShim); + draw(shimImpl._internalGetCairoContext()); + } + + void GodleyTableEditor::draw(const ICairoShim& cairoShim) + { + auto& shimImpl = dynamic_cast(cairoShim); + draw(shimImpl._internalGetCairoContext()); + } + template class ButtonWidget; template class ButtonWidget; } diff --git a/model/godleyTableWindow.h b/model/godleyTableWindow.h index f3fd541ef..caf0367de 100644 --- a/model/godleyTableWindow.h +++ b/model/godleyTableWindow.h @@ -25,6 +25,7 @@ #define GODLEYTABLEWINDOW_H #include "assetClass.h" #include "godleyTable.h" +#include "ICairoShim.h" #include "renderNativeWindow.h" #include #include @@ -54,6 +55,7 @@ namespace minsky unsigned idx=0; ///< row or column this widget is located in void draw(cairo_t*); + void draw(const ICairoShim&); /// draw button \a idx, with label \a label and colour \a r, \a b, \a g void drawButton(cairo_t*, const std::string& label, double r, double g, double b, int idx); @@ -120,6 +122,7 @@ namespace minsky {m_enableButtons(); adjustWidgets();} void draw(cairo_t* cairo); + void draw(const ICairoShim& cairoShim); double width() const {return colLeftMargin.empty()? 0: colLeftMargin.back();} double height() const; diff --git a/model/group.cc b/model/group.cc index 39221d9ba..359c28183 100644 --- a/model/group.cc +++ b/model/group.cc @@ -25,6 +25,7 @@ #include "autoLayout.h" #include "equations.h" #include +#include "../engine/cairoShimCairo.h" #include "group.rcd" #include "itemT.rcd" #include "bookmark.rcd" @@ -926,7 +927,7 @@ namespace minsky return ClickType::outside; } - void Group::draw(cairo_t* cairo) const + void Group::draw(const ICairoShim& cairoShim) const { auto [angle,flipped]=rotationAsRadians(); @@ -937,47 +938,51 @@ namespace minsky const float z=zoomFactor(); const unsigned width=z*this->iWidth(), height=z*this->iHeight(); - const cairo::CairoSave cs(cairo); - cairo_rotate(cairo,angle); + cairoShim.save(); + cairoShim.rotate(angle); // In docker environments, something invisible gets drawn outside // the horizontal dimensions, stuffing up the bb.width() // calculation, and then causing the groupResize test to // fail. This extra clip path fixes the problem. - cairo_rectangle(cairo,-0.5*width,-0.5*height-topMargin*z, width, height+2*topMargin*z); - cairo_clip(cairo); + cairoShim.rectangle(-0.5*width,-0.5*height-topMargin*z, width, height+2*topMargin*z); + cairoShim.clip(); // draw default group icon // display I/O region in grey + // drawIORegion needs cairo_t* for now + auto& shimImpl = dynamic_cast(cairoShim); + cairo_t* cairo = shimImpl._internalGetCairoContext(); drawIORegion(cairo); { - const cairo::CairoSave cs(cairo); - cairo_translate(cairo, -0.5*width+leftMargin, -0.5*height); + cairoShim.save(); + cairoShim.translate(-0.5*width+leftMargin, -0.5*height); const double scalex=double(width-leftMargin-rightMargin)/width; - cairo_scale(cairo, scalex, 1); + cairoShim.scale(scalex, 1); // draw a simple frame - cairo_rectangle(cairo,0,0,width,height); + cairoShim.rectangle(0,0,width,height); { - const cairo::CairoSave cs(cairo); - cairo_identity_matrix(cairo); - cairo_set_line_width(cairo,1); - cairo_stroke(cairo); + cairoShim.save(); + cairoShim.identityMatrix(); + cairoShim.setLineWidth(1); + cairoShim.stroke(); + cairoShim.restore(); } if (!displayContents()) { if (displayPlot) { - const cairo::CairoSave cs(cairo); + cairoShim.save(); if (flipped) { - cairo_translate(cairo,width,height); - cairo_rotate(cairo,M_PI); // rotate plot to keep it right way up. + cairoShim.translate(width,height); + cairoShim.rotate(M_PI); // rotate plot to keep it right way up. } // propagate plot type to underling ecolab::Plot auto& pt=const_cast(static_cast(displayPlot.get()))->plotType; @@ -987,62 +992,67 @@ namespace minsky case PlotWidget::bar: pt=Plot::bar; break; default: break; } + // Plot::draw needs cairo_t* displayPlot->Plot::draw(cairo, width, height); + cairoShim.restore(); } else { - cairo_rectangle(cairo,0, 0,width, height); - cairo_clip(cairo); - svgRenderer.render(cairo,width, height); + cairoShim.rectangle(0, 0,width, height); + cairoShim.clip(); + // Render SVG using ICairoShim abstraction + cairoShim.renderSVG(svgRenderer, width, height); } } + cairoShim.restore(); } + // drawEdgeVariables needs cairo_t* for now drawEdgeVariables(cairo); // display text label if (!title.empty()) { - const cairo::CairoSave cs(cairo); - cairo_scale(cairo, z, z); - cairo_select_font_face - (cairo, "sans-serif", CAIRO_FONT_SLANT_ITALIC, - CAIRO_FONT_WEIGHT_NORMAL); - cairo_set_font_size(cairo,12); + cairoShim.save(); + cairoShim.scale(z, z); + cairoShim.selectFontFace("sans-serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL); + cairoShim.setFontSize(12); // extract the bounding box of the text cairo_text_extents_t bbox; - cairo_text_extents(cairo,title.c_str(),&bbox); + cairoShim.textExtents(title, bbox); const double w=0.5*bbox.width+2; const double h=0.5*bbox.height+5; // if rotation is in 1st or 3rd quadrant, rotate as // normal, otherwise flip the text so it reads L->R if (flipped) - cairo_rotate(cairo, M_PI); + cairoShim.rotate(M_PI); // prepare a background for the text, partially obscuring graphic const double transparency=displayContents()? 0.25: 1; // display text - cairo_move_to(cairo, -w+1, h-12-0.5*(height)/z); - cairo_set_source_rgba(cairo,0,0,0,transparency); - cairo_show_text(cairo,title.c_str()); + cairoShim.moveTo(-w+1, h-12-0.5*(height)/z); + cairoShim.setSourceRGBA(0,0,0,transparency); + cairoShim.showText(title); + cairoShim.restore(); } if (mouseFocus) { - displayTooltip(cairo,tooltip()); + displayTooltip(cairoShim,tooltip()); // Resize handles always visible on mousefocus. For ticket 92. - drawResizeHandles(cairo); + drawResizeHandles(cairoShim); } - cairo_rectangle(cairo,-0.5*width,-0.5*height,width,height); - cairo_clip(cairo); + cairoShim.rectangle(-0.5*width,-0.5*height,width,height); + cairoShim.clip(); if (selected) - drawSelected(cairo); + drawSelected(cairoShim); + cairoShim.restore(); } // Helper to compute edge variable layout (world-space positions) radially @@ -1093,7 +1103,10 @@ namespace minsky cairo_translate(cairo,xEdge,yOff); // cairo context is already rotated, so antirotate cairo_rotate(cairo,-angle); - v->draw(cairo); + { + CairoShimCairo shim(cairo); + v->draw(shim); + } if (i == 0) { diff --git a/model/group.h b/model/group.h index e9e043ce4..eb276ec51 100644 --- a/model/group.h +++ b/model/group.h @@ -268,7 +268,7 @@ namespace minsky /// Make all variables not present in outerscope local to this group void makeSubroutine(); - void draw(cairo_t*) const override; + void draw(const ICairoShim&) const override; /// draw representations of edge variables around group icon void drawEdgeVariables(cairo_t*) const; diff --git a/model/intOp.cc b/model/intOp.cc index 522b8b73b..ac7292a21 100644 --- a/model/intOp.cc +++ b/model/intOp.cc @@ -22,6 +22,7 @@ #include "intOp.h" #include "intOp.rcd" #include "itemT.rcd" +#include "../engine/cairoShimCairo.h" #include "minsky_epilogue.h" namespace minsky @@ -34,8 +35,11 @@ namespace minsky return r; } - void IntOp::draw(cairo_t* cairo) const + void IntOp::draw(const ICairoShim& cairoShim) const { + // TODO: Refactor to use cairoShim methods instead of raw cairo_t* + auto& shimImpl = dynamic_cast(cairoShim); + cairo_t* cairo = shimImpl._internalGetCairoContext(); // if rotation is in 1st or 3rd quadrant, rotate as // normal, otherwise flip the text so it reads L->R auto [angle,textFlipped]=rotationAsRadians(); @@ -51,53 +55,55 @@ namespace minsky if (coupled() && intVar) { - const cairo::CairoSave cs(cairo); + cairoShim.save(); auto& iv=*intVar; const RenderVariable rv(iv,cairo); // we need to add some translation if the variable is bound cairo_rotate(cairo,angle); coupledIntTranslation=-0.5*(intVarOffset+2*rv.width()+2+r)*z; if (rv.width()moveTo(ivp.x(), ivp.y()); - cairo_save(cairo); - cairo_translate(cairo,r+ivo+intVarWidth,0); + cairoShim.save(); + cairoShim.translate(r+ivo+intVarWidth,0); // to get text to render correctly, we need to set // the var's rotation, then antirotate it intVar->rotation(rotation()); - cairo_rotate(cairo, -M_PI*rotation()/180.0); + cairoShim.rotate(-M_PI*rotation()/180.0); rv.draw(); - cairo_restore(cairo); + cairoShim.restore(); // build clip path the hard way grr... - cairo_move_to(cairo,l,h); - cairo_line_to(cairo,l,-h); - cairo_line_to(cairo,r,0); - cairo_line_to(cairo,r+ivo,0); + cairoShim.moveTo(l,h); + cairoShim.lineTo(l,-h); + cairoShim.lineTo(r,0); + cairoShim.lineTo(r+ivo,0); float rvw=rv.width()*z, rvh=rv.height()*z; if (rv.width()iWidth()) rvw=intVar->iWidth()*z; if (rv.height()iHeight()) rvh=intVar->iHeight()*z; - cairo_line_to(cairo,r+ivo,-rvh); - cairo_line_to(cairo,r+ivo+2*rvw,-rvh); - cairo_line_to(cairo,r+ivo+2*rvw+2*z,0); - cairo_line_to(cairo,r+ivo+2*rvw,rvh); - cairo_line_to(cairo,r+ivo,rvh); - cairo_line_to(cairo,r+ivo,0); - cairo_line_to(cairo,r,0); - cairo_close_path(cairo); + cairoShim.lineTo(r+ivo,-rvh); + cairoShim.lineTo(r+ivo+2*rvw,-rvh); + cairoShim.lineTo(r+ivo+2*rvw+2*z,0); + cairoShim.lineTo(r+ivo+2*rvw,rvh); + cairoShim.lineTo(r+ivo,rvh); + cairoShim.lineTo(r+ivo,0); + cairoShim.lineTo(r,0); + cairoShim.closePath(); } cairo::Path clipPath(cairo); @@ -147,14 +153,14 @@ namespace minsky if (coupled()) x0+=intVarOffset+2*intVarWidth+2; - cairo_save(cairo); + cairoShim.save(); cairo_identity_matrix(cairo); cairo_translate(cairo, x(), y()); cairo_rotate(cairo, angle); cairo_user_to_device(cairo, &x0, &y0); cairo_user_to_device(cairo, &x1, &y1); cairo_user_to_device(cairo, &x2, &y2); - cairo_restore(cairo); + cairoShim.restore(); if (numPorts()>0) m_ports[0]->moveTo(x0, y0); @@ -163,19 +169,19 @@ namespace minsky if (numPorts()>2) m_ports[2]->moveTo(x2, y2); - cairo_translate(cairo,-coupledIntTranslation,0); - cairo_restore(cairo); // undo rotation + cairoShim.translate(-coupledIntTranslation,0); + cairoShim.restore(); // undo rotation if (mouseFocus) { - drawPorts(cairo); - displayTooltip(cairo,tooltip()); + drawPorts(cairoShim); + displayTooltip(cairoShim,tooltip()); } - if (onResizeHandles) drawResizeHandles(cairo); + if (onResizeHandles) drawResizeHandles(cairoShim); - cairo_new_path(cairo); + cairoShim.newPath(); clipPath.appendToCurrent(cairo); - cairo_clip(cairo); - if (selected) drawSelected(cairo); + cairoShim.clip(); + if (selected) drawSelected(cairoShim); } void IntOp::resize(const LassoBox& b) diff --git a/model/intOp.h b/model/intOp.h index cba540eb8..0d256397c 100644 --- a/model/intOp.h +++ b/model/intOp.h @@ -63,7 +63,7 @@ namespace minsky std::string valueId() const {return intVar->valueId();} - void draw(cairo_t*) const override; + void draw(const ICairoShim&) const override; void resize(const LassoBox& b) override; /// return reference to integration variable diff --git a/model/item.cc b/model/item.cc index fa8869504..60765e8da 100644 --- a/model/item.cc +++ b/model/item.cc @@ -20,6 +20,7 @@ #include "cairoItems.h" #include "minsky.h" #include "item.h" +#include "../engine/cairoShimCairo.h" #include "group.h" #include "zoom.h" #include "variable.h" @@ -60,7 +61,8 @@ namespace minsky { const cairo::CairoSave cs(surf.cairo()); cairo_rotate(surf.cairo(),-x.rotation()*M_PI/180); - x.draw(surf.cairo()); + CairoShimCairo shim(surf.cairo()); + x.draw(shim); } #ifndef NDEBUG catch (const std::exception& e) @@ -157,7 +159,7 @@ namespace minsky auto top=y()+bb.top()*zoomFactor(), bottom=y()+bb.bottom()*zoomFactor(); memoisedRotator.update(rotation(),x(),y()); return {memoisedRotator(left,top),memoisedRotator(left,bottom), - memoisedRotator(right,bottom),memoisedRotator(right,top)}; + memoisedRotator(right,bottom),memoisedRotator(right,top)}; } float Item::left() const @@ -230,7 +232,7 @@ namespace minsky float rhSize=resizeHandleSize(); auto cnrs=corners(); return any_of(cnrs.begin(), cnrs.end(), [&](const Point& p) - {return near(x,y,p.x(),p.y(),rhSize);}); + {return near(x,y,p.x(),p.y(),rhSize);}); } bool BottomRightResizerItem::onResizeHandle(float x, float y) const @@ -291,43 +293,46 @@ namespace minsky return ClickType::outside; } - void Item::drawPorts(cairo_t* cairo) const + void Item::drawPorts(const ICairoShim& cairoShim) const { - const CairoSave cs(cairo); - cairo_new_path(cairo); + cairoShim.save(); + cairoShim.newPath(); for (auto& p: m_ports) { - cairo_new_sub_path(cairo); - cairo_arc(cairo, p->x()-x(), p->y()-y(), portRadius*zoomFactor(), 0, 2*M_PI); + cairoShim.newSubPath(); + cairoShim.arc(p->x()-x(), p->y()-y(), portRadius*zoomFactor(), 0, 2*M_PI); } - cairo_set_source_rgb(cairo, 0,0,0); - cairo_set_line_width(cairo,1); - cairo_stroke(cairo); + cairoShim.setSourceRGB(0,0,0); + cairoShim.setLineWidth(1); + cairoShim.stroke(); + cairoShim.restore(); } - void Item::drawSelected(cairo_t* cairo) + void Item::drawSelected(const ICairoShim& cairoShim) { // implemented by filling the clip region with a transparent grey - const CairoSave cs(cairo); - cairo_set_source_rgba(cairo, 0.5,0.5,0.5,0.4); - cairo_paint(cairo); + cairoShim.save(); + cairoShim.setSourceRGBA(0.5,0.5,0.5,0.4); + cairoShim.paint(); + cairoShim.restore(); + } + + void Item::drawResizeHandle(const ICairoShim& cairoShim, double x, double y, double sf, double angle) + { + cairoShim.save(); + cairoShim.translate(x,y); + cairoShim.rotate(angle); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-1,-.2); + cairoShim.lineTo(-1,-1); + cairoShim.lineTo(1,1); + cairoShim.lineTo(1,0.2); + cairoShim.moveTo(-1,-1); + cairoShim.lineTo(-.2,-1); + cairoShim.moveTo(.2,1); + cairoShim.lineTo(1,1); + cairoShim.restore(); } - - void Item::drawResizeHandle(cairo_t* cairo, double x, double y, double sf, double angle) - { - const cairo::CairoSave cs(cairo); - cairo_translate(cairo,x,y); - cairo_rotate(cairo,angle); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-1,-.2); - cairo_line_to(cairo,-1,-1); - cairo_line_to(cairo,1,1); - cairo_line_to(cairo,1,0.2); - cairo_move_to(cairo,-1,-1); - cairo_line_to(cairo,-.2,-1); - cairo_move_to(cairo,.2,1); - cairo_line_to(cairo,1,1); - } // Refactor resize() code for all canvas items here. For feature 25 and 94 void Item::resize(const LassoBox& b) @@ -340,31 +345,30 @@ namespace minsky scaleFactor(std::max(1.0f,std::min(iWidth()/w,iHeight()/h))); } - void Item::drawResizeHandles(cairo_t* cairo) const + void Item::drawResizeHandles(const ICairoShim& cairoShim) const { auto sf=resizeHandleSize(); double angle=0.5*M_PI; for (auto& p: corners()) { angle+=0.5*M_PI; - drawResizeHandle(cairo,p.x()-x(),p.y()-y(),sf,angle); + drawResizeHandle(cairoShim,p.x()-x(),p.y()-y(),sf,angle); } - cairo_stroke(cairo); + cairoShim.stroke(); } - void BottomRightResizerItem::drawResizeHandles(cairo_t* cairo) const + void BottomRightResizerItem::drawResizeHandles(const ICairoShim& cairoShim) const { const Point p=resizeHandleCoords(); - drawResizeHandle(cairo,p.x()-x(),p.y()-y(),resizeHandleSize(),0); - cairo_stroke(cairo); + drawResizeHandle(cairoShim,p.x()-x(),p.y()-y(),resizeHandleSize(),0); + cairoShim.stroke(); } - // default is just to display the detailed text (ie a "note") - void Item::draw(cairo_t* cairo) const + void Item::draw(const ICairoShim& cairoShim) const { auto [angle,flipped]=rotationAsRadians(); const Rotate r(rotation()+(flipped? 180:0),0,0); - Pango pango(cairo); + auto& pango = cairoShim.pango(); const float z=zoomFactor(); pango.angle=angle+(flipped? M_PI: 0); pango.setFontSize(12.0*scaleFactor()*z); @@ -373,48 +377,50 @@ namespace minsky const float w=0.5*pango.width()+2*z; const float h=0.5*pango.height()+4*z; - cairo_move_to(cairo,r.x(-w+1,-h+2), r.y(-w+1,-h+2)); + cairoShim.moveTo(r.x(-w+1,-h+2), r.y(-w+1,-h+2)); pango.show(); if (mouseFocus) { - displayTooltip(cairo,tooltip()); + displayTooltip(cairoShim,tooltip()); } - if (onResizeHandles) drawResizeHandles(cairo); - cairo_move_to(cairo,r.x(-w,-h), r.y(-w,-h)); - cairo_line_to(cairo,r.x(w,-h), r.y(w,-h)); - cairo_line_to(cairo,r.x(w,h), r.y(w,h)); - cairo_line_to(cairo,r.x(-w,h), r.y(-w,h)); - cairo_close_path(cairo); - cairo_clip(cairo); - if (selected) drawSelected(cairo); + if (onResizeHandles) drawResizeHandles(cairoShim); + cairoShim.moveTo(r.x(-w,-h), r.y(-w,-h)); + cairoShim.lineTo(r.x(w,-h), r.y(w,-h)); + cairoShim.lineTo(r.x(w,h), r.y(w,h)); + cairoShim.lineTo(r.x(-w,h), r.y(-w,h)); + cairoShim.closePath(); + cairoShim.clip(); + if (selected) drawSelected(cairoShim); } void Item::dummyDraw() const { const ecolab::cairo::Surface s(cairo_recording_surface_create(CAIRO_CONTENT_COLOR_ALPHA,NULL)); - draw(s.cairo()); + CairoShimCairo shim(s.cairo()); + draw(shim); } - void Item::displayTooltip(cairo_t* cairo, const std::string& tooltip) const + void Item::displayTooltip(const ICairoShim& cairoShim, const std::string& tooltip) const { const string unitstr=units().latexStr(); if (!tooltip.empty() || !unitstr.empty()) { - const cairo::CairoSave cs(cairo); - Pango pango(cairo); + cairoShim.save(); + auto& pango = cairoShim.newPango(); string toolTipText=latexToPango(tooltip); if (!unitstr.empty()) toolTipText+=" Units:"+latexToPango(unitstr); pango.setMarkup(toolTipText); const float z=zoomFactor(); - cairo_translate(cairo,z*(0.5*bb.width())+10, - z*(-0.5*bb.height())-20); - cairo_rectangle(cairo,0,0,pango.width(),pango.height()); - cairo_set_source_rgb(cairo,1,1,1); - cairo_fill_preserve(cairo); - cairo_set_source_rgb(cairo,0,0,0); + cairoShim.translate(z*(0.5*bb.width())+10, + z*(-0.5*bb.height())-20); + cairoShim.rectangle(0,0,pango.width(),pango.height()); + cairoShim.setSourceRGB(1,1,1); + cairoShim.fillPreserve(); + cairoShim.setSourceRGB(0,0,0); pango.show(); - cairo_stroke(cairo); + cairoShim.stroke(); + cairoShim.restore(); } } diff --git a/model/item.h b/model/item.h index 7d8961cfe..ea8f07d4b 100644 --- a/model/item.h +++ b/model/item.h @@ -26,12 +26,11 @@ #include "geometry.h" #include "str.h" #include "polyRESTProcessBase.h" +#include "ICairoShim.h" #include -#include #include -#include #include #include @@ -162,7 +161,7 @@ namespace minsky } } memoisedRotator; - static void drawResizeHandle(cairo_t* cairo, double x, double y, double sf, double angle); + static void drawResizeHandle(const ICairoShim& cairoShim, double x, double y, double sf, double angle); public: @@ -288,7 +287,7 @@ namespace minsky void moveTo(float x, float y); /// draw this item into a cairo context - virtual void draw(cairo_t* cairo) const; + virtual void draw(const ICairoShim& cairoShim) const; /// resize this item on the canvas virtual void resize(const LassoBox& b); /// factor by which item has been resized @@ -300,7 +299,7 @@ namespace minsky void dummyDraw() const; /// display tooltip text, eg on mouseover - virtual void displayTooltip(cairo_t*, const std::string&) const; + virtual void displayTooltip(const ICairoShim&, const std::string&) const; /// update display after a step() virtual void updateIcon(double t) {} @@ -309,9 +308,9 @@ namespace minsky Item& operator=(const Item&)=default; virtual ~Item() {} - void drawPorts(cairo_t* cairo) const; - static void drawSelected(cairo_t* cairo); - virtual void drawResizeHandles(cairo_t* cairo) const; + void drawPorts(const ICairoShim& cairoShim) const; + static void drawSelected(const ICairoShim& cairoShim); + virtual void drawResizeHandles(const ICairoShim& cairoShim) const; /// returns the clicktype given a mouse click at \a x, \a y. virtual ClickType::Type clickType(float x, float y) const; @@ -362,7 +361,7 @@ namespace minsky struct BottomRightResizerItem: public Item { bool onResizeHandle(float x, float y) const override; - void drawResizeHandles(cairo_t* cairo) const override; + void drawResizeHandles(const ICairoShim& cairoShim) const override; /// returns coordinates of the resizer handle virtual Point resizeHandleCoords() const; }; diff --git a/model/lock.cc b/model/lock.cc index 18001d737..72542db69 100644 --- a/model/lock.cc +++ b/model/lock.cc @@ -27,6 +27,7 @@ #include "lock.rcd" #include "lock.xcd" #include "minsky.h" +#include "cairoShimCairo.h" #include "minsky_epilogue.h" using namespace std; @@ -78,29 +79,31 @@ namespace minsky throw_error("Locks can only be applied to Ravels"); } - void Lock::draw(cairo_t* cairo) const + void Lock::draw(const ICairoShim& cairoShim) const { const float z=zoomFactor()*scaleFactor(); const float w=iWidth()*z, h=iHeight()*z; { - const ecolab::cairo::CairoSave cs(cairo); - cairo_translate(cairo,-0.5*w,-0.5*h); + cairoShim.save(); + cairoShim.translate(-0.5*w,-0.5*h); SVGRenderer* icon=locked()? &lockedIcon: &unlockedIcon; - icon->render(cairo,w,h); + // Render SVG using ICairoShim abstraction + cairoShim.renderSVG(*icon, w, h); + cairoShim.restore(); } if (mouseFocus) { - drawPorts(cairo); - displayTooltip(cairo,tooltip()); - if (onResizeHandles) drawResizeHandles(cairo); + drawPorts(cairoShim); + displayTooltip(cairoShim,tooltip()); + if (onResizeHandles) drawResizeHandles(cairoShim); } // add 8 pt margin to allow for ports - cairo_rectangle(cairo,-0.5*w-8,-0.5*h-8,w+16,h+8); - cairo_clip(cairo); - if (selected) drawSelected(cairo); + cairoShim.rectangle(-0.5*w-8,-0.5*h-8,w+16,h+8); + cairoShim.clip(); + if (selected) drawSelected(cairoShim); } Units Lock::units(bool check) const diff --git a/model/lock.h b/model/lock.h index c09b90bcf..fc415c19c 100644 --- a/model/lock.h +++ b/model/lock.h @@ -41,7 +41,7 @@ namespace minsky static SVGRenderer lockedIcon; static SVGRenderer unlockedIcon; - void draw(cairo_t* cairo) const override; + void draw(const ICairoShim& cairoShim) const override; Units units(bool) const override; /// Ravel this is connected to. nullptr if not connected to a Ravel Ravel* ravelInput() const; diff --git a/model/operation.cc b/model/operation.cc index 73cb9d91e..f6bf3613b 100644 --- a/model/operation.cc +++ b/model/operation.cc @@ -27,6 +27,7 @@ #include #include +#include "../engine/cairoShimCairo.h" #include "minsky_epilogue.h" #include @@ -140,7 +141,85 @@ namespace minsky return std::max(1.0f,std::min(0.5f*iWidth()*z/std::max(l,r),0.5f*iHeight()*z/h)); } - void OperationBase::drawUserFunction(cairo_t* cairo) const +// void OperationBase::drawUserFunction(cairo_t* cairo) const +// { +// // if rotation is in 1st or 3rd quadrant, rotate as +// // normal, otherwise flip the text so it reads L->R +// const double angle=rotation() * M_PI / 180.0; +// const bool textFlipped=flipped(rotation()); +// const float z=zoomFactor(); +// +// auto& c=dynamic_cast(*this); +// +// Pango pango(cairo); +// pango.setFontSize(10.0*scaleFactor()*z); +// pango.setMarkup(latexToPango(c.description())); +// pango.angle=angle + (textFlipped? M_PI: 0); +// const Rotate r(rotation()+ (textFlipped? 180: 0),0,0); +// +// // parameters of icon in userspace (unscaled) coordinates +// float w, h, hoffs; +// w=0.5*pango.width()+2*z; +// h=0.5*pango.height()+4*z; +// hoffs=pango.top()/z; +// +// { +// const cairo::CairoSave cs(cairo); +// cairo_move_to(cairo,r.x(-w+1,-h-hoffs+2*z), r.y(-w+1,-h-hoffs+2*z)); +// pango.show(); +// } +// +// cairo_rotate(cairo, angle); +// +// cairo_set_source_rgb(cairo,0,0,1); +// cairo_move_to(cairo,-w,-h); +// cairo_line_to(cairo,-w,h); +// cairo_line_to(cairo,w,h); +// +// cairo_line_to(cairo,w+2*z,0); +// cairo_line_to(cairo,w,-h); +// cairo_close_path(cairo); +// cairo::Path clipPath(cairo); +// cairo_stroke(cairo); +// +// cairo_rotate(cairo,-angle); // undo rotation +// +// // set the output ports coordinates +// // compute port coordinates relative to the icon's +// // point of reference +// const Rotate rr(rotation(),0,0); +// +// m_ports[0]->moveTo(x()+rr.x(w+2,0), y()+rr.y(w+2,0)); +// switch (numPorts()) +// { +// case 1: break; +// case 2: +// m_ports[1]->moveTo(x()+rr.x(-w,0), y()+rr.y(-w,0)); +// break; +// case 3: default: +// m_ports[1]->moveTo(x()+rr.x(-w,0), y()+rr.y(-w,textFlipped? h-3: -h+3)); +// m_ports[2]->moveTo(x()+rr.x(-w,0), y()+rr.y(-w,textFlipped? -h+3: h-3)); +// break; +// } +// if (type()==OperationType::userFunction) +// { +// cairo_set_source_rgb(cairo,0,0,0); +// DrawBinOp drawBinOp(cairo, zoomFactor()); +// drawBinOp.drawPort([&](){drawBinOp.drawSymbol("x");},-1.1*w,-1.1*h,rotation()); +// drawBinOp.drawPort([&](){drawBinOp.drawSymbol("y");},-1.1*w,1.1*h,rotation()); +// } +// if (mouseFocus) +// { +// drawPorts(cairo); +// displayTooltip(cairo,tooltip()); +// if (onResizeHandles) drawResizeHandles(cairo); +// } +// clipPath.appendToCurrent(cairo); +// cairo_clip(cairo); +// if (selected) drawSelected(cairo); +// } + + void OperationBase::drawUserFunction(const ICairoShim& cairoShim) const { // if rotation is in 1st or 3rd quadrant, rotate as // normal, otherwise flip the text so it reads L->R @@ -150,7 +229,7 @@ namespace minsky auto& c=dynamic_cast(*this); - Pango pango(cairo); + auto& pango = cairoShim.pango(); pango.setFontSize(10.0*scaleFactor()*z); pango.setMarkup(latexToPango(c.description())); pango.angle=angle + (textFlipped? M_PI: 0); @@ -163,25 +242,27 @@ namespace minsky hoffs=pango.top()/z; { - const cairo::CairoSave cs(cairo); - cairo_move_to(cairo,r.x(-w+1,-h-hoffs+2*z), r.y(-w+1,-h-hoffs+2*z)); + cairoShim.save(); + cairoShim.moveTo(r.x(-w+1,-h-hoffs+2*z), r.y(-w+1,-h-hoffs+2*z)); pango.show(); + cairoShim.restore(); } - cairo_rotate(cairo, angle); + cairoShim.rotate(angle); - cairo_set_source_rgb(cairo,0,0,1); - cairo_move_to(cairo,-w,-h); - cairo_line_to(cairo,-w,h); - cairo_line_to(cairo,w,h); - - cairo_line_to(cairo,w+2*z,0); - cairo_line_to(cairo,w,-h); - cairo_close_path(cairo); - cairo::Path clipPath(cairo); - cairo_stroke(cairo); + cairoShim.setSourceRGB(0,0,1); + cairoShim.moveTo(-w,-h); + cairoShim.lineTo(-w,h); + cairoShim.lineTo(w,h); + + cairoShim.lineTo(w+2*z,0); + cairoShim.lineTo(w,-h); + cairoShim.closePath(); + cairoShim.save(); // Save the clip path shape + cairoShim.stroke(); + cairoShim.restore(); - cairo_rotate(cairo,-angle); // undo rotation + cairoShim.rotate(-angle); // undo rotation // set the output ports coordinates // compute port coordinates relative to the icon's @@ -202,20 +283,28 @@ namespace minsky } if (type()==OperationType::userFunction) { - cairo_set_source_rgb(cairo,0,0,0); - DrawBinOp drawBinOp(cairo, zoomFactor()); + cairoShim.setSourceRGB(0,0,0); + DrawBinOpShim drawBinOp(cairoShim, zoomFactor()); drawBinOp.drawPort([&](){drawBinOp.drawSymbol("x");},-1.1*w,-1.1*h,rotation()); drawBinOp.drawPort([&](){drawBinOp.drawSymbol("y");},-1.1*w,1.1*h,rotation()); } if (mouseFocus) { - drawPorts(cairo); - displayTooltip(cairo,tooltip()); - if (onResizeHandles) drawResizeHandles(cairo); + drawPorts(cairoShim); + displayTooltip(cairoShim,tooltip()); + if (onResizeHandles) drawResizeHandles(cairoShim); } - clipPath.appendToCurrent(cairo); - cairo_clip(cairo); - if (selected) drawSelected(cairo); + // Re-create the clip path + cairoShim.rotate(angle); + cairoShim.moveTo(-w,-h); + cairoShim.lineTo(-w,h); + cairoShim.lineTo(w,h); + cairoShim.lineTo(w+2*z,0); + cairoShim.lineTo(w,-h); + cairoShim.closePath(); + cairoShim.clip(); + cairoShim.rotate(-angle); + if (selected) drawSelected(cairoShim); } void OperationBase::setCachedText(cairo_t* cairo, const std::string& text, double size) const @@ -226,8 +315,7 @@ namespace minsky cachedPango->setFontSize(size); } - - void OperationBase::draw(cairo_t* cairo) const + void OperationBase::draw(const ICairoShim& cairoShim) const { // if rotation is in 1st or 3rd quadrant, rotate as // normal, otherwise flip the text so it reads L->R @@ -236,14 +324,15 @@ namespace minsky const float z=zoomFactor(); { - const CairoSave cs(cairo); - cairo_scale(cairo,z,z); - iconDraw(cairo); + cairoShim.save(); + cairoShim.scale(z,z); + iconDraw(cairoShim); + cairoShim.restore(); } - CairoSave cs(cairo); - cairo_rotate(cairo, angle); + cairoShim.save(); + cairoShim.rotate(angle); float l=OperationBase::l*z, r=OperationBase::r*z, h=OperationBase::h*z; @@ -252,19 +341,20 @@ namespace minsky if (r<0.5*iWidth()*z) r=0.5*iWidth()*z; if (h<0.5*iHeight()*z) h=0.5*iHeight()*z; - cairo_move_to(cairo,-r,-h); - cairo_line_to(cairo,-r,h); - cairo_line_to(cairo,r,h); - cairo_line_to(cairo,r+2*z,0); - cairo_line_to(cairo,r,-h); + cairoShim.moveTo(-r,-h); + cairoShim.lineTo(-r,h); + cairoShim.lineTo(r,h); + cairoShim.lineTo(r+2*z,0); + cairoShim.lineTo(r,-h); - cairo_close_path(cairo); - - cairo_set_source_rgb(cairo,0,0,1); - cairo_stroke_preserve(cairo); - - cairo::Path clipPath(cairo); + cairoShim.closePath(); + cairoShim.setSourceRGB(0,0,1); + cairoShim.strokePreserve(); + + auto& shimImpl = dynamic_cast(cairoShim); + cairo::Path clipPath(shimImpl._internalGetCairoContext()); + // compute port coordinates relative to the icon's // point of reference. Move outport 2 pixels right for ticket For ticket 362. double x0=r, y0=0, x1=l, y1=numPorts() > 2? -h+3: 0, @@ -273,13 +363,14 @@ namespace minsky if (textFlipped) swap(y1,y2); { - const CairoSave cs(cairo); - cairo_identity_matrix(cairo); - cairo_translate(cairo, x(), y()); - cairo_rotate(cairo, angle); - cairo_user_to_device(cairo, &x0, &y0); - cairo_user_to_device(cairo, &x1, &y1); - cairo_user_to_device(cairo, &x2, &y2); + cairoShim.save(); + cairoShim.identityMatrix(); + cairoShim.translate(x(), y()); + cairoShim.rotate(angle); + cairoShim.userToDevice(x0, y0); + cairoShim.userToDevice(x1, y1); + cairoShim.userToDevice(x2, y2); + cairoShim.restore(); } if (numPorts()>0) @@ -304,18 +395,18 @@ namespace minsky m_ports[2]->moveTo(x2, y2); } - cs.restore(); // undo rotation + cairoShim.restore(); // undo rotation if (mouseFocus) { - drawPorts(cairo); - displayTooltip(cairo,tooltip()); - if (onResizeHandles) drawResizeHandles(cairo); + drawPorts(cairoShim); + displayTooltip(cairoShim,tooltip()); + if (onResizeHandles) drawResizeHandles(cairoShim); } - cairo_new_path(cairo); - clipPath.appendToCurrent(cairo); - cairo_clip(cairo); - if (selected) drawSelected(cairo); + cairoShim.newPath(); + clipPath.appendToCurrent(shimImpl._internalGetCairoContext()); + cairoShim.clip(); + if (selected) drawSelected(cairoShim); } void OperationBase::resize(const LassoBox& b) @@ -600,152 +691,166 @@ namespace minsky // operations.cc because it is more related to the functionality in // this file. - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { assert(false); //shouldn't be here } - template <> void Operation::iconDraw(cairo_t* cairo) const + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { assert(false); //shouldn't be here } - template <> void Operation::iconDraw(cairo_t* cairo) const - { - const double sf = scaleFactor(); - cairo_translate(cairo,-1,0); - cairo_scale(cairo,1.5*sf,0.75*sf); - cairo_arc(cairo,0,-3,3,0,2*M_PI); - cairo_arc(cairo,0,3,3,0,M_PI); - cairo_move_to(cairo,-3,3); - cairo_line_to(cairo,-3,-3); - cairo_move_to(cairo,3,3); - cairo_line_to(cairo,3,-3); - cairo_identity_matrix(cairo); - cairo_set_line_width(cairo,1.0); - cairo_stroke(cairo); - } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-4,2); - cairo_show_text(cairo,"t"); + const double sf = scaleFactor(); + cairoShim.translate(-1,0); + cairoShim.scale(1.5*sf,0.75*sf); + cairoShim.arc(0,-3,3,0,2*M_PI); + cairoShim.arc(0,3,3,0,M_PI); + cairoShim.moveTo(-3,3); + cairoShim.lineTo(-3,-3); + cairoShim.moveTo(3,3); + cairoShim.lineTo(3,-3); + cairoShim.identityMatrix(); + cairoShim.setLineWidth(1.0); + cairoShim.stroke(); } - - template <> void Operation::iconDraw(cairo_t* cairo) const + + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-4,2); - cairo_show_text(cairo,"e"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-4,2); + cairoShim.showText("t"); } - - template <> void Operation::iconDraw(cairo_t* cairo) const - { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-4,2); - cairo_show_text(cairo,"π"); - } - - template <> void Operation::iconDraw(cairo_t* cairo) const + + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-4,2); - cairo_show_text(cairo,"0"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-4,2); + cairoShim.showText("e"); } - - template <> void Operation::iconDraw(cairo_t* cairo) const + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-4,2); - cairo_show_text(cairo,"1"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-4,2); + cairoShim.showText("π"); } - - template <> void Operation::iconDraw(cairo_t* cairo) const + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-4,-10); - setCachedText(cairo,"∞",9); - cairo_scale(cairo,sf,sf); - cachedPango->show(); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-4,2); + cairoShim.showText("0"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-4,-7); - setCachedText(cairo,"%",7); - cairo_scale(cairo,sf,sf); - cachedPango->show(); - } + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-4,2); + cairoShim.showText("1"); + } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-4,-5); - setCachedText(cairo, "→",7); - cairo_scale(cairo,sf,sf); - cachedPango->show(); + const double sf = scaleFactor(); + auto& pango = cairoShim.pango(); + pango.setMarkup("∞"); + pango.setFontSize(9); + cairoShim.moveTo(-4,-10); + cairoShim.scale(sf,sf); + pango.show(); } - template <> void Operation::iconDraw(cairo_t* cairo) const - {/* moved to IntOp::draw() but needs to be here, and is actually called */} - - template <> void Operation::iconDraw(cairo_t* cairo) const - { - const CairoSave cs(cairo); - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-7,-1); - cairo_set_font_size(cairo,8); - cairo_show_text(cairo,"d"); - cairo_move_to(cairo,-7,0);cairo_line_to(cairo,2,0); - cairo_set_line_width(cairo,0.5);cairo_stroke(cairo); - cairo_move_to(cairo,-7,7); - cairo_show_text(cairo,"dt"); - } - - template <> void Operation::iconDraw(cairo_t* cairo) const - { - const CairoSave cs(cairo); - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-7,6); - cairo_show_text(cairo,"\xE2\x88\x9a"); - cairo_set_line_width(cairo,0.5); - cairo_rel_move_to(cairo,0,-9); - cairo_rel_line_to(cairo,5,0); - cairo_set_source_rgb(cairo,0,0,0); - cairo_stroke(cairo); - } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-7,3); - cairo_show_text(cairo,"e"); - cairo_rel_move_to(cairo,0,-4); - cairo_set_font_size(cairo,7); - cairo_show_text(cairo,"x"); + const double sf = scaleFactor(); + auto& pango = cairoShim.pango(); + pango.setMarkup("%"); + pango.setFontSize(7); + cairoShim.moveTo(-4,-7); + cairoShim.scale(sf,sf); + pango.show(); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-6,3); - cairo_show_text(cairo,"x"); - cairo_rel_move_to(cairo,0,-4); - cairo_set_font_size(cairo,7); - cairo_show_text(cairo,"y"); - DrawBinOp d(cairo); + const double sf = scaleFactor(); + auto& pango = cairoShim.pango(); + pango.setMarkup("→"); + pango.setFontSize(7); + cairoShim.moveTo(-4,-5); + cairoShim.scale(sf,sf); + pango.show(); + } + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const + {/* moved to IntOp::draw() but needs to be here, and is actually called */} + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const + { + cairoShim.save(); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-7,-1); + cairoShim.setFontSize(8); + cairoShim.showText("d"); + cairoShim.moveTo(-7,0); cairoShim.lineTo(2,0); + cairoShim.setLineWidth(0.5); cairoShim.stroke(); + cairoShim.moveTo(-7,7); + cairoShim.showText("dt"); + cairoShim.restore(); + } + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const + { + cairoShim.save(); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-7,6); + cairoShim.showText("\xE2\x88\x9a"); + cairoShim.setLineWidth(0.5); + cairoShim.relMoveTo(0,-9); + cairoShim.relLineTo(5,0); + cairoShim.setSourceRGB(0,0,0); + cairoShim.stroke(); + cairoShim.restore(); + } + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const + { + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-7,3); + cairoShim.showText("e"); + cairoShim.relMoveTo(0,-4); + cairoShim.setFontSize(7); + cairoShim.showText("x"); + } + + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const + { + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-6,3); + cairoShim.showText("x"); + cairoShim.relMoveTo(0,-4); + cairoShim.setFontSize(7); + cairoShim.showText("y"); + DrawBinOpShim d(cairoShim); #ifdef DISPLAY_POW_UPSIDE_DOWN d.drawPort([&](){d.drawSymbol("y");}, l, -h, rotation()); d.drawPort([&](){d.drawSymbol("x");}, l, h, rotation()); @@ -755,634 +860,650 @@ namespace minsky #endif } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"x≤y"); - DrawBinOp d(cairo); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-9,3); + cairoShim.showText("x≤y"); + DrawBinOpShim d(cairoShim); d.drawPort([&](){d.drawSymbol("x");}, l, -h, rotation()); d.drawPort([&](){d.drawSymbol("y");}, l, h, rotation()); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"x void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"x=y"); - DrawBinOp d(cairo); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-9,3); + cairoShim.showText("x=y"); + DrawBinOpShim d(cairoShim); d.drawPort([&](){d.drawSymbol("x");}, l, -h, rotation()); d.drawPort([&](){d.drawSymbol("y");}, l, h, rotation()); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"min"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-9,3); + cairoShim.showText("min"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"max"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-9,3); + cairoShim.showText("max"); } - template <> void Operation::iconDraw(cairo_t* cairo) const - { - const CairoSave cs(cairo); - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_source_rgb(cairo,0,0,0); - cairo_move_to(cairo,-4,3); - cairo_line_to(cairo,-1,-3); - cairo_line_to(cairo,2,3); - cairo_stroke(cairo); + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const + { + cairoShim.save(); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setSourceRGB(0,0,0); + cairoShim.moveTo(-4,3); + cairoShim.lineTo(-1,-3); + cairoShim.lineTo(2,3); + cairoShim.stroke(); + cairoShim.restore(); } - template <> void Operation::iconDraw(cairo_t* cairo) const - { - const CairoSave cs(cairo); - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_source_rgb(cairo,0,0,0); - cairo_move_to(cairo,-4,-3); - cairo_line_to(cairo,-1,3); - cairo_line_to(cairo,2,-3); - cairo_stroke(cairo); + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const + { + cairoShim.save(); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setSourceRGB(0,0,0); + cairoShim.moveTo(-4,-3); + cairoShim.lineTo(-1,3); + cairoShim.lineTo(2,-3); + cairoShim.stroke(); + cairoShim.restore(); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-6,3); - cairo_show_text(cairo,"¬"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-6,3); + cairoShim.showText("¬"); } - - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf*.7,sf); - cairo_move_to(cairo,-16,3); - cairo_show_text(cairo,"<ΔxΔy>"); + const double sf = scaleFactor(); + cairoShim.scale(sf*.7,sf); + cairoShim.moveTo(-16,3); + cairoShim.showText("<ΔxΔy>"); } - - template <> void Operation::iconDraw(cairo_t* cairo) const + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-3,3); - cairo_show_text(cairo,"ρ"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-3,3); + cairoShim.showText("ρ"); } - template <> void Operation::iconDraw(cairo_t* cairo) const - { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-7,7); - cairo_line_to(cairo,7,-7); - cairo_stroke(cairo); - cairo_arc(cairo,-4,0,0.2,0,2*M_PI); - cairo_stroke(cairo); - cairo_arc(cairo,3,3,0.2,0,2*M_PI); - cairo_stroke(cairo); - cairo_arc(cairo,4,-6,0.2,0,2*M_PI); - cairo_stroke(cairo); - } - template <> void Operation::iconDraw(cairo_t* cairo) const - { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-6,6); - cairo_line_to(cairo,6,-6); - cairo_stroke(cairo); - cairo_arc(cairo,-4,0,0.2,0,2*M_PI); - cairo_stroke(cairo); - cairo_arc(cairo,3,3,0.2,0,2*M_PI); - cairo_stroke(cairo); - cairo_arc(cairo,4,-6,0.2,0,2*M_PI); - cairo_stroke(cairo); - cairo_move_to(cairo,-6,-7.5); - cairo_line_to(cairo,-7.5,-7.5); - cairo_line_to(cairo,-7.5,7.5); - cairo_line_to(cairo,-6,7.5); - cairo_stroke(cairo); - cairo_move_to(cairo,6,-7.5); - cairo_line_to(cairo,7.5,-7.5); - cairo_line_to(cairo,7.5,7.5); - cairo_line_to(cairo,6,7.5); - cairo_stroke(cairo); - } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo," ln"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-7,7); + cairoShim.lineTo(7,-7); + cairoShim.stroke(); + cairoShim.arc(-4,0,0.2,0,2*M_PI); + cairoShim.stroke(); + cairoShim.arc(3,3,0.2,0,2*M_PI); + cairoShim.stroke(); + cairoShim.arc(4,-6,0.2,0,2*M_PI); + cairoShim.stroke(); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"log"); - DrawBinOp d(cairo); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-6,6); + cairoShim.lineTo(6,-6); + cairoShim.stroke(); + cairoShim.arc(-4,0,0.2,0,2*M_PI); + cairoShim.stroke(); + cairoShim.arc(3,3,0.2,0,2*M_PI); + cairoShim.stroke(); + cairoShim.arc(4,-6,0.2,0,2*M_PI); + cairoShim.stroke(); + cairoShim.moveTo(-6,-7.5); + cairoShim.lineTo(-7.5,-7.5); + cairoShim.lineTo(-7.5,7.5); + cairoShim.lineTo(-6,7.5); + cairoShim.stroke(); + cairoShim.moveTo(6,-7.5); + cairoShim.lineTo(7.5,-7.5); + cairoShim.lineTo(7.5,7.5); + cairoShim.lineTo(6,7.5); + cairoShim.stroke(); + } + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const + { + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-9,3); + cairoShim.showText(" ln"); + } + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const + { + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-9,3); + cairoShim.showText("log"); + DrawBinOpShim d(cairoShim); d.drawPort([&](){d.drawSymbol("x");}, l, -h, rotation()); d.drawPort([&](){d.drawSymbol("b");}, l, h, rotation()); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"sin"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-9,3); + cairoShim.showText("sin"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"cos"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-9,3); + cairoShim.showText("cos"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"tan"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-9,3); + cairoShim.showText("tan"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,9); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"sin"); - cairo_rel_move_to(cairo,0,-3); - cairo_set_font_size(cairo,7); - cairo_show_text(cairo,"-1"); - cairo_rel_move_to(cairo,0,-2); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(9); + cairoShim.moveTo(-9,3); + cairoShim.showText("sin"); + cairoShim.relMoveTo(0,-3); + cairoShim.setFontSize(7); + cairoShim.showText("-1"); + cairoShim.relMoveTo(0,-2); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,9); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"cos"); - cairo_rel_move_to(cairo,0,-3); - cairo_set_font_size(cairo,7); - cairo_show_text(cairo,"-1"); - cairo_rel_move_to(cairo,0,-2); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(9); + cairoShim.moveTo(-9,3); + cairoShim.showText("cos"); + cairoShim.relMoveTo(0,-3); + cairoShim.setFontSize(7); + cairoShim.showText("-1"); + cairoShim.relMoveTo(0,-2); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,9); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"tan"); - cairo_rel_move_to(cairo,0,-3); - cairo_set_font_size(cairo,7); - cairo_show_text(cairo,"-1"); - cairo_rel_move_to(cairo,0,-2); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(9); + cairoShim.moveTo(-9,3); + cairoShim.showText("tan"); + cairoShim.relMoveTo(0,-3); + cairoShim.setFontSize(7); + cairoShim.showText("-1"); + cairoShim.relMoveTo(0,-2); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,8); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"sinh"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(8); + cairoShim.moveTo(-9,3); + cairoShim.showText("sinh"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,8); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"cosh"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(8); + cairoShim.moveTo(-9,3); + cairoShim.showText("cosh"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,8); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"tanh"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(8); + cairoShim.moveTo(-9,3); + cairoShim.showText("tanh"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,9); - cairo_move_to(cairo,-6,3); - cairo_show_text(cairo,"|x|"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(9); + cairoShim.moveTo(-6,3); + cairoShim.showText("|x|"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-5,-5); - // what we're trying to draw, but Windows' deficient fontsets don't allow it - //setCachedText(cairo, "⌊x⌋",7); - setCachedText(cairo, "x",7); - cairo_scale(cairo,sf,sf); - cachedPango->show(); - cairo_move_to(cairo,-5,-4); - cairo_rel_line_to(cairo,0,cachedPango->height()-2); - cairo_rel_line_to(cairo,1,0); - cairo_move_to(cairo,-5+cachedPango->width(),-4); - cairo_rel_line_to(cairo,0,cachedPango->height()-2); - cairo_rel_line_to(cairo,-1,0); - cairo_stroke(cairo); - } - template <> void Operation::iconDraw(cairo_t* cairo) const + const double sf = scaleFactor(); + auto& pango = cairoShim.pango(); + pango.setMarkup("x"); + pango.setFontSize(7); + cairoShim.moveTo(-5,-5); + cairoShim.scale(sf,sf); + pango.show(); + cairoShim.moveTo(-5,-4); + cairoShim.relLineTo(0,pango.height()-2); + cairoShim.relLineTo(1,0); + cairoShim.moveTo(-5+pango.width(),-4); + cairoShim.relLineTo(0,pango.height()-2); + cairoShim.relLineTo(-1,0); + cairoShim.stroke(); + } + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,8); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"frac"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(8); + cairoShim.moveTo(-9,3); + cairoShim.showText("frac"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-6,3); - cairo_show_text(cairo,"Γ"); - } - template <> void Operation::iconDraw(cairo_t* cairo) const + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-6,3); + cairoShim.showText("Γ"); + } + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-7,3); - cairo_show_text(cairo,"ψ"); - cairo_rel_move_to(cairo,0,-3); - cairo_set_font_size(cairo,7); - // show order of polygamma function. 0 is default. + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-7,3); + cairoShim.showText("ψ"); + cairoShim.relMoveTo(0,-3); + cairoShim.setFontSize(7); const std::string order="("+to_string(static_cast(m_ports[2]->value()))+")"; - cairo_show_text(cairo,order.c_str()); - cairo_rel_move_to(cairo,0,-2); - DrawBinOp d(cairo); + cairoShim.showText(order); + cairoShim.relMoveTo(0,-2); + DrawBinOpShim d(cairoShim); d.drawPort([&](){d.drawSymbol("x");}, l, -h, rotation()); d.drawPort([&](){d.drawSymbol("n");}, l, h, rotation()); - } - template <> void Operation::iconDraw(cairo_t* cairo) const + } + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_move_to(cairo,-3,3); - cairo_show_text(cairo,"!"); - } - template <> void Operation::iconDraw(cairo_t* cairo) const + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.moveTo(-3,3); + cairoShim.showText("!"); + } + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - DrawBinOp d(cairo); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + DrawBinOpShim d(cairoShim); d.drawPlus(); d.drawPort([&](){d.drawPlus();}, l, h, rotation()); d.drawPort([&](){d.drawPlus();}, l, -h, rotation()); } - template <> void Operation::iconDraw(cairo_t* cairo) const + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - DrawBinOp d(cairo); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + DrawBinOpShim d(cairoShim); d.drawMinus(); d.drawPort([&](){d.drawPlus();}, l, -h, rotation()); d.drawPort([&](){d.drawMinus();}, l, h, rotation()); } - template <> void Operation::iconDraw(cairo_t* cairo) const + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - DrawBinOp d(cairo); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + DrawBinOpShim d(cairoShim); d.drawMultiply(); d.drawPort([&](){d.drawMultiply();}, l, h, rotation()); d.drawPort([&](){d.drawMultiply();}, l, -h, rotation()); } - template <> void Operation::iconDraw(cairo_t* cairo) const + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - DrawBinOp d(cairo); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + DrawBinOpShim d(cairoShim); d.drawDivide(); d.drawPort([&](){d.drawMultiply();}, l, -h, rotation()); d.drawPort([&](){d.drawDivide();}, l, h, rotation()); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-4,-7); - setCachedText(cairo, "∑", 7); - cairo_scale(cairo,sf,sf); - cachedPango->show(); + const double sf = scaleFactor(); + auto& pango = cairoShim.pango(); + pango.setMarkup("∑"); + pango.setFontSize(7); + cairoShim.moveTo(-4,-7); + cairoShim.scale(sf,sf); + pango.show(); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-4,-7); - setCachedText(cairo, "∏",7); - cairo_scale(cairo,sf,sf); - cachedPango->show(); + const double sf = scaleFactor(); + auto& pango = cairoShim.pango(); + pango.setMarkup("∏"); + pango.setFontSize(7); + cairoShim.moveTo(-4,-7); + cairoShim.scale(sf,sf); + pango.show(); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"inf"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-9,3); + cairoShim.showText("inf"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"sup"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-9,3); + cairoShim.showText("sup"); } - - template <> void Operation::iconDraw(cairo_t* cairo) const + + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"infi"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-9,3); + cairoShim.showText("infi"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"supi"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-9,3); + cairoShim.showText("supi"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"any"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-9,3); + cairoShim.showText("any"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"all"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-9,3); + cairoShim.showText("all"); } - - - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"nᵢ"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-9,3); + cairoShim.showText("nᵢ"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"{nᵢ}"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-9,3); + cairoShim.showText("{nᵢ}"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-8,3); - cairo_show_text(cairo,""); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-8,3); + cairoShim.showText(""); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-3,3); - cairo_show_text(cairo,"x"); - cairo_move_to(cairo,-4,-1); - cairo_show_text(cairo,"~"); - } + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-3,3); + cairoShim.showText("x"); + cairoShim.moveTo(-4,-1); + cairoShim.showText("~"); + } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-3,3); - cairo_show_text(cairo,"σ"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-3,3); + cairoShim.showText("σ"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf*.85,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-12,3); - cairo_show_text(cairo,"<Δxᵏ>"); + const double sf = scaleFactor(); + cairoShim.scale(sf*.85,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-12,3); + cairoShim.showText("<Δxᵏ>"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_translate(cairo,-0.5*iWidth(),-0.5*iHeight()); - cminsky().histogramResource.render(cairo,iWidth(),iHeight()); + cairoShim.translate(-0.5*iWidth(),-0.5*iHeight()); + cairoShim.renderSVG(cminsky().histogramResource, iWidth(), iHeight()); } - - - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-7,-7); - setCachedText(cairo, "∑+",7); - cairo_scale(cairo,sf,sf); - cachedPango->show(); + const double sf = scaleFactor(); + auto& pango = cairoShim.pango(); + pango.setMarkup("∑+"); + pango.setFontSize(7); + cairoShim.moveTo(-7,-7); + cairoShim.scale(sf,sf); + pango.show(); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-7,-7); - setCachedText(cairo, "av+",7); - cairo_scale(cairo,sf,sf); - cachedPango->show(); + const double sf = scaleFactor(); + auto& pango = cairoShim.pango(); + pango.setMarkup("av+"); + pango.setFontSize(7); + cairoShim.moveTo(-7,-7); + cairoShim.scale(sf,sf); + pango.show(); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-6,-7); - setCachedText(cairo, "∏×",7); - cairo_scale(cairo,sf,sf); - cachedPango->show(); + const double sf = scaleFactor(); + auto& pango = cairoShim.pango(); + pango.setMarkup("∏×"); + pango.setFontSize(7); + cairoShim.moveTo(-6,-7); + cairoShim.scale(sf,sf); + pango.show(); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-4,-7); - setCachedText(cairo, "Δ-",7); - cairo_scale(cairo,sf,sf); - cachedPango->show(); + const double sf = scaleFactor(); + auto& pango = cairoShim.pango(); + pango.setMarkup("Δ-"); + pango.setFontSize(7); + cairoShim.moveTo(-4,-7); + cairoShim.scale(sf,sf); + pango.show(); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-4,-7); - setCachedText(cairo, "Δ+",7); - cairo_scale(cairo,sf,sf); - cachedPango->show(); + const double sf = scaleFactor(); + auto& pango = cairoShim.pango(); + pango.setMarkup("Δ+"); + pango.setFontSize(7); + cairoShim.moveTo(-4,-7); + cairoShim.scale(sf,sf); + pango.show(); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-4,-10); - setCachedText(cairo, "·",14); - cairo_scale(cairo,sf,sf); - cachedPango->show(); + const double sf = scaleFactor(); + auto& pango = cairoShim.pango(); + pango.setMarkup("·"); + pango.setFontSize(14); + cairoShim.moveTo(-4,-10); + cairoShim.scale(sf,sf); + pango.show(); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-4,-10); - // this is the character we want, but draw it explicitly because - //of Windows' deficient fontsets. - // setCachedText(cairo, "⊗",10); - cairo_scale(cairo,sf,sf); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); constexpr const double r=6; static const double d=0.5*r*std::sqrt(2); - cairo_move_to(cairo,d,d); - cairo_line_to(cairo,-d,-d); - cairo_move_to(cairo,-d,d); - cairo_line_to(cairo,d,-d); - cairo_move_to(cairo,r,0); - cairo_arc(cairo,0,0,r,0,2*M_PI); - cairo_stroke(cairo); + cairoShim.moveTo(d,d); + cairoShim.lineTo(-d,-d); + cairoShim.moveTo(-d,d); + cairoShim.lineTo(d,-d); + cairoShim.moveTo(r,0); + cairoShim.arc(0,0,r,0,2*M_PI); + cairoShim.stroke(); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,10); - cairo_move_to(cairo,-9,3); - cairo_show_text(cairo,"idx"); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(10); + cairoShim.moveTo(-9,3); + cairoShim.showText("idx"); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_scale(cairo,sf,sf); - cairo_set_font_size(cairo,8); - cairo_move_to(cairo,-7,3); - cairo_show_text(cairo,"x[i]"); - DrawBinOp drawBinOp(cairo); + const double sf = scaleFactor(); + cairoShim.scale(sf,sf); + cairoShim.setFontSize(8); + cairoShim.moveTo(-7,3); + cairoShim.showText("x[i]"); + DrawBinOpShim drawBinOp(cairoShim); drawBinOp.drawPort([&](){drawBinOp.drawSymbol("x");},l,-h,rotation()); drawBinOp.drawPort([&](){drawBinOp.drawSymbol("i");},l,h,rotation()); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-4,-5); - //setCachedText(cairo, "⭄",10); - cairo_scale(cairo,sf,sf); - cairo_rel_line_to(cairo,4,0); - cairo_rel_line_to(cairo,2,5); - cairo_rel_line_to(cairo,-2,5); - cairo_rel_line_to(cairo,-4,0); - cairo_move_to(cairo,-4,0); - cairo_rel_line_to(cairo,10,0); - cairo_stroke(cairo); + const double sf = scaleFactor(); + cairoShim.moveTo(-4,-5); + cairoShim.scale(sf,sf); + cairoShim.relLineTo(4,0); + cairoShim.relLineTo(2,5); + cairoShim.relLineTo(-2,5); + cairoShim.relLineTo(-4,0); + cairoShim.moveTo(-4,0); + cairoShim.relLineTo(10,0); + cairoShim.stroke(); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-4,-3); - //setCachedText(cairo, "⫤",10); - cairo_scale(cairo,sf,sf); - cairo_rel_line_to(cairo,8,0); - cairo_move_to(cairo,-4,3); - cairo_rel_line_to(cairo,8,0); - cairo_rel_move_to(cairo,0,-10); - cairo_rel_line_to(cairo,0,14); - cairo_stroke(cairo); + const double sf = scaleFactor(); + cairoShim.moveTo(-4,-3); + cairoShim.scale(sf,sf); + cairoShim.relLineTo(8,0); + cairoShim.moveTo(-4,3); + cairoShim.relLineTo(8,0); + cairoShim.relMoveTo(0,-10); + cairoShim.relLineTo(0,14); + cairoShim.stroke(); } - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const { - const double sf = scaleFactor(); - cairo_move_to(cairo,-10,-10); - setCachedText(cairo, "[...",10); - cairo_scale(cairo,sf,sf); - cachedPango->show(); - cairo_move_to(cairo,-10+cachedPango->width(),-9); - cairo_rel_line_to(cairo,0,cachedPango->height()-2); - cairo_stroke(cairo); + const double sf = scaleFactor(); + auto& pango = cairoShim.pango(); + pango.setMarkup("[..."); + pango.setFontSize(10); + cairoShim.moveTo(-10,-10); + cairoShim.scale(sf,sf); + pango.show(); + cairoShim.moveTo(-10+pango.width(),-9); + cairoShim.relLineTo(0,pango.height()-2); + cairoShim.stroke(); } - - - template <> void Operation::iconDraw(cairo_t* cairo) const + template <> void Operation::iconDraw(const ICairoShim& cairoShim) const {/* needs to be here, and is actually called */} + } diff --git a/model/operation.h b/model/operation.h index 8f27ef377..3f4677dc9 100644 --- a/model/operation.h +++ b/model/operation.h @@ -46,7 +46,7 @@ namespace minsky public: typedef OperationType::Type Type; Type type() const override {return T;} - void iconDraw(cairo_t *) const override; + void iconDraw(const ICairoShim&) const override; std::size_t numPorts() const override {return OperationTypeInfo::numArguments()+1;} Operation() { @@ -108,54 +108,54 @@ namespace minsky }; - /// helper class to draw port label symbols - struct DrawBinOp + /// helper class to draw port label symbols using ICairoShim + struct DrawBinOpShim { - cairo_t *cairo; + const ICairoShim& cairoShim; double zoomFactor; - DrawBinOp(cairo_t *cairo, double z=1): cairo(cairo), zoomFactor(z) {} + DrawBinOpShim(const ICairoShim& cairoShim, double z=1): cairoShim(cairoShim), zoomFactor(z) {} void drawPlus() const { - cairo_move_to(cairo,0,-5); - cairo_line_to(cairo,0,5); - cairo_move_to(cairo,-5,0); - cairo_line_to(cairo,5,0); - cairo_stroke(cairo); + cairoShim.moveTo(0,-5); + cairoShim.lineTo(0,5); + cairoShim.moveTo(-5,0); + cairoShim.lineTo(5,0); + cairoShim.stroke(); } void drawMinus() const { - cairo_move_to(cairo,-5,0); - cairo_line_to(cairo,5,0); - cairo_stroke(cairo); + cairoShim.moveTo(-5,0); + cairoShim.lineTo(5,0); + cairoShim.stroke(); } void drawMultiply() const { - cairo_move_to(cairo,-5,-5); - cairo_line_to(cairo,5,5); - cairo_move_to(cairo,-5,5); - cairo_line_to(cairo,5,-5); - cairo_stroke(cairo); + cairoShim.moveTo(-5,-5); + cairoShim.lineTo(5,5); + cairoShim.moveTo(-5,5); + cairoShim.lineTo(5,-5); + cairoShim.stroke(); } void drawDivide() const { - cairo_move_to(cairo,-5,0); - cairo_line_to(cairo,5,0); - cairo_new_sub_path(cairo); - cairo_arc(cairo,0,3,1,0,2*M_PI); - cairo_new_sub_path(cairo); - cairo_arc(cairo,0,-3,1,0,2*M_PI); - cairo_stroke(cairo); + cairoShim.moveTo(-5,0); + cairoShim.lineTo(5,0); + cairoShim.newSubPath(); + cairoShim.arc(0,3,1,0,2*M_PI); + cairoShim.newSubPath(); + cairoShim.arc(0,-3,1,0,2*M_PI); + cairoShim.stroke(); } void drawSymbol(const char* s) const { - cairo_scale(cairo,zoomFactor,zoomFactor); - cairo_move_to(cairo,-5,0); - cairo_show_text(cairo,s); + cairoShim.scale(zoomFactor,zoomFactor); + cairoShim.moveTo(-5,0); + cairoShim.showText(s); } // puts a small symbol to identify port @@ -163,19 +163,21 @@ namespace minsky template void drawPort(F f, float x, float y, float rotation) const { - const ecolab::cairo::CairoSave cs(cairo); + cairoShim.save(); const double angle=rotation * M_PI / 180.0; if (minsky::flipped(rotation)) y=-y; - cairo_rotate(cairo, angle); + cairoShim.rotate(angle); - cairo_translate(cairo,0.7*x,0.6*y); - cairo_scale(cairo,0.5,0.5); + cairoShim.translate(0.7*x,0.6*y); + cairoShim.scale(0.5,0.5); // and counter-rotate - cairo_rotate(cairo, -angle); + cairoShim.rotate(-angle); f(); + + cairoShim.restore(); } }; } diff --git a/model/operationBase.h b/model/operationBase.h index ef92909d6..a380693d7 100644 --- a/model/operationBase.h +++ b/model/operationBase.h @@ -62,7 +62,7 @@ namespace minsky OperationBase* operationCast() override {return this;} /// visual representation of operation on the canvas - virtual void iconDraw(cairo_t *) const=0; + virtual void iconDraw(const ICairoShim&) const=0; /// returns a list of values the ports currently have std::string portValues() const; @@ -73,9 +73,9 @@ namespace minsky // manage the port structures associated with this operation virtual void addPorts(); - void drawUserFunction(cairo_t* cairo) const; + void drawUserFunction(const ICairoShim& cairoShim) const; - void draw(cairo_t*) const override; + void draw(const ICairoShim&) const override; void resize(const LassoBox& b) override; float scaleFactor() const override; diff --git a/model/phillipsDiagram.cc b/model/phillipsDiagram.cc index 15496bc17..565ca0ab2 100644 --- a/model/phillipsDiagram.cc +++ b/model/phillipsDiagram.cc @@ -22,6 +22,7 @@ #include "phillipsDiagram.rcd" #include "phillipsDiagram.xcd" #include "minsky.h" +#include "../engine/cairoShimCairo.h" #include "minsky_epilogue.h" using ecolab::cairo::CairoSave; @@ -30,9 +31,28 @@ namespace minsky std::map PhillipsFlow::maxFlow; std::map PhillipsStock::maxStock; - void PhillipsFlow::draw(cairo_t* cairo) +// void PhillipsFlow::draw(cairo_t* cairo) const +// { +// const CairoSave cs(cairo); +// const double value=this->value(); +// double& maxV=maxFlow[units()]; +// if (abs(value)>maxV) maxV=abs(value); +// double lineWidth=1; +// if (maxV>0) +// { +// const double lw=5*abs(value)/maxV; +// lineWidth=std::max(1.0, lw); +// static const double dashLength=3; +// if (lw<1) +// cairo_set_dash(cairo,&dashLength,1,0); +// } +// cairo_set_line_width(cairo, lineWidth); +// Wire::draw(cairo,value>=0); +// } + + void PhillipsFlow::draw(const ICairoShim& cairoShim, bool) const { - const CairoSave cs(cairo); + cairoShim.save(); const double value=this->value(); double& maxV=maxFlow[units()]; if (abs(value)>maxV) maxV=abs(value); @@ -43,35 +63,39 @@ namespace minsky lineWidth=std::max(1.0, lw); static const double dashLength=3; if (lw<1) - cairo_set_dash(cairo,&dashLength,1,0); + cairoShim.setDash(&dashLength,1,0); } - cairo_set_line_width(cairo, lineWidth); - Wire::draw(cairo,value>=0); + cairoShim.setLineWidth(lineWidth); + Wire::draw(cairoShim, value>=0); + cairoShim.restore(); } - void PhillipsStock::draw(cairo_t* cairo) const + void PhillipsStock::draw(const ICairoShim& cairoShim) const { - StockVar::draw(cairo); + // Call parent draw (VariableBase still uses _internalGetCairoContext internally) + StockVar::draw(cairoShim); + // colocate input and output ports on the input side m_ports[0]->moveTo(m_ports[1]->x(), m_ports[1]->y()); auto maxV=maxStock[units()]; if (maxV>0) { - const CairoSave cs(cairo); + cairoShim.save(); auto w=width()*zoomFactor(); auto h=height()*zoomFactor(); auto f=value()/maxV; if (f>=0) { - cairo_set_source_rgba(cairo,0,0,1,0.3); - cairo_rectangle(cairo,-0.6*w,0.5*h,1.2*w,-f*h); + cairoShim.setSourceRGBA(0,0,1,0.3); + cairoShim.rectangle(-0.6*w,0.5*h,1.2*w,-f*h); } else { - cairo_set_source_rgba(cairo,1,0,0,0.3); - cairo_rectangle(cairo,-0.6*w,-0.5*h,1.2*w,-f*h); + cairoShim.setSourceRGBA(1,0,0,0.3); + cairoShim.rectangle(-0.6*w,-0.5*h,1.2*w,-f*h); } - cairo_fill(cairo); + cairoShim.fill(); + cairoShim.restore(); } } @@ -87,10 +111,14 @@ namespace minsky const CairoSave cs(cairo); cairo_identity_matrix(cairo); cairo_translate(cairo,i.second.x()+x, i.second.y()+y); - i.second.draw(cairo); + CairoShimCairo shim(cairo); + i.second.draw(shim); } for (auto& i: flows) - i.second.draw(cairo); + { + CairoShimCairo shim(cairo); + i.second.draw(shim,true); + } return true; } diff --git a/model/phillipsDiagram.h b/model/phillipsDiagram.h index 2aa1a0b9e..4c3ceba8d 100644 --- a/model/phillipsDiagram.h +++ b/model/phillipsDiagram.h @@ -53,7 +53,8 @@ namespace minsky r+=i.first*i.second.value(); return r; } - void draw(cairo_t*); + //void draw(cairo_t*); + void draw(const ICairoShim&, bool) const override; }; @@ -69,7 +70,7 @@ namespace minsky } static std::map maxStock; std::size_t numPorts() const override {return 2;} - void draw(cairo_t* cairo) const override; + void draw(const ICairoShim& cairoShim) const override; }; class PhillipsDiagram: public RenderNativeWindow diff --git a/model/plotWidget.cc b/model/plotWidget.cc index 0fe74c815..d52b3a814 100644 --- a/model/plotWidget.cc +++ b/model/plotWidget.cc @@ -26,6 +26,7 @@ #include #include #include +#include "../engine/cairoShimCairo.h" #include "CSVTools.xcd" #include "itemT.rcd" @@ -197,20 +198,29 @@ namespace minsky cairo_rectangle(cairo,x-0.5*width,y-0.5*height,width,height); } cs.restore(); + + CairoShimCairo cairoShim(cairo); if (mouseFocus) { - drawPorts(cairo); - displayTooltip(cairo,tooltip()); + drawPorts(cairoShim); + displayTooltip(cairoShim,tooltip()); // Resize handles always visible on mousefocus. For ticket 92. - drawResizeHandles(cairo); + drawResizeHandles(cairoShim); } justDataChanged=false; cairo_new_path(cairo); cairo_rectangle(cairo,-0.5*w,-0.5*h,w,h); cairo_clip(cairo); - if (selected) drawSelected(cairo); + if (selected) drawSelected(cairoShim); + + } + void PlotWidget::draw(const ICairoShim& cairoShim) const + { + // TODO: Implement properly without cairo_t* delegation + auto& shimImpl = dynamic_cast(cairoShim); + draw(shimImpl._internalGetCairoContext()); } void PlotWidget::scalePlot() diff --git a/model/plotWidget.h b/model/plotWidget.h index 3d2d50c29..235380daf 100644 --- a/model/plotWidget.h +++ b/model/plotWidget.h @@ -78,6 +78,7 @@ namespace minsky bool clearPensOnLabelling=false; + void draw(cairo_t* cairoShim) const; public: using Item::x; using Item::y; @@ -166,7 +167,7 @@ namespace minsky void connectVar(const std::shared_ptr& var, unsigned port); void disconnectAllVars(); using ecolab::Plot::draw; - void draw(cairo_t* cairo) const override; + void draw(const ICairoShim& cairoShim) const override; void requestRedraw(); ///< redraw plot using current data to all open windows void redrawWithBounds() override {redraw(0,0,500,500);} diff --git a/model/pubTab.cc b/model/pubTab.cc index 013050a45..280350282 100644 --- a/model/pubTab.cc +++ b/model/pubTab.cc @@ -21,6 +21,7 @@ #include "minsky.h" #include "cairoItems.h" #include "pubTab.h" +#include "../engine/cairoShimCairo.h" #include "publication.rcd" #include "pubTab.xcd" #include "pubTab.rcd" @@ -159,7 +160,8 @@ namespace minsky try { const EnsureEditorMode ensureEditorMode(i); - i.itemRef->draw(cairo); + CairoShimCairo shim(cairo); + i.itemRef->draw(shim); } catch (...) {} } diff --git a/model/ravelWrap.cc b/model/ravelWrap.cc index aba2303d8..73ec2da37 100644 --- a/model/ravelWrap.cc +++ b/model/ravelWrap.cc @@ -24,6 +24,7 @@ #include "dimension.h" #include "minskyTensorOps.h" #include "pango.h" +#include "../engine/cairoShimCairo.h" #include "capiRenderer.xcd" #include "CSVTools.xcd" @@ -82,63 +83,68 @@ namespace minsky wrappedRavel.setOutputHandleIds({0,2}); } - void Ravel::draw(cairo_t* cairo) const + void Ravel::draw(const ICairoShim& cairoShim) const { const double z=zoomFactor(), r=m_editorMode? 1.1*z*wrappedRavel.radius(): 30*z; if (flipped) { m_ports[0]->moveTo(x()-1.1*r, y()); m_ports[1]->moveTo(x()+1.1*r, y()); - drawTriangle(cairo,m_ports[1]->x()-x(),m_ports[1]->y()-y(),{0,0,0,1},M_PI); + drawTriangle(cairoShim,m_ports[1]->x()-x(),m_ports[1]->y()-y(),{0,0,0,1},M_PI); } else { m_ports[0]->moveTo(x()+1.1*r, y()); m_ports[1]->moveTo(x()-1.1*r, y()); - drawTriangle(cairo,m_ports[1]->x()-x(),m_ports[1]->y()-y(),{0,0,0,1},0); + drawTriangle(cairoShim,m_ports[1]->x()-x(),m_ports[1]->y()-y(),{0,0,0,1},0); } if (mouseFocus) { - drawPorts(cairo); - displayTooltip(cairo,tooltip().empty()? explanation: tooltip()); + drawPorts(cairoShim); + displayTooltip(cairoShim,tooltip().empty()? explanation: tooltip()); // Resize handles always visible on mousefocus. For ticket 92. - if (m_editorMode) drawResizeHandles(cairo); + if (m_editorMode) drawResizeHandles(cairoShim); } - cairo_rectangle(cairo,-r,-r,2*r,2*r); - cairo_rectangle(cairo,-1.1*r,-1.1*r,2.2*r,2.2*r); - cairo_stroke_preserve(cairo); + cairoShim.rectangle(-r,-r,2*r,2*r); + cairoShim.rectangle(-1.1*r,-1.1*r,2.2*r,2.2*r); + cairoShim.strokePreserve(); if (onBorder || lockGroup) { // shadow the border when mouse is over it - const cairo::CairoSave cs(cairo); + cairoShim.save(); cairo::Colour c{1,1,1,0}; if (lockGroup) c=palette[ lockGroup->colour() % paletteSz ]; c.r*=0.5; c.g*=0.5; c.b*=0.5; c.a=onBorder? 0.5:0.3; - cairo_set_source_rgba(cairo,c.r,c.g,c.b,c.a); - cairo_set_fill_rule(cairo,CAIRO_FILL_RULE_EVEN_ODD); - cairo_fill_preserve(cairo); + cairoShim.setSourceRGBA(c.r,c.g,c.b,c.a); + cairoShim.setFillRule(CAIRO_FILL_RULE_EVEN_ODD); + cairoShim.fillPreserve(); + cairoShim.restore(); } - cairo_clip(cairo); + cairoShim.clip(); { - const cairo::CairoSave cs(cairo); - cairo_rectangle(cairo,-r,-r,2*r,2*r); - cairo_clip(cairo); + cairoShim.save(); + cairoShim.rectangle(-r,-r,2*r,2*r); + cairoShim.clip(); if (m_editorMode) { - cairo_scale(cairo,z,z); - CairoRenderer cr(cairo); + cairoShim.scale(z,z); + // TODO: CairoRenderer needs ICairoShim support + auto& shimImpl = dynamic_cast(cairoShim); + CairoRenderer cr(shimImpl._internalGetCairoContext()); wrappedRavel.render(cr); } else { - cairo_translate(cairo,-r,-r); - svgRenderer.render(cairo,2*r,2*r); + cairoShim.translate(-r,-r); + // Render SVG using ICairoShim abstraction + cairoShim.renderSVG(svgRenderer, 2*r, 2*r); } + cairoShim.restore(); } - if (selected) drawSelected(cairo); + if (selected) drawSelected(cairoShim); } void Ravel::resize(const LassoBox& b) diff --git a/model/ravelWrap.h b/model/ravelWrap.h index 7f23e55a9..b600df160 100644 --- a/model/ravelWrap.h +++ b/model/ravelWrap.h @@ -109,7 +109,7 @@ namespace minsky void leaveLockGroup(); void broadcastStateToLockGroup() const; - void draw(cairo_t* cairo) const override; + void draw(const ICairoShim& cairoShim) const override; void resize(const LassoBox&) override; bool inItem(float x, float y) const override; void onMouseDown(float x, float y) override; diff --git a/model/sheet.cc b/model/sheet.cc index dbf61f743..870c3fd10 100644 --- a/model/sheet.cc +++ b/model/sheet.cc @@ -24,6 +24,7 @@ #include "plotWidget.h" #include #include +#include "../engine/cairoShimCairo.h" #include "itemT.rcd" #include "sheet.rcd" @@ -73,7 +74,7 @@ bool Sheet::onResizeHandle(float xx, float yy) const } -void Sheet::drawResizeHandles(cairo_t* cairo) const +void Sheet::drawResizeHandles(const ICairoShim& cairo) const { auto sf=resizeHandleSize(); const float w=0.5f*m_width*zoomFactor(), h=0.5f*m_height*zoomFactor(); @@ -82,7 +83,7 @@ void Sheet::drawResizeHandles(cairo_t* cairo) const drawResizeHandle(cairo,w,-h,sf,0.5*M_PI); drawResizeHandle(cairo,w,h,sf,0); drawResizeHandle(cairo,-w,h,sf,0.5*M_PI); - cairo_stroke(cairo); + cairo.stroke(); } @@ -293,14 +294,15 @@ namespace { void Sheet::draw(cairo_t* cairo) const { + CairoShimCairo cairoShim(cairo); auto z=zoomFactor(); m_ports[0]->moveTo(x()-0.5*m_width*z,y()); if (mouseFocus) { - drawPorts(cairo); - displayTooltip(cairo,tooltip()); + drawPorts(cairoShim); + displayTooltip(cairoShim,tooltip()); // Resize handles always visible on mousefocus. For ticket 92. - drawResizeHandles(cairo); + drawResizeHandles(cairoShim); } cairo_scale(cairo,z,z); @@ -321,7 +323,7 @@ void Sheet::draw(cairo_t* cairo) const cairo_rectangle(cairo,-0.5*m_width+border,-0.5*m_height+border,m_width-2*border,m_height-2*border); cairo_clip(cairo); - if (selected) drawSelected(cairo); + if (selected) drawSelected(cairoShim); static const regex pangoMarkup("<[^<>]*>"); smatch match; @@ -520,6 +522,13 @@ void Sheet::draw(cairo_t* cairo) const cairo_clip(cairo); } +void Sheet::draw(const ICairoShim& cairoShim) const +{ + // TODO: Implement properly without cairo_t* delegation + auto& shimImpl = dynamic_cast(cairoShim); + draw(shimImpl._internalGetCairoContext()); +} + void Sheet::exportAsCSV(const string& filename, bool tabular) const { if (!value) diff --git a/model/sheet.h b/model/sheet.h index b1955789b..ffb786a5a 100644 --- a/model/sheet.h +++ b/model/sheet.h @@ -46,6 +46,7 @@ namespace minsky size_t scrollOffset=0, scrollMax=1; size_t scrollDelta=0; std::string sliceIndicator; + void draw(cairo_t* cairoShim) const; public: Sheet(); @@ -55,7 +56,6 @@ namespace minsky Sheet(const Sheet&) {} bool onResizeHandle(float x, float y) const override; - void drawResizeHandles(cairo_t* cairo) const override; bool onRavelButton(float, float) const; bool inRavel(float, float) const; @@ -70,7 +70,8 @@ namespace minsky /// @return sliceIndicator const std::string& setSliceIndicator(); - void draw(cairo_t* cairo) const override; + void draw(const ICairoShim& cairoShim) const override; + void drawResizeHandles(const ICairoShim& cairo) const override; /// calculates the input value void computeValue(); diff --git a/model/switchIcon.cc b/model/switchIcon.cc index b03f90b0b..e67f6ebfc 100644 --- a/model/switchIcon.cc +++ b/model/switchIcon.cc @@ -21,6 +21,7 @@ #include "itemT.rcd" #include "switchIcon.h" #include "switchIcon.rcd" +#include "../engine/cairoShimCairo.h" #include "minsky_epilogue.h" using namespace ecolab::cairo; using namespace ecolab; @@ -72,34 +73,32 @@ namespace minsky return r; } - void SwitchIcon::draw(cairo_t* cairo) const + void SwitchIcon::draw(const ICairoShim& cairoShim) const { auto z=zoomFactor(); - // following the draw method in the Sheet class, iWidth() and iHeight() have been changed to m_width and m_height, - // since the former largely play a role in the VariableBase and OperationBase classes. for ticket 1250 const float width=m_width*z, height=m_height*z; - cairo_set_line_width(cairo,1); - cairo_rectangle(cairo,-0.5*width,-0.5*height,width,height); - cairo_stroke(cairo); + cairoShim.setLineWidth(1); + cairoShim.rectangle(-0.5*width,-0.5*height,width,height); + cairoShim.stroke(); const float w=flipped? -width: width; const float o=flipped? -8: 8; // output port - drawTriangle(cairo, 0.5*w, 0, palette[0], flipped? M_PI: 0); + drawTriangle(cairoShim, 0.5*w, 0, palette[0], flipped? M_PI: 0); m_ports[0]->moveTo(x()+0.5*w, y()); // control port - drawTriangle(cairo, 0, -0.5*height-8, palette[0], M_PI/2); + drawTriangle(cairoShim, 0, -0.5*height-8, palette[0], M_PI/2); m_ports[1]->moveTo(x(), y()-0.5*height-8); const float dy=height/numCases(); float y1=-0.5*height+0.5*dy; // case ports for (size_t i=2; imoveTo(x()+-0.5*w-o, y()+y1); } // draw indicating arrow - cairo_move_to(cairo,0.5*w, 0); + cairoShim.moveTo(0.5*w, 0); try { y1=-0.5*width+0.5*dy+switchValue()*dy; @@ -108,20 +107,20 @@ namespace minsky { y1=-0.5*width+0.5*dy; } - cairo_line_to(cairo,-0.45*w,0.9*y1); - cairo_stroke(cairo); + cairoShim.lineTo(-0.45*w,0.9*y1); + cairoShim.stroke(); if (mouseFocus) { - drawPorts(cairo); - displayTooltip(cairo,tooltip()); - if (onResizeHandles) drawResizeHandles(cairo); + drawPorts(cairoShim); + displayTooltip(cairoShim,tooltip()); + if (onResizeHandles) drawResizeHandles(cairoShim); } // add 8 pt margin to allow for ports - cairo_rectangle(cairo,-0.5*width-8,-0.5*height-8,width+16,height+8); - cairo_clip(cairo); - if (selected) drawSelected(cairo); + cairoShim.rectangle(-0.5*width-8,-0.5*height-8,width+16,height+8); + cairoShim.clip(); + if (selected) drawSelected(cairoShim); } } diff --git a/model/switchIcon.h b/model/switchIcon.h index a18f26d8a..face72cca 100644 --- a/model/switchIcon.h +++ b/model/switchIcon.h @@ -64,7 +64,7 @@ namespace minsky Units units(bool) const override; /// draw icon to \a context - void draw(cairo_t* context) const override; + void draw(const ICairoShim& cairoShim) const override; /// whether icon is oriented so input ports are on the rhs, and output on the lhs bool flipped=false; diff --git a/model/userFunction.cc b/model/userFunction.cc index 98af5f175..bd24621c2 100644 --- a/model/userFunction.cc +++ b/model/userFunction.cc @@ -68,7 +68,7 @@ namespace minsky { int UserFunction::nextId=0; - template <> void Operation::iconDraw(cairo_t*) const + template <> void Operation::iconDraw(const ICairoShim&) const {assert(false);} #ifdef NO_EXPRTK diff --git a/model/userFunction.h b/model/userFunction.h index c4cf841dc..85806f577 100644 --- a/model/userFunction.h +++ b/model/userFunction.h @@ -45,7 +45,7 @@ namespace minsky double operator()(const std::vector& p) override; Units units(bool check=false) const override; - void displayTooltip(cairo_t* cr, const std::string& tt) const override + void displayTooltip(const ICairoShim& cr, const std::string& tt) const override {Item::displayTooltip(cr,tt.empty()? expression: tt+" "+expression);} using NamedOp::description; @@ -57,7 +57,7 @@ namespace minsky static UserFunction* create(OperationType::Type t) {return (t==OperationType::userFunction)? new UserFunction: nullptr;} - void draw(cairo_t* cairo) const override {drawUserFunction(cairo);} + void draw(const ICairoShim& cairoShim) const override {drawUserFunction(cairoShim);} }; diff --git a/model/variable.cc b/model/variable.cc index 09511ca97..c648bcb3d 100644 --- a/model/variable.cc +++ b/model/variable.cc @@ -38,6 +38,7 @@ #include "variable.rcd" #include +#include "../engine/cairoShimCairo.h" #include "minsky_epilogue.h" #include @@ -705,9 +706,11 @@ bool VariableBase::enableSlider(bool x) const return false; } - -void VariableBase::draw(cairo_t *cairo) const +void VariableBase::draw(const ICairoShim& cairoShim) const { + // TODO: Refactor RenderVariable to use ICairoShim + auto& shimImpl = dynamic_cast(cairoShim); + cairo_t* cairo = shimImpl._internalGetCairoContext(); auto [angle,flipped]=rotationAsRadians(); const float z=zoomFactor(); @@ -733,14 +736,15 @@ void VariableBase::draw(cairo_t *cairo) const unique_ptr clipPath; { - const CairoSave cs(cairo); - cairo_scale(cairo, z,z); - cairo_move_to(cairo,r.x(-w+1,-h-hoffs+2), r.y(-w+1,-h-hoffs+2)); + cairoShim.save(); + cairoShim.scale(z,z); + cairoShim.moveTo(r.x(-w+1,-h-hoffs+2), r.y(-w+1,-h-hoffs+2)); { - const CairoSave cs(cairo); + cairoShim.save(); if (local()) - cairo_set_source_rgb(cairo,0,0,1); + cairoShim.setSourceRGB(0,0,1); l_cachedNameRender->show(); + cairoShim.restore(); } auto vv=vValue(); @@ -753,9 +757,10 @@ void VariableBase::draw(cairo_t *cairo) const miniPlot->addPt(0,cachedTime,vv->value()); miniPlot->setMinMax(); } - const CairoSave cs(cairo); - cairo_translate(cairo,-w,-h); + cairoShim.save(); + cairoShim.translate(-w,-h); miniPlot->draw(cairo,2*w,2*h); + cairoShim.restore(); } catch (...) {} // ignore errors in obtaining values @@ -801,13 +806,13 @@ void VariableBase::draw(cairo_t *cairo) const } l_cachedMantissa->angle=angle+(flipped? M_PI:0); - cairo_move_to(cairo,r.x(w-l_cachedMantissa->width()-2,-h-hoffs+2), + cairoShim.moveTo(r.x(w-l_cachedMantissa->width()-2,-h-hoffs+2), r.y(w-l_cachedMantissa->width()-2,-h-hoffs+2)); l_cachedMantissa->show(); if (val.engExp!=0 && !isnan(value())) // Avoid large exponential number in variable value display. For ticket 1155 { - cairo_move_to(cairo,r.x(w-l_cachedExponent->width()-2,0),r.y(w-l_cachedExponent->width()-2,0)); + cairoShim.moveTo(r.x(w-l_cachedExponent->width()-2,0),r.y(w-l_cachedExponent->width()-2,0)); l_cachedExponent->show(); } } @@ -815,40 +820,42 @@ void VariableBase::draw(cairo_t *cairo) const catch (...) {} // ignore errors in obtaining values { - const cairo::CairoSave cs(cairo); - cairo_rotate(cairo, angle); + cairoShim.save(); + cairoShim.rotate(angle); // constants and parameters should be rendered in blue, all others in red switch (type()) { case constant: case parameter: - cairo_set_source_rgb(cairo,0,0,1); + cairoShim.setSourceRGB(0,0,1); break; default: - cairo_set_source_rgb(cairo,1,0,0); + cairoShim.setSourceRGB(1,0,0); break; } - cairo_move_to(cairo,-w,-h); + cairoShim.moveTo(-w,-h); if (lhs()) - cairo_line_to(cairo,-w+2,0); - cairo_line_to(cairo,-w,h); - cairo_line_to(cairo,w,h); - cairo_line_to(cairo,w+2,0); - cairo_line_to(cairo,w,-h); - cairo_close_path(cairo); + cairoShim.lineTo(-w+2,0); + cairoShim.lineTo(-w,h); + cairoShim.lineTo(w,h); + cairoShim.lineTo(w+2,0); + cairoShim.lineTo(w,-h); + cairoShim.closePath(); clipPath.reset(new cairo::Path(cairo)); - cairo_stroke(cairo); + cairoShim.stroke(); if (sliderVisible()) { // draw slider - const CairoSave cs(cairo); - cairo_set_source_rgb(cairo,0,0,0); + cairoShim.save(); + cairoShim.setSourceRGB(0,0,0); try { - cairo_arc(cairo,(flipped?-1.0:1.0)*l_cachedNameRender->handlePos(), (flipped? h: -h), sliderHandleRadius, 0, 2*M_PI); + cairoShim.arc((flipped?-1.0:1.0)*l_cachedNameRender->handlePos(), (flipped? h: -h), sliderHandleRadius, 0, 2*M_PI); } catch (const error&) {} // handlePos() may throw. - cairo_fill(cairo); + cairoShim.fill(); + cairoShim.restore(); } + cairoShim.restore(); }// undo rotation const double x0=z*w, y0=0, x1=-z*w+2, y1=0; @@ -859,22 +866,24 @@ void VariableBase::draw(cairo_t *cairo) const if (m_ports.size()>1) m_ports[1]->moveTo(x()+(x1*ca-y1*sa), y()+(y1*ca+x1*sa)); + cairoShim.restore(); } auto g=group.lock(); if (mouseFocus || (ioVar() && g && g->mouseFocus)) { - const cairo::CairoSave cs(cairo); - drawPorts(cairo); - displayTooltip(cairo,tooltip()); - if (onResizeHandles) drawResizeHandles(cairo); + cairoShim.save(); + drawPorts(cairoShim); + displayTooltip(cairoShim,tooltip()); + if (onResizeHandles) drawResizeHandles(cairoShim); + cairoShim.restore(); } - cairo_new_path(cairo); + cairoShim.newPath(); clipPath->appendToCurrent(cairo); // Rescale size of variable attached to intop. For ticket 94 - cairo_clip(cairo); - if (selected) drawSelected(cairo); + cairoShim.clip(); + if (selected) drawSelected(cairoShim); } void VariableBase::resize(const LassoBox& b) diff --git a/model/variable.h b/model/variable.h index 4da63e80f..6eba76d59 100644 --- a/model/variable.h +++ b/model/variable.h @@ -198,7 +198,7 @@ namespace minsky /** draws the icon onto the given cairo context @return cairo path of icon outline */ - void draw(cairo_t*) const override; + void draw(const ICairoShim&) const override; void resize(const LassoBox& b) override; ClickType::Type clickType(float x, float y) const override; diff --git a/model/wire.cc b/model/wire.cc index 49653c912..c54f7c0fe 100644 --- a/model/wire.cc +++ b/model/wire.cc @@ -28,6 +28,7 @@ #include "pango.h" #include "plotWidget.h" #include "SVGItem.h" +#include "../engine/cairoShimCairo.h" #include "wire.rcd" #include "minsky_epilogue.h" #include @@ -506,6 +507,14 @@ namespace } } + void Wire::draw(const ICairoShim& cairoShim, bool reverseArrow) const + { + // Wire drawing is complex and uses storeCairoCoords which requires cairo_t* + // TODO: This will be properly refactored in a separate PR (per owner comment) + auto& shimImpl = dynamic_cast(cairoShim); + draw(shimImpl._internalGetCairoContext(), reverseArrow); + } + void Wire::split() { // add I/O variables if this wire crosses a group boundary diff --git a/model/wire.h b/model/wire.h index 5d0b1072f..78889dc4c 100644 --- a/model/wire.h +++ b/model/wire.h @@ -21,6 +21,7 @@ #include "noteBase.h" #include "intrusiveMap.h" +#include "ICairoShim.h" #include #include @@ -49,12 +50,13 @@ namespace minsky constexpr static float handleRadius=3; mutable int unitsCtr=0; ///< for detecting wiring loops in units() mutable std::vector> cairoCoords; ///< contains all the internal cairo coordinates used to draw a wire + void draw(cairo_t* cairo, bool reverseArrow=false) const; public: Wire() {} Wire(const std::weak_ptr& from, const std::weak_ptr& to, const std::vector& a_coords=std::vector()); - ~Wire(); + virtual ~Wire(); std::shared_ptr from() const {return m_from.lock();} std::shared_ptr to() const {return m_to.lock();} @@ -65,7 +67,7 @@ namespace minsky void storeCairoCoords(cairo_t* cairo) const; /// draw this item into a cairo context - void draw(cairo_t* cairo, bool reverseArrow=false) const; + virtual void draw(const ICairoShim& cairoShim, bool reverseArrow=false) const; /// display coordinates std::vector coords() const; diff --git a/test/oldSchema/schema0/1Free.mky.svg b/test/oldSchema/schema0/1Free.mky.svg index c5767d6b8..382b2d78a 100644 --- a/test/oldSchema/schema0/1Free.mky.svg +++ b/test/oldSchema/schema0/1Free.mky.svg @@ -719,60 +719,60 @@ - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + @@ -1491,98 +1491,98 @@ - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - + diff --git a/test/oldSchema/schema0/4MonetaryMinskyModelLessUnstableStart.mky.svg b/test/oldSchema/schema0/4MonetaryMinskyModelLessUnstableStart.mky.svg index d9741e774..cdaa05033 100644 --- a/test/oldSchema/schema0/4MonetaryMinskyModelLessUnstableStart.mky.svg +++ b/test/oldSchema/schema0/4MonetaryMinskyModelLessUnstableStart.mky.svg @@ -885,47 +885,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -951,13 +951,13 @@ - - - - - + + + + + - + @@ -967,38 +967,38 @@ - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - - + + + + + + - + @@ -1159,26 +1159,26 @@ - - - - - - + + + + + + - + - - - - - + + + + + - + @@ -1191,14 +1191,14 @@ - - - - - - + + + + + + - + @@ -1212,14 +1212,14 @@ - - - - - - + + + + + + - + @@ -1229,21 +1229,21 @@ - - - - - + + + + + - + - - - - - + + + + + - + @@ -1259,21 +1259,21 @@ - - - - - + + + + + - + - - - - - + + + + + - + @@ -1291,153 +1291,153 @@ - - - - - + + + + + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + @@ -1448,143 +1448,143 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + @@ -1595,35 +1595,35 @@ - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + @@ -1634,19 +1634,19 @@ - + - - - - + + + + - - - - - + + + + + @@ -1657,24 +1657,24 @@ - + - - - - - - - - - + + + + + + + + + - - - - - + + + + + @@ -1685,47 +1685,47 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + @@ -1736,21 +1736,21 @@ - + - - - - - - + + + + + + - - - - - + + + + + @@ -1761,20 +1761,20 @@ - + - - - - - + + + + + - - - - - + + + + + @@ -1785,21 +1785,21 @@ - - + + - - - - - + + + + + - - - - - + + + + + @@ -1810,20 +1810,20 @@ - - + + - - - - + + + + - - - - - + + + + + @@ -1834,17 +1834,17 @@ - - + + - + - - - - - + + + + + @@ -1855,29 +1855,29 @@ - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - + + + + + @@ -1888,29 +1888,29 @@ - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - + + + + + @@ -1921,110 +1921,110 @@ - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2035,20 +2035,20 @@ - + - - + + - + - - - - - + + + + + @@ -2059,157 +2059,159 @@ - + - + - - - - - + + + + + + + - - + + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - - + + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + @@ -2220,30 +2222,30 @@ - - + + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + @@ -2254,64 +2256,64 @@ - - + + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - - - - - + + + + + + - + - + - - - - - + + + + + @@ -2322,32 +2324,32 @@ - + - + - - - - - + + + + + - - + + - - - - - + + + + + - - - - - + + + + + @@ -2358,17 +2360,17 @@ - - + + - + - - - - - + + + + + @@ -2379,17 +2381,17 @@ - + - - + + - - - - - + + + + + @@ -2400,40 +2402,40 @@ - - + + - - + + - - - - - + + + + + - + - - - - - - + + + + + + - + - + - - - - - + + + + + @@ -2444,17 +2446,17 @@ - + - - + + - - - - - + + + + + @@ -2465,62 +2467,62 @@ - - + + - - - + + + - + - - - - + + + + - + - + - - - - - + + + + + - + - - - + + + - + - - - - + + + + - + - + - - - - - + + + + + @@ -2531,61 +2533,61 @@ - + - - - + + + - + - - - - + + + + - + - + - - - - - + + + + + - + - - - + + + - + - - - - + + + + - + - + - - - - - + + + + + @@ -2596,7 +2598,7 @@ - + diff --git a/test/oldSchema/schema0/GoodwinLinear.mky.svg b/test/oldSchema/schema0/GoodwinLinear.mky.svg index dcb4a1a6a..6517bf049 100644 --- a/test/oldSchema/schema0/GoodwinLinear.mky.svg +++ b/test/oldSchema/schema0/GoodwinLinear.mky.svg @@ -242,13 +242,13 @@ - - - - - + + + + + - + @@ -258,13 +258,13 @@ - - - - - + + + + + - + @@ -274,13 +274,13 @@ - - - - - + + + + + - + @@ -295,24 +295,24 @@ - - - - - - - - - + + + + + + + + + - - - - - + + + + + - + @@ -335,65 +335,68 @@ - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + + + + - - + + - - - - - - - + + + + + + + - - - - - + + + + + @@ -404,71 +407,71 @@ - + - + - - - - - + + + + + - + - - - - - - - - + + + + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - + diff --git a/test/oldSchema/schema0/GoodwinLinear02.mky.svg b/test/oldSchema/schema0/GoodwinLinear02.mky.svg index ef0d667b1..1dc9b192c 100644 --- a/test/oldSchema/schema0/GoodwinLinear02.mky.svg +++ b/test/oldSchema/schema0/GoodwinLinear02.mky.svg @@ -213,13 +213,13 @@ - - - - - + + + + + - + @@ -229,21 +229,21 @@ - - - - - + + + + + - + - - - - - + + + + + - + @@ -270,53 +270,53 @@ - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + @@ -327,64 +327,64 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - + diff --git a/test/oldSchema/schema0/Steve.mky.svg b/test/oldSchema/schema0/Steve.mky.svg index 95ce5f902..b256567d0 100644 --- a/test/oldSchema/schema0/Steve.mky.svg +++ b/test/oldSchema/schema0/Steve.mky.svg @@ -963,13 +963,13 @@ - - - - - + + + + + - + @@ -979,23 +979,23 @@ - - - - - - + + + + + + - + - - - - - - + + + + + + - + @@ -1005,29 +1005,29 @@ - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + @@ -1037,167 +1037,167 @@ - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + diff --git a/test/oldSchema/schema0/SteveTest028.mky.svg b/test/oldSchema/schema0/SteveTest028.mky.svg index 1a8611ff5..094e02132 100644 --- a/test/oldSchema/schema0/SteveTest028.mky.svg +++ b/test/oldSchema/schema0/SteveTest028.mky.svg @@ -658,29 +658,29 @@ - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + @@ -690,29 +690,29 @@ - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + @@ -726,13 +726,13 @@ - - - - - + + + + + - + @@ -742,140 +742,140 @@ - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - - - - + + + + + + + + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + diff --git a/test/oldSchema/schema0/UWS05.mky.svg b/test/oldSchema/schema0/UWS05.mky.svg index 6f585c708..9eaa54806 100644 --- a/test/oldSchema/schema0/UWS05.mky.svg +++ b/test/oldSchema/schema0/UWS05.mky.svg @@ -783,46 +783,46 @@ - - - - - + + + + + - + - - - - - - - - + + + + + + + + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + @@ -844,136 +844,136 @@ - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + diff --git a/test/oldSchema/schema0/exponentialGrowth.mky.svg b/test/oldSchema/schema0/exponentialGrowth.mky.svg index f7059ef82..0aad41431 100644 --- a/test/oldSchema/schema0/exponentialGrowth.mky.svg +++ b/test/oldSchema/schema0/exponentialGrowth.mky.svg @@ -164,28 +164,28 @@ - + - - - - - + + + + + - + - - - - - + + + + + - + diff --git a/test/oldSchema/schema0/exponentialGrowthWithExtraLabel.mky.svg b/test/oldSchema/schema0/exponentialGrowthWithExtraLabel.mky.svg index 4fe521f41..f5056b5d4 100644 --- a/test/oldSchema/schema0/exponentialGrowthWithExtraLabel.mky.svg +++ b/test/oldSchema/schema0/exponentialGrowthWithExtraLabel.mky.svg @@ -164,40 +164,40 @@ - + - - - - - + + + + + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + diff --git a/test/oldSchema/schema1/1Free.mky.svg b/test/oldSchema/schema1/1Free.mky.svg index 813584ef9..9150526cb 100644 --- a/test/oldSchema/schema1/1Free.mky.svg +++ b/test/oldSchema/schema1/1Free.mky.svg @@ -819,44 +819,44 @@ - - - - - + + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - + + - - - - - + + + + + @@ -867,18 +867,18 @@ - - + + - - + + - - - - - + + + + + @@ -889,24 +889,24 @@ - - + + - + - - - - - + + + + + - - - - - + + + + + @@ -917,7 +917,7 @@ - + @@ -1680,98 +1680,98 @@ - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - + diff --git a/test/oldSchema/schema1/4MonetaryMinskyModelLessUnstableStart.mky.svg b/test/oldSchema/schema1/4MonetaryMinskyModelLessUnstableStart.mky.svg index 4887809e7..5a2154162 100644 --- a/test/oldSchema/schema1/4MonetaryMinskyModelLessUnstableStart.mky.svg +++ b/test/oldSchema/schema1/4MonetaryMinskyModelLessUnstableStart.mky.svg @@ -1205,308 +1205,308 @@ - - + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + - + - - - + + + - - + + - - - - - + + + + + - + - - - + + + - - + + - - - - - + + + + + @@ -1517,21 +1517,21 @@ - + - - - + + + - + - - - - - + + + + + @@ -1542,62 +1542,62 @@ - + - - - + + + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - + + + - + - + - - - - - + + + + + @@ -1608,63 +1608,63 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - - + + - + - - - - - + + + + + - - + + - + - - - - - + + + + + - - + + - + - - - - - + + + + + @@ -1675,26 +1675,26 @@ - + - - - + + + - - - + + + - + - - - - - + + + + + @@ -1705,26 +1705,26 @@ - + - - - + + + - - - + + + - + - - - - - + + + + + @@ -1735,110 +1735,110 @@ - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + @@ -1849,19 +1849,19 @@ - + - + - + - - - - - + + + + + @@ -1872,133 +1872,135 @@ - + - + - - - - - + + + + + + + - - + + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - - + + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + @@ -2009,30 +2011,30 @@ - - + + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + @@ -2043,65 +2045,65 @@ - - + + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - - - + + + + - + - + - + - - - - - + + + + + @@ -2112,40 +2114,40 @@ - + - + - - - - - + + + + + - - + + - + - - - - - + + + + + - - + + - + - - - - - + + + + + @@ -2156,17 +2158,17 @@ - + - - + + - - - - - + + + + + @@ -2177,41 +2179,41 @@ - - + + - - + + - - - - - + + + + + - + - - - - + + + + - + - + - + - - - - - + + + + + @@ -2222,17 +2224,17 @@ - + - - + + - - - - - + + + + + @@ -2243,60 +2245,60 @@ - - + + - + - - + + - + - + - + - + - - - - - + + + + + - + - + - - + + - + - + - + - + - - - - - + + + + + @@ -2307,59 +2309,59 @@ - + - + - - + + - + - + - + - + - - - - - + + + + + - + - + - - + + - + - + - + - + - - - - - + + + + + @@ -2370,19 +2372,19 @@ - + - + - + - - - - - + + + + + @@ -2393,33 +2395,33 @@ - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -2430,32 +2432,32 @@ - + - - + + - - + + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2466,19 +2468,19 @@ - + - - - + + + - - - - - - + + + + + + @@ -2489,21 +2491,21 @@ - - + + - - - - + + + + - - - - - - + + + + + + @@ -2514,49 +2516,51 @@ - - + + - - - - + + + + - - - - - + + + + + - - + + - - - - + + + + - - - - - + + + + + + + - - + + - - - + + + - - - - - + + + + + @@ -2567,20 +2571,20 @@ - - + + - - - - + + + + - - - - - + + + + + @@ -2591,33 +2595,36 @@ - - + + - - + + - - - - - + + + + + + + + - - + + - - - - + + + + - - - - - + + + + + @@ -2628,20 +2635,20 @@ - - + + - - - - + + + + - - - - - + + + + + @@ -2652,101 +2659,108 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - - - - + + + + + + + - - + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - + + + + + - - + + - - - + + + - - - - - + + + + + + - - + + - + - - - - - + + + + + + + - - + + - + - - - - - + + + + + + + - - + + - - - + + + - - - - - - + + + + + + @@ -2757,8 +2771,8 @@ - - + + diff --git a/test/oldSchema/schema1/BasicGrowthModel.mky.svg b/test/oldSchema/schema1/BasicGrowthModel.mky.svg index 05cdede6e..d9737617f 100644 --- a/test/oldSchema/schema1/BasicGrowthModel.mky.svg +++ b/test/oldSchema/schema1/BasicGrowthModel.mky.svg @@ -263,40 +263,40 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -324,202 +324,205 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -530,36 +533,36 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -570,7 +573,7 @@ - + diff --git a/test/oldSchema/schema1/GoodwinLinear.mky.svg b/test/oldSchema/schema1/GoodwinLinear.mky.svg index 821ba0885..a52a1b62d 100644 --- a/test/oldSchema/schema1/GoodwinLinear.mky.svg +++ b/test/oldSchema/schema1/GoodwinLinear.mky.svg @@ -139,13 +139,13 @@ - + - + - + @@ -322,23 +322,23 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + - + @@ -361,202 +361,209 @@ - - - - - - - - + - - + + + + + + - - - - - + - - + + + + + + - - - - - + - - + + + + + + - - - - - + - - - - - - - - - + + + + + + + + + + - - - - - + + + + + + + - - - + + + + + - - + + + - - + + + - - - - - + - - - - - - - - - + + + + + + - - - - - + + + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - - - - + + + + + + - - - - - + + + + + + + + + + - - + + + + + + - - - - - + - - - - - - - + + + + + + + + + - - - - - - + + + + + - - - + + + + + + - - + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + - - + + diff --git a/test/oldSchema/schema1/GoodwinLinear02.mky.svg b/test/oldSchema/schema1/GoodwinLinear02.mky.svg index f07dc89b0..9c357938f 100644 --- a/test/oldSchema/schema1/GoodwinLinear02.mky.svg +++ b/test/oldSchema/schema1/GoodwinLinear02.mky.svg @@ -329,53 +329,53 @@ - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + @@ -386,101 +386,106 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - + - + - - - - - + + + + + + + - - + + - + - - - - - - + + + + + + - - + + - + - - - - - + + + + + + + + - - + + diff --git a/test/oldSchema/schema1/LoanableFunds.mky.svg b/test/oldSchema/schema1/LoanableFunds.mky.svg index 627ed733d..f3736a886 100644 --- a/test/oldSchema/schema1/LoanableFunds.mky.svg +++ b/test/oldSchema/schema1/LoanableFunds.mky.svg @@ -3066,107 +3066,107 @@ - - - + + + - + - - - - - + + + + + - - + + - - - + + + - + - - - - - + + + + + - - + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -3177,18 +3177,18 @@ - + - - - + + + - - - - - + + + + + @@ -3199,183 +3199,183 @@ - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - - + + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - - + + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -3386,21 +3386,21 @@ - - + + - + - + - - - - - - + + + + + + @@ -3411,19 +3411,19 @@ - - + + - - - + + + - - - - - + + + + + @@ -3434,35 +3434,35 @@ - + - + - + - - - - - + + + + + - + - + - - + + - - - - - - + + + + + + @@ -3473,36 +3473,36 @@ - - + + - + - + - - - - - + + + + + - + - + - - + + - - - - - - + + + + + + @@ -3513,123 +3513,127 @@ - - + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - + + - - - - - + + + + + + + - - + + - + - - + + - - - - - + + + + + + + - - + + - + - - + + - - - - - + + + + + @@ -3640,435 +3644,439 @@ - - + + - + - - + + - - - - - + + + + + + + - - + + - + - - + + - - - - - + + + + + + + - - + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - - + + - + - + - - - - - + + + + + - - + + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -4079,32 +4087,32 @@ - + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -4115,32 +4123,32 @@ - + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -4151,18 +4159,18 @@ - + - - - + + + - - - - - + + + + + @@ -4173,54 +4181,54 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -4231,43 +4239,43 @@ - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -4278,7 +4286,7 @@ - + diff --git a/test/oldSchema/schema1/MinskyGovernmentNonlinear.mky.svg b/test/oldSchema/schema1/MinskyGovernmentNonlinear.mky.svg index 62d683a0e..f0537b8f0 100644 --- a/test/oldSchema/schema1/MinskyGovernmentNonlinear.mky.svg +++ b/test/oldSchema/schema1/MinskyGovernmentNonlinear.mky.svg @@ -636,22 +636,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -670,27 +670,27 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -713,25 +713,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -789,19 +789,19 @@ - - - - + + + + - - - - - + + + + + - + @@ -883,19 +883,19 @@ - - - - + + + + - - - - - + + + + + - + @@ -973,134 +973,134 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - + - + - - - - + + + + - - - - - + + + + + - + - - - - + + + + - - + + - - - - - + + + + + @@ -1111,105 +1111,105 @@ - + - - - - + + + + - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + @@ -1220,225 +1220,225 @@ - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + - + - - - - - - - - - + + + + + + + + + - - - - - + + + + + - + - + - - - - + + + + - - - - - + + + + + - + - - - - - - - - - + + + + + + + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - + + + + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - - - + + + + + + + + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + - + - + - - + + - - - - - + + + + + @@ -1449,39 +1449,39 @@ - + - - - - - - - + + + + + + + - - - - - + + + + + - + - - - + + + - - + + - - - - - + + + + + @@ -1492,34 +1492,34 @@ - + - + - - - - - + + + + + - + - - - - + + + + - - + + - - - - - + + + + + @@ -1530,23 +1530,23 @@ - - + + - - - + + + - - + + - - - - - + + + + + @@ -1557,20 +1557,20 @@ - - + + - + - + - - - - - + + + + + @@ -1581,19 +1581,19 @@ - + - + - + - - - - - + + + + + @@ -1604,22 +1604,22 @@ - - + + - - - + + + - + - - - - - + + + + + @@ -1630,35 +1630,35 @@ - + - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + @@ -1669,37 +1669,37 @@ - - + + - + - + - - - - - + + + + + - - + + - - - + + + - + - - - - - + + + + + @@ -1710,20 +1710,20 @@ - - + + - + - + - - - - - + + + + + @@ -1734,36 +1734,36 @@ - - + + - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + @@ -1774,37 +1774,37 @@ - - + + - + - + - - - - - + + + + + - - + + - - - + + + - + - - - - - + + + + + @@ -1815,33 +1815,33 @@ - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -1852,20 +1852,20 @@ - - + + - + - + - - - - - + + + + + @@ -1876,21 +1876,21 @@ - + - - - + + + - + - - - - - + + + + + @@ -1901,21 +1901,21 @@ - + - - - + + + - + - - - - - + + + + + @@ -1926,24 +1926,24 @@ - + - - - + + + - - - - + + + + - - - - - + + + + + @@ -1954,37 +1954,37 @@ - - + + - + - + - - - - - + + + + + - - + + - - - + + + - + - - - - - + + + + + @@ -1995,19 +1995,19 @@ - + - + - + - - - - - + + + + + @@ -2018,22 +2018,22 @@ - - + + - - - + + + - + - - - - - + + + + + @@ -2044,16 +2044,16 @@ - + - + - - - - - + + + + + @@ -2064,7 +2064,7 @@ - + diff --git a/test/oldSchema/schema1/MinskyNonLinear.mky.svg b/test/oldSchema/schema1/MinskyNonLinear.mky.svg index a1bfcc068..28ece9d03 100644 --- a/test/oldSchema/schema1/MinskyNonLinear.mky.svg +++ b/test/oldSchema/schema1/MinskyNonLinear.mky.svg @@ -1058,16 +1058,16 @@ - + - - - - - + + + + + - + @@ -1090,16 +1090,16 @@ - + - - - - - + + + + + - + @@ -1134,16 +1134,16 @@ - + - - - - - + + + + + - + @@ -1174,17 +1174,17 @@ - + - + - - - - - + + + + + @@ -1195,7 +1195,7 @@ - + @@ -1218,19 +1218,19 @@ - - - - + + + + - - - - - + + + + + - + @@ -1261,36 +1261,36 @@ - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -1301,39 +1301,39 @@ - - + + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -1344,32 +1344,34 @@ - - + + - + - - - - - + + + + + + + - - + + - + - + - - - - - + + + + + @@ -1380,71 +1382,71 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -1455,30 +1457,30 @@ - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -1489,19 +1491,19 @@ - + - + - + - - - - - + + + + + @@ -1512,30 +1514,30 @@ - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -1546,16 +1548,16 @@ - + - + - - - - - + + + + + @@ -1566,19 +1568,19 @@ - + - + - + - - - - - + + + + + @@ -1589,27 +1591,27 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -1620,71 +1622,71 @@ - - + + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -1695,16 +1697,16 @@ - + - + - - - - - + + + + + @@ -1715,58 +1717,58 @@ - - + + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -1777,107 +1779,107 @@ - + - - - - - - + + + + + + - - - - - + + + + + - - + + - + - - - - - + + + + + - - + + - - - - - - + + + + + + - - - - - + + + + + - - + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -1888,142 +1890,142 @@ - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -2034,7 +2036,7 @@ - + diff --git a/test/oldSchema/schema1/MinskyPricesFinal.mky.svg b/test/oldSchema/schema1/MinskyPricesFinal.mky.svg index c101283e7..e2361f7a0 100644 --- a/test/oldSchema/schema1/MinskyPricesFinal.mky.svg +++ b/test/oldSchema/schema1/MinskyPricesFinal.mky.svg @@ -1495,16 +1495,16 @@ - + - - - - - + + + + + - + @@ -1527,16 +1527,16 @@ - + - - - - - + + + + + - + @@ -1559,16 +1559,16 @@ - + - - - - - + + + + + - + @@ -1619,19 +1619,19 @@ - + - + - - - - - + + + + + - + @@ -1674,16 +1674,16 @@ - + - - - - - + + + + + - + @@ -1741,77 +1741,77 @@ - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + @@ -1822,307 +1822,307 @@ - + - - - - + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -2133,16 +2133,16 @@ - + - + - - - - - + + + + + @@ -2153,188 +2153,188 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + @@ -2345,21 +2345,21 @@ - + - - - + + + - + - - - - - + + + + + @@ -2370,21 +2370,21 @@ - + - - - + + + - + - - - - - + + + + + @@ -2395,58 +2395,58 @@ - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + @@ -2457,16 +2457,16 @@ - + - + - - - - - + + + + + @@ -2477,20 +2477,20 @@ - + - - + + - + - - - - - + + + + + @@ -2501,34 +2501,34 @@ - + - + - + - + - - - - - + + + + + - - + + - + - - - - - + + + + + @@ -2539,16 +2539,16 @@ - + - + - - - - - + + + + + @@ -2559,19 +2559,19 @@ - + - + - + - - - - - + + + + + @@ -2582,19 +2582,19 @@ - + - + - + - - - - - + + + + + @@ -2605,19 +2605,19 @@ - + - + - + - - - - - + + + + + @@ -2628,35 +2628,35 @@ - + - + - - + + - - - - - + + + + + - + - + - - + + - - - - - + + + + + @@ -2667,27 +2667,27 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2698,32 +2698,32 @@ - + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -2734,19 +2734,19 @@ - + - + - + - - - - - + + + + + @@ -2757,27 +2757,27 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2788,16 +2788,16 @@ - + - + - - - - - + + + + + @@ -2808,16 +2808,16 @@ - + - + - - - - - + + + + + @@ -2828,7 +2828,7 @@ - + diff --git a/test/oldSchema/schema1/MonetaryMinskyNeoPrices.mky.svg b/test/oldSchema/schema1/MonetaryMinskyNeoPrices.mky.svg index 06e05c5c9..a01cf05cf 100644 --- a/test/oldSchema/schema1/MonetaryMinskyNeoPrices.mky.svg +++ b/test/oldSchema/schema1/MonetaryMinskyNeoPrices.mky.svg @@ -1897,16 +1897,16 @@ - + - - - - - + + + + + - + @@ -1929,16 +1929,16 @@ - + - - - - - + + + + + - + @@ -1961,14 +1961,14 @@ - + - - - - - + + + + + @@ -1979,7 +1979,7 @@ - + @@ -2030,19 +2030,19 @@ - + - + - - - - - + + + + + - + @@ -2085,16 +2085,16 @@ - + - - - - - + + + + + - + @@ -2193,21 +2193,21 @@ - + - - - + + + - - - - - + + + + + - + @@ -2249,61 +2249,61 @@ - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2314,360 +2314,360 @@ - + - - - - - - + + + + + + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + - + - - - + + + - - + + - - - - - + + + + + - + - - - + + + - - + + - - - - - + + + + + - + - - - - + + + + - + - - - - - + + + + + - + - - - - + + + + - + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - + + + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2678,27 +2678,27 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2709,103 +2709,103 @@ - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2816,16 +2816,16 @@ - + - + - - - - - + + + + + @@ -2836,16 +2836,16 @@ - + - + - - - - - + + + + + @@ -2856,32 +2856,32 @@ - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + @@ -2892,21 +2892,21 @@ - + - - - + + + - + - - - - - + + + + + @@ -2917,60 +2917,60 @@ - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + @@ -2981,16 +2981,16 @@ - + - + - - - - - + + + + + @@ -3001,17 +3001,17 @@ - + - - + + - - - - - + + + + + @@ -3022,20 +3022,20 @@ - + - + - - + + - - - - - + + + + + @@ -3046,16 +3046,16 @@ - + - + - - - - - + + + + + @@ -3066,141 +3066,141 @@ - + - + - + - - - - - + + + + + - + - - - - + + + + - + - - - - - + + + + + - + - - - - + + + + - + - - - - - + + + + + - + - - - + + + - - - + + + - - - - - + + + + + - + - + - - - + + + - - - - - + + + + + - + - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - - + + + + + + - - - - - + + + + + - + - - - + + + - - + + - - - - - + + + + + @@ -3210,22 +3210,22 @@ - + - - - + + + - - + + - - - - - + + + + + @@ -3235,58 +3235,58 @@ - + - - - + + + - - - - - - + + + + + + - - - - - + + + + + - + - - - + + + - - - - - - + + + + + + - - - - - + + + + + - + - + - - - - - + + + + + @@ -3297,16 +3297,16 @@ - + - + - - - - - + + + + + @@ -3317,19 +3317,19 @@ - + - + - + - - - - - + + + + + @@ -3340,19 +3340,19 @@ - + - + - + - - - - - + + + + + @@ -3363,19 +3363,19 @@ - + - + - + - - - - - + + + + + @@ -3386,35 +3386,35 @@ - + - + - - + + - - - - - + + + + + - + - + - - + + - - - - - + + + + + @@ -3425,27 +3425,27 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -3456,32 +3456,32 @@ - + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -3492,19 +3492,19 @@ - + - + - + - - - - - + + + + + @@ -3515,27 +3515,27 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -3546,16 +3546,16 @@ - + - + - - - - - + + + + + @@ -3566,16 +3566,16 @@ - + - + - - - - - + + + + + @@ -3586,125 +3586,125 @@ - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + diff --git a/test/oldSchema/schema1/PredatorPrey.mky.svg b/test/oldSchema/schema1/PredatorPrey.mky.svg index 1f0e6ef62..c397901e7 100644 --- a/test/oldSchema/schema1/PredatorPrey.mky.svg +++ b/test/oldSchema/schema1/PredatorPrey.mky.svg @@ -247,23 +247,23 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + - + @@ -278,19 +278,19 @@ - - - - + + + + - - - - - + + + + + - + @@ -324,478 +324,478 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - + + + + + - - - - - + + + + + - - - + + + - - + + - + diff --git a/test/oldSchema/schema1/Solow.mky.svg b/test/oldSchema/schema1/Solow.mky.svg index d66b30202..3de191f92 100644 --- a/test/oldSchema/schema1/Solow.mky.svg +++ b/test/oldSchema/schema1/Solow.mky.svg @@ -401,39 +401,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -481,346 +481,351 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - - - - - + + + + + - - - + + + - - + + - + - + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - - - + + + - - + + - + diff --git a/test/oldSchema/schema1/Steve.mky.svg b/test/oldSchema/schema1/Steve.mky.svg index 4c12a9eda..71b4e8d35 100644 --- a/test/oldSchema/schema1/Steve.mky.svg +++ b/test/oldSchema/schema1/Steve.mky.svg @@ -1004,165 +1004,165 @@ - - - - + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - - + + + + + + @@ -1173,18 +1173,18 @@ - - + + - - + + - - - - - + + + + + @@ -1195,18 +1195,18 @@ - - + + - - + + - - - - - + + + + + @@ -1217,61 +1217,66 @@ - - + + - + - - - - - + + + + + + + - - + + - - + + - - - - - + + + + + + + + - - + + - - + + - - - - - - + + + + + + - - + + - - - - - + + + + + - - - - - - + + + + + + @@ -1282,8 +1287,8 @@ - - + + diff --git a/test/oldSchema/schema1/SteveTest028.mky.svg b/test/oldSchema/schema1/SteveTest028.mky.svg index e28d977bc..45e879a91 100644 --- a/test/oldSchema/schema1/SteveTest028.mky.svg +++ b/test/oldSchema/schema1/SteveTest028.mky.svg @@ -708,144 +708,144 @@ - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - - + + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -856,19 +856,19 @@ - + - + - + - - - - - + + + + + @@ -879,32 +879,32 @@ - + - - + + - - - - - + + + + + - - + + - + - + - - - - - + + + + + @@ -915,17 +915,17 @@ - + - + - - - - - - + + + + + + @@ -936,49 +936,49 @@ - - + + - + - - - - - - + + + + + + - - + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + diff --git a/test/oldSchema/schema1/UWS05.mky.svg b/test/oldSchema/schema1/UWS05.mky.svg index 1bd8b70b4..69d826cd6 100644 --- a/test/oldSchema/schema1/UWS05.mky.svg +++ b/test/oldSchema/schema1/UWS05.mky.svg @@ -810,146 +810,146 @@ - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - - + + + + + + @@ -960,18 +960,18 @@ - - + + - - + + - - - - - + + + + + @@ -982,47 +982,52 @@ - - + + - + - - - - - + + + + + + + - - + + - - + + - - - - - + + + + + + + + - - + + - - + + - - - - - - + + + + + + - - + + diff --git a/test/oldSchema/schema1/data-example.mky.svg b/test/oldSchema/schema1/data-example.mky.svg index e05a0faae..f594c228b 100644 --- a/test/oldSchema/schema1/data-example.mky.svg +++ b/test/oldSchema/schema1/data-example.mky.svg @@ -158,16 +158,16 @@ - + - - - - - + + + + + - + diff --git a/test/oldSchema/schema1/exponentialGrowth.mky.svg b/test/oldSchema/schema1/exponentialGrowth.mky.svg index 1fcb5ed0c..a968830c1 100644 --- a/test/oldSchema/schema1/exponentialGrowth.mky.svg +++ b/test/oldSchema/schema1/exponentialGrowth.mky.svg @@ -175,29 +175,29 @@ - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -208,7 +208,7 @@ - + diff --git a/test/oldSchema/schema1/exponentialGrowthWithExtraLabel.mky.svg b/test/oldSchema/schema1/exponentialGrowthWithExtraLabel.mky.svg index 263cfd172..7619ba24b 100644 --- a/test/oldSchema/schema1/exponentialGrowthWithExtraLabel.mky.svg +++ b/test/oldSchema/schema1/exponentialGrowthWithExtraLabel.mky.svg @@ -175,41 +175,41 @@ - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + @@ -220,7 +220,7 @@ - + diff --git a/test/oldSchema/schema1/math-examples.mky.svg b/test/oldSchema/schema1/math-examples.mky.svg index 99a08fda5..983514f65 100644 --- a/test/oldSchema/schema1/math-examples.mky.svg +++ b/test/oldSchema/schema1/math-examples.mky.svg @@ -118,166 +118,166 @@ - + - - + + - - - - - - - - + + + + + + + + - + - + - - + + - - + + - + - - + + - - - - - - - - + + + + + + + + - + - + - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + + - + - - - - - - - - + + + + + + + + - + - - + + - - - - - - - - + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - + + + + + + + + diff --git a/test/oldSchema/schema1/switchBlock.mky.svg b/test/oldSchema/schema1/switchBlock.mky.svg index 736b5797e..96103ee93 100644 --- a/test/oldSchema/schema1/switchBlock.mky.svg +++ b/test/oldSchema/schema1/switchBlock.mky.svg @@ -179,43 +179,43 @@ - - - - + + + + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + diff --git a/test/oldSchema/schema2/1Free.mky.svg b/test/oldSchema/schema2/1Free.mky.svg index f224db054..536d22ef9 100644 --- a/test/oldSchema/schema2/1Free.mky.svg +++ b/test/oldSchema/schema2/1Free.mky.svg @@ -924,44 +924,44 @@ - - - - - + + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - + + - - - - - + + + + + @@ -972,17 +972,17 @@ - + - - + + - - - - - + + + + + @@ -993,23 +993,23 @@ - + - + - - - - - + + + + + - - - - - + + + + + @@ -1020,7 +1020,7 @@ - + @@ -1853,98 +1853,98 @@ - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - + diff --git a/test/oldSchema/schema2/4MonetaryMinskyModelLessUnstableStart.mky.svg b/test/oldSchema/schema2/4MonetaryMinskyModelLessUnstableStart.mky.svg index cb4513f98..d502fbd40 100644 --- a/test/oldSchema/schema2/4MonetaryMinskyModelLessUnstableStart.mky.svg +++ b/test/oldSchema/schema2/4MonetaryMinskyModelLessUnstableStart.mky.svg @@ -1313,308 +1313,308 @@ - - + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + - + - - - + + + - - + + - - - - - + + + + + - + - - - + + + - - + + - - - - - + + + + + @@ -1625,21 +1625,21 @@ - + - - - + + + - + - - - - - + + + + + @@ -1650,62 +1650,62 @@ - + - - - + + + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - + + + - + - + - - - - - + + + + + @@ -1716,60 +1716,60 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -1780,26 +1780,26 @@ - + - - - + + + - - - + + + - + - - - - - + + + + + @@ -1810,26 +1810,26 @@ - + - - - + + + - - - + + + - + - - - - - + + + + + @@ -1840,110 +1840,110 @@ - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + @@ -1954,19 +1954,19 @@ - + - + - + - - - - - + + + + + @@ -1977,131 +1977,131 @@ - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + @@ -2112,29 +2112,29 @@ - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + @@ -2145,64 +2145,64 @@ - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - - - + + + + - + - + - + - - - - - + + + + + @@ -2213,38 +2213,38 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2255,17 +2255,17 @@ - + - - + + - - - - - + + + + + @@ -2276,40 +2276,40 @@ - + - - + + - - - - - + + + + + - + - - - - + + + + - + - + - + - - - - - + + + + + @@ -2320,17 +2320,17 @@ - + - - + + - - - - - + + + + + @@ -2341,59 +2341,59 @@ - + - + - - + + - + - + - + - + - - - - - + + + + + - + - + - - + + - + - + - + - + - - - - - + + + + + @@ -2404,59 +2404,59 @@ - + - + - - + + - + - + - + - + - - - - - + + + + + - + - + - - + + - + - + - + - + - - - - - + + + + + @@ -2467,19 +2467,19 @@ - + - + - + - - - - - + + + + + @@ -2490,33 +2490,33 @@ - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -2527,32 +2527,32 @@ - + - - + + - - + + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2563,18 +2563,18 @@ - + - - - + + + - - - - - + + + + + @@ -2585,19 +2585,19 @@ - + - - - - + + + + - - - - - + + + + + @@ -2608,46 +2608,46 @@ - + - - - - + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -2658,19 +2658,19 @@ - + - - - - + + + + - - - - - + + + + + @@ -2681,31 +2681,31 @@ - + - - + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + @@ -2716,19 +2716,19 @@ - + - - - - + + + + - - - - - + + + + + @@ -2739,94 +2739,94 @@ - + - - - - - - - - - + + + + + + + + + - - - - - + + + + + - + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -2837,7 +2837,7 @@ - + diff --git a/test/oldSchema/schema2/BasicGrowthModel.mky.svg b/test/oldSchema/schema2/BasicGrowthModel.mky.svg index 9c3d6b348..9366920f8 100644 --- a/test/oldSchema/schema2/BasicGrowthModel.mky.svg +++ b/test/oldSchema/schema2/BasicGrowthModel.mky.svg @@ -263,40 +263,40 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -324,201 +324,201 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -529,36 +529,36 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -569,7 +569,7 @@ - + diff --git a/test/oldSchema/schema2/EndogenousMoney.mky.svg b/test/oldSchema/schema2/EndogenousMoney.mky.svg index f6b231895..fae09e6f4 100644 --- a/test/oldSchema/schema2/EndogenousMoney.mky.svg +++ b/test/oldSchema/schema2/EndogenousMoney.mky.svg @@ -3390,30 +3390,30 @@ - - - - + + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -3424,277 +3424,277 @@ - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - + + + + - + - - - - - + + + + + - + - - - - + + + + - + - - - - - + + + + + - + - - - - + + + + - - + + - - - - - + + + + + - + - - - - + + + + - - + + - - - - - + + + + + - + - - - - + + + + - - + + - - - - - + + + + + - + - - - - + + + + - - + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - + - - - - - + + + + + - - + + - - - - - - - + + + + + + + - - - - - + + + + + - + - - - - - - - - - + + + + + + + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - - + + - - - - + + + + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -3705,71 +3705,71 @@ - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - + - - - - - + + + + + - - + + - + - + - + - - + + - - - - - + + + + + @@ -3780,47 +3780,47 @@ - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -3831,19 +3831,19 @@ - + - + - + - - - - - + + + + + @@ -3854,20 +3854,20 @@ - + - + - - + + - - - - - + + + + + @@ -3878,33 +3878,33 @@ - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -3915,19 +3915,19 @@ - + - + - + - - - - - + + + + + @@ -3938,56 +3938,56 @@ - + - - - - - + + + + + - + - + - - + + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -3998,27 +3998,27 @@ - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -4029,71 +4029,71 @@ - + - - - - - - - + + + + + + + - - - - - + + + + + - + - - - - - - - - - + + + + + + + + + - - - - - + + + + + - + - + - - + + - - - - - + + + + + - + - + - - + + - - - - - + + + + + @@ -4104,312 +4104,312 @@ - + - - - - - - - + + + + + + + - - - - - + + + + + - + - - - - - - - - - + + + + + + + + + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - + - - - - - + + + + + - - + + - + - + - - - - - + + + + + - - + + - - - - - - - + + + + + + + - - - - - + + + + + - + - - - - - - - - - + + + + + + + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - - + + - - - - + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - - + + - - - - + + + + - - - - - + + + + + - + - + - + - + - - + + - - - - - + + + + + @@ -4420,19 +4420,19 @@ - + - + - + - - - - - + + + + + @@ -4443,19 +4443,19 @@ - + - + - + - - - - - + + + + + @@ -4466,7 +4466,7 @@ - + diff --git a/test/oldSchema/schema2/GoodwinLinear.mky.svg b/test/oldSchema/schema2/GoodwinLinear.mky.svg index 4b120fb1c..b2a157127 100644 --- a/test/oldSchema/schema2/GoodwinLinear.mky.svg +++ b/test/oldSchema/schema2/GoodwinLinear.mky.svg @@ -322,23 +322,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -361,64 +361,64 @@ - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + @@ -429,95 +429,95 @@ - + - + - - - - - + + + + + - + - - - - - - - - + + + + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + @@ -528,30 +528,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/oldSchema/schema2/GoodwinLinear02.mky.svg b/test/oldSchema/schema2/GoodwinLinear02.mky.svg index b9817b7f8..3492d8b03 100644 --- a/test/oldSchema/schema2/GoodwinLinear02.mky.svg +++ b/test/oldSchema/schema2/GoodwinLinear02.mky.svg @@ -329,53 +329,53 @@ - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + @@ -386,97 +386,97 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + diff --git a/test/oldSchema/schema2/LoanableFunds.mky.svg b/test/oldSchema/schema2/LoanableFunds.mky.svg index 7aa4a6b66..b72b775c9 100644 --- a/test/oldSchema/schema2/LoanableFunds.mky.svg +++ b/test/oldSchema/schema2/LoanableFunds.mky.svg @@ -3493,105 +3493,105 @@ - - - + + + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -3602,18 +3602,18 @@ - + - - - + + + - - - - - + + + + + @@ -3624,183 +3624,183 @@ - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - - + + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - - + + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -3811,19 +3811,19 @@ - + - + - + - - - - - + + + + + @@ -3834,18 +3834,18 @@ - + - - - + + + - - - - - + + + + + @@ -3856,34 +3856,34 @@ - + - + - + - - - - - + + + + + - + - + - - + + - - - - - + + + + + @@ -3894,34 +3894,34 @@ - + - + - + - - - - - + + + + + - + - + - - + + - - - - - + + + + + @@ -3932,120 +3932,120 @@ - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - + + - - - - - + + + + + - + - + - - + + - - - - - + + + + + - + - + - - + + - - - - - + + + + + @@ -4056,432 +4056,432 @@ - + - + - - + + - - - - - + + + + + - + - + - - + + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - - + + - + - + - - - - - + + + + + - - + + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -4492,32 +4492,32 @@ - + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -4528,32 +4528,32 @@ - + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -4564,18 +4564,18 @@ - + - - - + + + - - - - - + + + + + @@ -4586,54 +4586,54 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -4644,43 +4644,43 @@ - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -4691,7 +4691,7 @@ - + diff --git a/test/oldSchema/schema2/MinskyGovernmentNonlinear.mky.svg b/test/oldSchema/schema2/MinskyGovernmentNonlinear.mky.svg index 2ee0e64df..b36527a94 100644 --- a/test/oldSchema/schema2/MinskyGovernmentNonlinear.mky.svg +++ b/test/oldSchema/schema2/MinskyGovernmentNonlinear.mky.svg @@ -636,22 +636,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -670,27 +670,27 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -713,25 +713,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -789,19 +789,19 @@ - - - - + + + + - - - - - + + + + + - + @@ -883,19 +883,19 @@ - - - - + + + + - - - - - + + + + + - + @@ -973,134 +973,134 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - + - + - - - - + + + + - - - - - + + + + + - + - - - - + + + + - - + + - - - - - + + + + + @@ -1111,105 +1111,105 @@ - + - - - - + + + + - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + @@ -1220,225 +1220,225 @@ - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + - + - - - - - - - - - + + + + + + + + + - - - - - + + + + + - + - + - - - - + + + + - - - - - + + + + + - + - - - - - - - - - + + + + + + + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - + + + + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - - - + + + + + + + + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + - + - + - - + + - - - - - + + + + + @@ -1449,39 +1449,39 @@ - + - - - - - - - + + + + + + + - - - - - + + + + + - + - - - + + + - - + + - - - - - + + + + + @@ -1492,34 +1492,34 @@ - + - + - - - - - + + + + + - + - - - - + + + + - - + + - - - - - + + + + + @@ -1530,23 +1530,23 @@ - - + + - - - + + + - - + + - - - - - + + + + + @@ -1557,20 +1557,20 @@ - - + + - + - + - - - - - + + + + + @@ -1581,19 +1581,19 @@ - + - + - + - - - - - + + + + + @@ -1604,22 +1604,22 @@ - - + + - - - + + + - + - - - - - + + + + + @@ -1630,35 +1630,35 @@ - + - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + @@ -1669,37 +1669,37 @@ - - + + - + - + - - - - - + + + + + - - + + - - - + + + - + - - - - - + + + + + @@ -1710,20 +1710,20 @@ - - + + - + - + - - - - - + + + + + @@ -1734,36 +1734,36 @@ - - + + - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + @@ -1774,37 +1774,37 @@ - - + + - + - + - - - - - + + + + + - - + + - - - + + + - + - - - - - + + + + + @@ -1815,33 +1815,33 @@ - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -1852,20 +1852,20 @@ - - + + - + - + - - - - - + + + + + @@ -1876,21 +1876,21 @@ - + - - - + + + - + - - - - - + + + + + @@ -1901,21 +1901,21 @@ - + - - - + + + - + - - - - - + + + + + @@ -1926,24 +1926,24 @@ - + - - - + + + - - - - + + + + - - - - - + + + + + @@ -1954,37 +1954,37 @@ - - + + - + - + - - - - - + + + + + - - + + - - - + + + - + - - - - - + + + + + @@ -1995,19 +1995,19 @@ - + - + - + - - - - - + + + + + @@ -2018,22 +2018,22 @@ - - + + - - - + + + - + - - - - - + + + + + @@ -2044,16 +2044,16 @@ - + - + - - - - - + + + + + @@ -2064,7 +2064,7 @@ - + diff --git a/test/oldSchema/schema2/MinskyNonLinear.mky.svg b/test/oldSchema/schema2/MinskyNonLinear.mky.svg index 8cbbc4711..ad8ca9b55 100644 --- a/test/oldSchema/schema2/MinskyNonLinear.mky.svg +++ b/test/oldSchema/schema2/MinskyNonLinear.mky.svg @@ -1055,16 +1055,16 @@ - + - - - - - + + + + + - + @@ -1087,16 +1087,16 @@ - + - - - - - + + + + + - + @@ -1131,16 +1131,16 @@ - + - - - - - + + + + + - + @@ -1171,17 +1171,17 @@ - + - + - - - - - + + + + + @@ -1192,7 +1192,7 @@ - + @@ -1215,19 +1215,19 @@ - - - - + + + + - - - - - + + + + + - + @@ -1258,36 +1258,36 @@ - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -1298,38 +1298,38 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -1340,30 +1340,30 @@ - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -1374,71 +1374,71 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -1449,30 +1449,30 @@ - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -1483,19 +1483,19 @@ - + - + - + - - - - - + + + + + @@ -1506,30 +1506,30 @@ - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -1540,16 +1540,16 @@ - + - + - - - - - + + + + + @@ -1560,19 +1560,19 @@ - + - + - + - - - - - + + + + + @@ -1583,27 +1583,27 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -1614,71 +1614,71 @@ - - + + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -1689,16 +1689,16 @@ - + - + - - - - - + + + + + @@ -1709,58 +1709,58 @@ - - + + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -1771,105 +1771,105 @@ - + - - - - - - + + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + - - + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -1880,142 +1880,142 @@ - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -2026,7 +2026,7 @@ - + diff --git a/test/oldSchema/schema2/MinskyPricesFinal.mky.svg b/test/oldSchema/schema2/MinskyPricesFinal.mky.svg index 051a98d47..c49be581a 100644 --- a/test/oldSchema/schema2/MinskyPricesFinal.mky.svg +++ b/test/oldSchema/schema2/MinskyPricesFinal.mky.svg @@ -146,21 +146,18 @@ - - - - + - + - + - + @@ -1573,16 +1570,16 @@ - + - - - - - + + + + + - + @@ -1605,16 +1602,16 @@ - + - - - - - + + + + + - + @@ -1637,16 +1634,16 @@ - + - - - - - + + + + + - + @@ -1697,19 +1694,19 @@ - + - + - - - - - + + + + + - + @@ -1752,16 +1749,16 @@ - + - - - - - + + + + + - + @@ -1819,77 +1816,77 @@ - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + @@ -1900,307 +1897,307 @@ - + - - - - + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -2211,16 +2208,16 @@ - + - + - - - - - + + + + + @@ -2231,188 +2228,188 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + @@ -2423,21 +2420,21 @@ - + - - - + + + - + - - - - - + + + + + @@ -2448,21 +2445,21 @@ - + - - - + + + - + - - - - - + + + + + @@ -2473,58 +2470,58 @@ - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + @@ -2535,16 +2532,16 @@ - + - + - - - - - + + + + + @@ -2555,20 +2552,20 @@ - + - - + + - + - - - - - + + + + + @@ -2579,33 +2576,33 @@ - + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2616,16 +2613,16 @@ - + - + - - - - - + + + + + @@ -2636,19 +2633,19 @@ - + - + - + - - - - - + + + + + @@ -2659,19 +2656,19 @@ - + - + - + - - - - - + + + + + @@ -2682,19 +2679,19 @@ - + - + - + - - - - - + + + + + @@ -2705,35 +2702,35 @@ - + - + - - + + - - - - - + + + + + - + - + - - + + - - - - - + + + + + @@ -2744,27 +2741,27 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2775,32 +2772,32 @@ - + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -2811,19 +2808,19 @@ - + - + - + - - - - - + + + + + @@ -2834,27 +2831,27 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2865,16 +2862,16 @@ - + - + - - - - - + + + + + @@ -2885,16 +2882,16 @@ - + - + - - - - - + + + + + @@ -2905,7 +2902,7 @@ - + diff --git a/test/oldSchema/schema2/MonetaryMinskyNeoPrices.mky.svg b/test/oldSchema/schema2/MonetaryMinskyNeoPrices.mky.svg index 6541674af..7e88c1aae 100644 --- a/test/oldSchema/schema2/MonetaryMinskyNeoPrices.mky.svg +++ b/test/oldSchema/schema2/MonetaryMinskyNeoPrices.mky.svg @@ -143,19 +143,19 @@ - + - + - + - + - + @@ -1987,16 +1987,16 @@ - + - - - - - + + + + + - + @@ -2019,16 +2019,16 @@ - + - - - - - + + + + + - + @@ -2051,14 +2051,14 @@ - + - - - - - + + + + + @@ -2069,7 +2069,7 @@ - + @@ -2120,19 +2120,19 @@ - + - + - - - - - + + + + + - + @@ -2175,16 +2175,16 @@ - + - - - - - + + + + + - + @@ -2283,21 +2283,21 @@ - + - - - + + + - - - - - + + + + + - + @@ -2339,61 +2339,61 @@ - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2404,360 +2404,360 @@ - + - - - - - - + + + + + + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + - + - - - + + + - - + + - - - - - + + + + + - + - - - + + + - - + + - - - - - + + + + + - + - - - - + + + + - + - - - - - + + + + + - + - - - - + + + + - + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - + + + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2768,27 +2768,27 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2799,103 +2799,103 @@ - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - + - - - - - + + + + + @@ -2906,16 +2906,16 @@ - + - + - - - - - + + + + + @@ -2926,16 +2926,16 @@ - + - + - - - - - + + + + + @@ -2946,32 +2946,32 @@ - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + @@ -2982,21 +2982,21 @@ - + - - - + + + - + - - - - - + + + + + @@ -3007,60 +3007,60 @@ - + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - + + + - + - - - - - + + + + + @@ -3071,16 +3071,16 @@ - + - + - - - - - + + + + + @@ -3091,17 +3091,17 @@ - + - - + + - - - - - + + + + + @@ -3112,20 +3112,20 @@ - + - + - - + + - - - - - + + + + + @@ -3136,16 +3136,16 @@ - + - + - - - - - + + + + + @@ -3156,141 +3156,141 @@ - + - + - + - - - - - + + + + + - + - - - - + + + + - + - - - - - + + + + + - + - - - - + + + + - + - - - - - + + + + + - + - - - + + + - - - + + + - - - - - + + + + + - + - + - - - + + + - - - - - + + + + + - + - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - - + + + + + + - - - - - + + + + + - + - - - + + + - - + + - - - - - + + + + + @@ -3300,22 +3300,22 @@ - + - - - + + + - - + + - - - - - + + + + + @@ -3325,58 +3325,58 @@ - + - - - + + + - - - - - - + + + + + + - - - - - + + + + + - + - - - + + + - - - - - - + + + + + + - - - - - + + + + + - + - + - - - - - + + + + + @@ -3387,16 +3387,16 @@ - + - + - - - - - + + + + + @@ -3407,19 +3407,19 @@ - + - + - + - - - - - + + + + + @@ -3430,19 +3430,19 @@ - + - + - + - - - - - + + + + + @@ -3453,19 +3453,19 @@ - + - + - + - - - - - + + + + + @@ -3476,35 +3476,35 @@ - + - + - - + + - - - - - + + + + + - + - + - - + + - - - - - + + + + + @@ -3515,27 +3515,27 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -3546,32 +3546,32 @@ - + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + @@ -3582,19 +3582,19 @@ - + - + - + - - - - - + + + + + @@ -3605,27 +3605,27 @@ - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -3636,16 +3636,16 @@ - + - + - - - - - + + + + + @@ -3656,16 +3656,16 @@ - + - + - - - - - + + + + + @@ -3676,125 +3676,125 @@ - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + diff --git a/test/oldSchema/schema2/PredatorPrey.mky.svg b/test/oldSchema/schema2/PredatorPrey.mky.svg index 8d2417201..1f78254bc 100644 --- a/test/oldSchema/schema2/PredatorPrey.mky.svg +++ b/test/oldSchema/schema2/PredatorPrey.mky.svg @@ -256,23 +256,23 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + - + @@ -287,19 +287,19 @@ - - - - + + + + - - - - - + + + + + - + @@ -333,32 +333,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -369,48 +369,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -421,30 +421,30 @@ - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - + + + + + @@ -455,44 +455,44 @@ - + - - - - + + + + - - - - - + + + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - + + + + + @@ -503,271 +503,271 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -778,20 +778,20 @@ - + - - - - - + + + + + - - - - - + + + + + @@ -802,7 +802,7 @@ - + diff --git a/test/oldSchema/schema2/Solow.mky.svg b/test/oldSchema/schema2/Solow.mky.svg index 75fc0988d..fbfbb7924 100644 --- a/test/oldSchema/schema2/Solow.mky.svg +++ b/test/oldSchema/schema2/Solow.mky.svg @@ -410,39 +410,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -490,236 +490,236 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -730,36 +730,36 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -770,19 +770,19 @@ - + - - - - + + + + - - - - - + + + + + @@ -793,30 +793,30 @@ - + - + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + @@ -827,7 +827,7 @@ - + diff --git a/test/oldSchema/schema2/Steve.mky.svg b/test/oldSchema/schema2/Steve.mky.svg index b11fb40f2..bf9e0b93c 100644 --- a/test/oldSchema/schema2/Steve.mky.svg +++ b/test/oldSchema/schema2/Steve.mky.svg @@ -1127,164 +1127,164 @@ - - - - + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -1295,17 +1295,17 @@ - + - - + + - - - - - + + + + + @@ -1316,17 +1316,17 @@ - + - - + + - - - - - + + + + + @@ -1337,55 +1337,55 @@ - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + @@ -1396,7 +1396,7 @@ - + diff --git a/test/oldSchema/schema2/SteveTest028.mky.svg b/test/oldSchema/schema2/SteveTest028.mky.svg index 8e35b85f0..b06ab77e3 100644 --- a/test/oldSchema/schema2/SteveTest028.mky.svg +++ b/test/oldSchema/schema2/SteveTest028.mky.svg @@ -828,143 +828,143 @@ - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -975,19 +975,19 @@ - + - + - + - - - - - + + + + + @@ -998,31 +998,31 @@ - + - - + + - - - - - + + + + + - + - + - + - - - - - + + + + + @@ -1033,16 +1033,16 @@ - + - + - - - - - + + + + + @@ -1053,46 +1053,46 @@ - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - + - + - - - - - + + + + + - + diff --git a/test/oldSchema/schema2/UWS05.mky.svg b/test/oldSchema/schema2/UWS05.mky.svg index 2df182f21..7ab1538c5 100644 --- a/test/oldSchema/schema2/UWS05.mky.svg +++ b/test/oldSchema/schema2/UWS05.mky.svg @@ -930,145 +930,145 @@ - - - - - + + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + @@ -1079,17 +1079,17 @@ - + - - + + - - - - - + + + + + @@ -1100,42 +1100,42 @@ - + - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + diff --git a/test/oldSchema/schema2/data-example.mky.svg b/test/oldSchema/schema2/data-example.mky.svg index e05a0faae..f594c228b 100644 --- a/test/oldSchema/schema2/data-example.mky.svg +++ b/test/oldSchema/schema2/data-example.mky.svg @@ -158,16 +158,16 @@ - + - - - - - + + + + + - + diff --git a/test/oldSchema/schema2/dense.mky.svg b/test/oldSchema/schema2/dense.mky.svg index 828537bd8..77d01f416 100644 --- a/test/oldSchema/schema2/dense.mky.svg +++ b/test/oldSchema/schema2/dense.mky.svg @@ -47,13 +47,13 @@ - - - - - + + + + + - + diff --git a/test/oldSchema/schema2/exponentialGrowth.mky.svg b/test/oldSchema/schema2/exponentialGrowth.mky.svg index 91ed48b03..6aecf33ec 100644 --- a/test/oldSchema/schema2/exponentialGrowth.mky.svg +++ b/test/oldSchema/schema2/exponentialGrowth.mky.svg @@ -164,28 +164,28 @@ - + - - - - - + + + + + - + - - - - - + + + + + - + diff --git a/test/oldSchema/schema2/exponentialGrowthWithExtraLabel.mky.svg b/test/oldSchema/schema2/exponentialGrowthWithExtraLabel.mky.svg index 263cfd172..7619ba24b 100644 --- a/test/oldSchema/schema2/exponentialGrowthWithExtraLabel.mky.svg +++ b/test/oldSchema/schema2/exponentialGrowthWithExtraLabel.mky.svg @@ -175,41 +175,41 @@ - + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - + - - - - - + + + + + @@ -220,7 +220,7 @@ - + diff --git a/test/oldSchema/schema2/indexing.mky.svg b/test/oldSchema/schema2/indexing.mky.svg index a770b3bc3..b73d964ae 100644 --- a/test/oldSchema/schema2/indexing.mky.svg +++ b/test/oldSchema/schema2/indexing.mky.svg @@ -271,15 +271,15 @@ - - - - - - - - - + + + + + + + + + @@ -438,15 +438,15 @@ - - + + - - - - - + + + + + @@ -457,17 +457,17 @@ - + - - + + - - - - - + + + + + @@ -478,31 +478,31 @@ - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + diff --git a/test/oldSchema/schema2/math-examples.mky.svg b/test/oldSchema/schema2/math-examples.mky.svg index fcbcde4b0..017140649 100644 --- a/test/oldSchema/schema2/math-examples.mky.svg +++ b/test/oldSchema/schema2/math-examples.mky.svg @@ -118,158 +118,158 @@ - + - - + + - - - - - + + + + + - + - + - + - - + + - - + + - + - - + + - - - - - + + + + + - + - + - + - - - - - + + + + + - + - - - - - - - - - + + + + + + + + + - + - - - - - + + + + + - + - + - - + + - - - - - + + + + + - + - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + + - + - - - - - - - - + + + + + + + + - - - - - + + + + + - + - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + + - + diff --git a/test/oldSchema/schema2/reductionExample.mky.svg b/test/oldSchema/schema2/reductionExample.mky.svg index b2ddc5657..f29cb4650 100644 --- a/test/oldSchema/schema2/reductionExample.mky.svg +++ b/test/oldSchema/schema2/reductionExample.mky.svg @@ -307,15 +307,15 @@ - - - - - - - - - + + + + + + + + + @@ -532,16 +532,16 @@ - + - - - - - + + + + + - + diff --git a/test/oldSchema/schema2/switchBlock.mky.svg b/test/oldSchema/schema2/switchBlock.mky.svg index 230e0e871..55f97695d 100644 --- a/test/oldSchema/schema2/switchBlock.mky.svg +++ b/test/oldSchema/schema2/switchBlock.mky.svg @@ -191,60 +191,60 @@ - - - - + + + + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + diff --git a/test/testLock.cc b/test/testLock.cc index f46b18182..ad08292a0 100644 --- a/test/testLock.cc +++ b/test/testLock.cc @@ -17,6 +17,7 @@ along with Minsky. If not, see . */ +#include "cairoShimCairo.h" #include "lock.h" #include "minsky.h" #include "minsky_epilogue.h" @@ -154,6 +155,6 @@ TEST_F(LockTest, Draw) // Test that lock can be drawn (uses different icons for locked/unlocked) cairo::Surface surf(cairo_recording_surface_create(CAIRO_CONTENT_COLOR, nullptr)); - EXPECT_NO_THROW(lock.draw(surf.cairo())); + EXPECT_NO_THROW(lock.draw(CairoShimCairo(surf.cairo()))); } diff --git a/test/testModel.cc b/test/testModel.cc index fc441b25b..30f8230da 100644 --- a/test/testModel.cc +++ b/test/testModel.cc @@ -18,6 +18,7 @@ */ #include "cairoItems.h" +#include "cairoShimCairo.h" #include "operation.h" #include "group.h" #include "minsky.h" @@ -112,6 +113,14 @@ namespace }; class GodleyIconFixture: public GodleyIcon, public ::testing::Test {}; class GroupFixture: public Group, public ::testing::Test {}; + + struct RecordingCairoShim: public cairo::Surface, public CairoShimCairo + { + RecordingCairoShim(): + cairo::Surface(cairo_recording_surface_create(CAIRO_CONTENT_COLOR,nullptr)), + CairoShimCairo(cairo::Surface::cairo()) {} + }; + } @@ -462,8 +471,7 @@ TEST_F(CanvasFixture,findVariableDefinition) TEST_F(ModelSuite,moveItem) { - cairo::Surface surf(cairo_recording_surface_create(CAIRO_CONTENT_COLOR,nullptr)); - c->draw(surf.cairo());// reposition ports + c->draw(RecordingCairoShim());// reposition ports EXPECT_TRUE(c->clickType(c->x(),c->y()) == ClickType::onItem); canvas.mouseDown(c->x(),c->y()); canvas.mouseUp(400,500); @@ -475,8 +483,7 @@ TEST_F(ModelSuite,resizeVariable) { c->moveTo(400,300); c->updateBoundingBox(); - cairo::Surface surf(cairo_recording_surface_create(CAIRO_CONTENT_COLOR,nullptr)); - c->draw(surf.cairo());// reposition ports + c->draw(RecordingCairoShim());// reposition ports float xc=c->right(), yc=c->bottom(); EXPECT_TRUE(c->clickType(xc,yc) == ClickType::onResize); canvas.mouseDown(xc,yc); @@ -490,8 +497,7 @@ TEST_F(ModelSuite,resizeOperation) OperationPtr add(OperationType::add); model->addItem(add); add->moveTo(400,300); - cairo::Surface surf(cairo_recording_surface_create(CAIRO_CONTENT_COLOR,nullptr)); - add->draw(surf.cairo());// reposition ports + add->draw(RecordingCairoShim());// reposition ports float xc=add->right(), yc=add->bottom(); EXPECT_TRUE(add->clickType(xc,yc) == ClickType::onResize); canvas.mouseDown(xc,yc);