Minsky
sheet.h
Go to the documentation of this file.
1 /*
2  @copyright Steve Keen 2018
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 
24 #ifndef SHEET_H
25 #define SHEET_H
26 #include <itemT.h>
27 #include "dynamicRavelCAPI.h"
28 #include "showSlice.h"
29 
30 namespace minsky
31 {
32  class Sheet: public ItemT<Sheet>
33  {
34 
36  ravel::Ravel inputRavel;
40  double ravelSize() const;
42  double ravelX(double xx) const;
43  double ravelY(double yy) const;
44 
46  size_t scrollOffset=0, scrollMax=1;
47  size_t scrollDelta=0;
48  std::string sliceIndicator;
49  public:
50  Sheet();
51 
52  // copy operations needed for clone, but not really used for now
53  // define them as empty operations to prevent double frees if accidentally used
54  void operator=(const Sheet&){}
55  Sheet(const Sheet&) {}
56 
57  bool onResizeHandle(float x, float y) const override;
58  void drawResizeHandles(cairo_t* cairo) const override;
59 
60  bool onRavelButton(float, float) const;
61  bool inRavel(float, float) const;
62  bool inItem(float, float) const override;
63  ClickType::Type clickType(float x, float y) const override;
64  std::vector<Point> corners() const override;
65  bool contains(float x, float y) const override;
66 
67  bool scrollUp();
68  bool scrollDown();
69  bool onKeyPress(int keySym, const std::string& utf8, int state) override;
70  void setSliceIndicator();
71 
72  void draw(cairo_t* cairo) const override;
73 
75  void computeValue();
76 
79  void exportAsCSV(const std::string& filename, bool tabular) const;
80 
81  bool showRavel=false;
84  };
85 }
86 
87 #include "sheet.cd"
88 #include "sheet.xcd"
89 #endif
ravel::Ravel inputRavel
ravel for controlling input value used for populating sheet. Potentially a tensor expression represen...
Definition: sheet.h:36
bool inItem(float, float) const override
offset for scrolling through higher ranked inputs
Definition: sheet.cc:104
bool showRavel
offset for scrolling through higher ranked inputs
Definition: sheet.h:81
bool inRavel(float, float) const
offset for scrolling through higher ranked inputs
Definition: sheet.cc:96
void exportAsCSV(const std::string &filename, bool tabular) const
export the plotted data as a CSV file
Definition: sheet.cc:522
void operator=(const Sheet &)
offset for scrolling through higher ranked inputs
Definition: sheet.h:54
bool onKeyPress(int keySym, const std::string &utf8, int state) override
offset for scrolling through higher ranked inputs
Definition: sheet.cc:155
virtual double value() const
current value of output port
Definition: item.h:209
size_t scrollDelta
offset for scrolling through higher ranked inputs
Definition: sheet.h:47
virtual float x() const
Definition: item.cc:107
Sheet(const Sheet &)
offset for scrolling through higher ranked inputs
Definition: sheet.h:55
std::string sliceIndicator
offset for scrolling through higher ranked inputs
Definition: sheet.h:48
virtual float y() const
Definition: item.cc:114
double ravelX(double xx) const
ravel coordinate from screen coordinate
Definition: sheet.cc:56
double ravelSize() const
size of ravel in screen coordinates
Definition: sheet.cc:51
Sheet()
offset for scrolling through higher ranked inputs
Definition: sheet.cc:44
ShowSlice
Definition: showSlice.h:25
size_t scrollOffset
offset for scrolling through higher ranked inputs
Definition: sheet.h:46
size_t scrollMax
offset for scrolling through higher ranked inputs
Definition: sheet.h:46
void computeValue()
calculates the input value
Definition: sheet.cc:222
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky&#39;s state cha...
Definition: constMap.h:22
std::vector< Point > corners() const override
offset for scrolling through higher ranked inputs
Definition: sheet.cc:122
ShowSlice showRowSlice
whether to elide rows from beginning, end or middle
Definition: sheet.h:82
ClickType::Type clickType(float x, float y) const override
offset for scrolling through higher ranked inputs
Definition: sheet.cc:111
bool onRavelButton(float, float) const
offset for scrolling through higher ranked inputs
Definition: sheet.cc:89
double ravelY(double yy) const
offset for scrolling through higher ranked inputs
Definition: sheet.cc:61
ShowSlice showColSlice
whether to elide columnss from beginning, end or middle
Definition: sheet.h:83
std::shared_ptr< ITensor > TensorPtr
void drawResizeHandles(cairo_t *cairo) const override
offset for scrolling through higher ranked inputs
Definition: sheet.cc:76
bool onResizeHandle(float x, float y) const override
offset for scrolling through higher ranked inputs
Definition: sheet.cc:66
void setSliceIndicator()
offset for scrolling through higher ranked inputs
Definition: sheet.cc:175
void draw(cairo_t *cairo) const override
offset for scrolling through higher ranked inputs
Definition: sheet.cc:293
CLASSDESC_ACCESS(Sheet)
bool scrollUp()
offset for scrolling through higher ranked inputs
Definition: sheet.cc:133
bool contains(float x, float y) const override
offset for scrolling through higher ranked inputs
Definition: sheet.cc:128
bool scrollDown()
offset for scrolling through higher ranked inputs
Definition: sheet.cc:144