Minsky
equationDisplay.cc
Go to the documentation of this file.
1 /*
2  @copyright Steve Keen 2023
3  @author Russell Standish
4  This file is part of Minsky.
5 
6  Minsky is free software: you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Minsky is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Minsky. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "cairoItems.h"
21 #include "equationDisplay.h"
22 #include "equationDisplay.rcd"
23 #include "equationDisplay.xcd"
24 
25 #include "equations.h"
26 #include "minsky.h"
27 #include "progress.h"
28 
29 #include "item.rcd"
30 #include "minsky_epilogue.h"
31 
32 namespace minsky
33 {
34  bool EquationDisplay::redraw(int x0, int y0, int width, int height)
35  {
36  if (surface.get()) {
37  const BusyCursor busy(m);
38  const MathDAG::SystemOfEquations system(m);
39  cairo_rectangle(surface->cairo(),0,0,width,height);
40  cairo_clip(surface->cairo());
41  cairo_move_to(surface->cairo(),offsx,offsy);
42  cairo_scale(surface->cairo(),m_zoomFactor,m_zoomFactor);
43  system.renderEquations(*surface,height);
44  if (m.flags & Minsky::fullEqnDisplay_needed)
45  {
46  ecolab::cairo::Surface surf
47  (cairo_recording_surface_create(CAIRO_CONTENT_COLOR_ALPHA,NULL));
48  system.renderEquations(surf,std::numeric_limits<double>::max());
49  m_width=surf.width();
50  m_height=surf.height();
51  m.flags &= ~Minsky::fullEqnDisplay_needed;
52  }
53  return true;
54  }
55  return surface.get();
56  }
57 }
58 
bool redraw(int x0, int y0, int width, int height) override
CLASSDESC_ACCESS_EXPLICIT_INSTANTIATION(minsky::EquationDisplay)
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky&#39;s state cha...
Definition: constMap.h:22
void renderEquations(ecolab::cairo::Surface &, double height) const
render equations into a cairo context