Minsky
|
#include <godleyTableWindow.h>
Public Types | |
enum | ClickType { background, row0, col0, internal, importStock, rowWidget, colWidget } |
![]() | |
enum | RowCol { row, col } |
enum | Pos { first, second, middle, last, firstAndLast } |
![]() | |
enum | AssetClass { noAssetClass, asset, liability, equity } |
enum | DisplayStyle { DRCR, sign } |
Public Member Functions | |
GodleyIcon & | godleyIcon () |
const GodleyIcon & | godleyIcon () const |
void | disableButtons () |
void | enableButtons () |
bool | selectedCellInTable () const |
GodleyTableEditor (GodleyIcon &g) | |
void | draw (cairo_t *cairo) |
double | width () const |
double | height () const |
void | mouseDown (double x, double y) |
event handling More... | |
void | mouseUp (double x, double y) |
void | mouseMoveB1 (double x, double y) |
mouse motion with button 1 pressed More... | |
void | mouseMove (double x, double y) |
void | keyPress (int keySym, const std::string &utf8) |
ClickType | clickTypeZoomed (double x, double y) const |
returns the clickType in zoomed coordinates More... | |
void | addStockVar (double x) |
add/delete rows/columns at x,y More... | |
void | addStockVarByCol (int c) |
void | importStockVar (const std::string &name, double x) |
void | importStockVarByCol (const std::string &name, int c) |
void | deleteStockVar (double x) |
void | deleteStockVarByCol (int c) |
void | addFlow (double y) |
void | addFlowByRow (int r) |
void | deleteFlow (double y) |
void | deleteFlowByRow (int r) |
int | colXZoomed (double x) const |
int | rowYZoomed (double y) const |
std::string | moveAssetClass (double x, double y) |
std::string | swapAssetClass (double x, double y) |
void | highlightColumn (cairo_t *cairo, unsigned col) |
void | highlightRow (cairo_t *cairo, unsigned row) |
void | highlightCell (cairo_t *cairo, unsigned row, unsigned col) |
void | delSelection () |
void | cut () |
void | copy () |
void | paste () |
int | textIdx (double x) const |
void | pushHistory () |
void | undo (int changes) |
restore to state changes ago More... | |
void | adjustWidgets () |
ensure button widgets are synced with current table data More... | |
void | update () |
update canvas godleyIcon, and any related godley icons. Can throw More... | |
ClickType | clickType (double x, double y) const |
std::set< string > | matchingTableColumns (double x) |
return list of matching table columns for column at x More... | |
std::set< string > | matchingTableColumnsByCol (int c) |
void | navigateRight () |
move selected cell right, left, up or down, moving to next line and wrapping if at end of row or col More... | |
void | navigateLeft () |
move selected cell right, left, up or down, moving to next line and wrapping if at end of row or col More... | |
void | navigateUp () |
move selected cell right, left, up or down, moving to next line and wrapping if at end of row or col More... | |
void | navigateDown () |
move selected cell right, left, up or down, moving to next line and wrapping if at end of row or col More... | |
Public Attributes | |
double | leftTableOffset =4*ButtonWidget<col>::buttonSpacing |
offset of the table within the window More... | |
double | topTableOffset =30 |
bool | drawButtons =true |
whether to draw row/column buttons More... | |
unsigned | scrollRowStart =1 |
starting row/col number of the scrolling region More... | |
unsigned | scrollColStart =1 |
int | selectedRow =-1 |
which cell is active, none initially More... | |
int | selectedCol =-1 |
int | srcRow =-1 |
src cell in the event of a move More... | |
int | srcCol =-1 |
int | hoverRow =-1 |
int | hoverCol =-1 |
std::vector< double > | colLeftMargin |
computed positions of the table columns More... | |
double | rowHeight =0 |
computed height of each row More... | |
unsigned | insertIdx =0 |
location of insertion pointer in selected cell, as well as other end of selection (if mouse-swiped) More... | |
unsigned | selectIdx =0 |
double | zoomFactor =1 |
zoom the display More... | |
std::size_t | maxHistory {100} |
maximum no. of history states to save More... | |
std::size_t | historyPtr =0 |
Static Public Attributes | |
static constexpr double | columnButtonsOffset =12 |
static constexpr double | pulldownHot =12 |
space for ▼ in stackVar cells minimum column width (for eg empty columns) More... | |
static constexpr double | minColumnWidth =4*ButtonWidget<col>::buttonSpacing |
Protected Member Functions | |
int | colX (double x) const |
column at x in unzoomed coordinates More... | |
int | rowY (double y) const |
row at y in unzoomed coordinates More... | |
void | checkCell00 () |
check if cell (0,0) is selected, and deselect if so handle delete or backspace. Cell assumed selected More... | |
void | handleBackspace () |
void | handleDelete () |
virtual void | requestRedrawCanvas () |
Protected Attributes | |
std::vector< ButtonWidget< row > > | rowWidgets |
std::vector< ButtonWidget< col > > | colWidgets |
int | motionRow =-1 |
int | motionCol =-1 |
current cell under mouse motion More... | |
std::deque< GodleyTable > | history |
Private Member Functions | |
CLASSDESC_ACCESS (GodleyTableEditor) | |
void | m_enableButtons () |
Private Attributes | |
GodleyIcon & | m_godleyIcon |
Godley icon that owns this. More... | |
bool | button1 =false |
mouse button pressed More... | |
Definition at line 77 of file godleyTableWindow.h.
Enumerator | |
---|---|
background | |
row0 | |
col0 | |
internal | |
importStock | |
rowWidget | |
colWidget |
Definition at line 136 of file godleyTableWindow.h.
|
inline |
Definition at line 120 of file godleyTableWindow.h.
References adjustWidgets(), and m_enableButtons().
void minsky::GodleyTableEditor::addFlow | ( | double | y | ) |
Definition at line 891 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::addFlowByRow | ( | int | r | ) |
Definition at line 897 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::addStockVar | ( | double | x | ) |
add/delete rows/columns at x,y
Definition at line 851 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::addStockVarByCol | ( | int | c | ) |
Definition at line 857 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::adjustWidgets | ( | ) |
ensure button widgets are synced with current table data
Definition at line 1037 of file godleyTableWindow.cc.
Referenced by minsky::GodleyIcon::adjustPopupWidgets(), minsky::GodleyIcon::GodleyIcon(), GodleyTableEditor(), and m_enableButtons().
|
protected |
check if cell (0,0) is selected, and deselect if so handle delete or backspace. Cell assumed selected
Definition at line 1110 of file godleyTableWindow.cc.
|
private |
GodleyTableEditor::ClickType minsky::GodleyTableEditor::clickType | ( | double | x, |
double | y | ||
) | const |
Definition at line 814 of file godleyTableWindow.cc.
Referenced by clickTypeZoomed().
|
inline |
returns the clickType in zoomed coordinates
Definition at line 138 of file godleyTableWindow.h.
References clickType(), and zoomFactor.
|
protected |
column at x in unzoomed coordinates
Definition at line 443 of file godleyTableWindow.cc.
Referenced by colXZoomed().
|
inline |
Definition at line 153 of file godleyTableWindow.h.
References colX(), and zoomFactor.
void minsky::GodleyTableEditor::copy | ( | ) |
Definition at line 788 of file godleyTableWindow.cc.
References minsky::cminsky(), and minsky::str().
void minsky::GodleyTableEditor::cut | ( | ) |
Definition at line 776 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::deleteFlow | ( | double | y | ) |
Definition at line 903 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::deleteFlowByRow | ( | int | r | ) |
Definition at line 909 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::deleteStockVar | ( | double | x | ) |
Definition at line 879 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::deleteStockVarByCol | ( | int | c | ) |
Definition at line 885 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::delSelection | ( | ) |
Definition at line 739 of file godleyTableWindow.cc.
References minsky::str().
|
inline |
Definition at line 100 of file godleyTableWindow.h.
References drawButtons, leftTableOffset, requestRedrawCanvas(), and topTableOffset.
Referenced by minsky::GodleyIcon::GodleyIcon().
void minsky::GodleyTableEditor::draw | ( | cairo_t * | cairo | ) |
Definition at line 156 of file godleyTableWindow.cc.
References anonymous_namespace{godleyTableWindow.cc}::capitalise(), minsky::cminsky(), minsky::FlowCoef::coef, minsky::defang(), minsky::Minsky::displayValues, minsky::engExp(), minsky::expMultiplier(), minsky::latexToPango(), minsky::mantissa(), minsky::FlowCoef::name, anonymous_namespace{godleyTableWindow.cc}::showAsset(), minsky::FlowCoef::str(), minsky::valueId(), and minsky::Minsky::variableValues.
|
inline |
Definition at line 101 of file godleyTableWindow.h.
References m_enableButtons(), and requestRedrawCanvas().
|
inline |
Definition at line 96 of file godleyTableWindow.h.
References m_godleyIcon.
|
inline |
Definition at line 97 of file godleyTableWindow.h.
References m_godleyIcon.
|
protected |
Definition at line 749 of file godleyTableWindow.cc.
References minsky::numBytes(), minsky::prevIndex(), and minsky::str().
|
protected |
Definition at line 764 of file godleyTableWindow.cc.
References minsky::numBytes(), and minsky::str().
double minsky::GodleyTableEditor::height | ( | ) | const |
Definition at line 438 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::highlightCell | ( | cairo_t * | cairo, |
unsigned | row, | ||
unsigned | col | ||
) |
Definition at line 1002 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::highlightColumn | ( | cairo_t * | cairo, |
unsigned | col | ||
) |
Definition at line 982 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::highlightRow | ( | cairo_t * | cairo, |
unsigned | row | ||
) |
Definition at line 993 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::importStockVar | ( | const std::string & | name, |
double | x | ||
) |
Definition at line 862 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::importStockVarByCol | ( | const std::string & | name, |
int | c | ||
) |
Definition at line 868 of file godleyTableWindow.cc.
References minsky::Minsky::importDuplicateColumn(), and pyminsky::minsky.
void minsky::GodleyTableEditor::keyPress | ( | int | keySym, |
const std::string & | utf8 | ||
) |
Definition at line 633 of file godleyTableWindow.cc.
References minsky::control(), cut(), minsky::numBytes(), minsky::prevIndex(), and minsky::str().
Referenced by minsky::GodleyTableWindow::keyPress().
|
inlineprivate |
Definition at line 83 of file godleyTableWindow.h.
References adjustWidgets(), drawButtons, leftTableOffset, and topTableOffset.
Referenced by enableButtons(), and GodleyTableEditor().
std::set< string > minsky::GodleyTableEditor::matchingTableColumns | ( | double | x | ) |
return list of matching table columns for column at x
Definition at line 839 of file godleyTableWindow.cc.
std::set< string > minsky::GodleyTableEditor::matchingTableColumnsByCol | ( | int | c | ) |
Definition at line 845 of file godleyTableWindow.cc.
References minsky::Minsky::matchingTableColumns(), and pyminsky::minsky.
void minsky::GodleyTableEditor::mouseDown | ( | double | x, |
double | y | ||
) |
event handling
Definition at line 485 of file godleyTableWindow.cc.
References minsky::str().
Referenced by minsky::GodleyTableWindow::mouseDown().
void minsky::GodleyTableEditor::mouseMove | ( | double | x, |
double | y | ||
) |
Definition at line 589 of file godleyTableWindow.cc.
Referenced by minsky::GodleyTableWindow::mouseMove().
void minsky::GodleyTableEditor::mouseMoveB1 | ( | double | x, |
double | y | ||
) |
mouse motion with button 1 pressed
Definition at line 579 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::mouseUp | ( | double | x, |
double | y | ||
) |
Definition at line 545 of file godleyTableWindow.cc.
References minsky::Minsky::balanceDuplicateColumns(), and pyminsky::minsky.
Referenced by minsky::GodleyTableWindow::mouseUp().
string minsky::GodleyTableEditor::moveAssetClass | ( | double | x, |
double | y | ||
) |
Definition at line 923 of file godleyTableWindow.cc.
References minsky::anonymous_namespace{godleyTableWindow.cc}::constructMessage().
void minsky::GodleyTableEditor::navigateDown | ( | ) |
move selected cell right, left, up or down, moving to next line and wrapping if at end of row or col
Definition at line 1162 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::navigateLeft | ( | ) |
move selected cell right, left, up or down, moving to next line and wrapping if at end of row or col
Definition at line 1137 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::navigateRight | ( | ) |
move selected cell right, left, up or down, moving to next line and wrapping if at end of row or col
Definition at line 1120 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::navigateUp | ( | ) |
move selected cell right, left, up or down, moving to next line and wrapping if at end of row or col
Definition at line 1154 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::paste | ( | ) |
Definition at line 799 of file godleyTableWindow.cc.
References minsky::cminsky(), and minsky::str().
void minsky::GodleyTableEditor::pushHistory | ( | ) |
Definition at line 1013 of file godleyTableWindow.cc.
|
inlineprotectedvirtual |
Reimplemented in minsky::GodleyTableWindow.
Definition at line 213 of file godleyTableWindow.h.
Referenced by disableButtons(), and enableButtons().
|
protected |
row at y in unzoomed coordinates
Definition at line 453 of file godleyTableWindow.cc.
Referenced by rowYZoomed().
|
inline |
Definition at line 154 of file godleyTableWindow.h.
References rowY(), and zoomFactor.
bool minsky::GodleyTableEditor::selectedCellInTable | ( | ) | const |
Definition at line 151 of file godleyTableWindow.cc.
string minsky::GodleyTableEditor::swapAssetClass | ( | double | x, |
double | y | ||
) |
Definition at line 959 of file godleyTableWindow.cc.
References minsky::anonymous_namespace{godleyTableWindow.cc}::constructMessage().
int minsky::GodleyTableEditor::textIdx | ( | double | x | ) | const |
Definition at line 461 of file godleyTableWindow.cc.
References minsky::defang(), minsky::numBytes(), and minsky::str().
void minsky::GodleyTableEditor::undo | ( | int | changes | ) |
restore to state changes ago
Definition at line 1023 of file godleyTableWindow.cc.
void minsky::GodleyTableEditor::update | ( | ) |
update canvas godleyIcon, and any related godley icons. Can throw
Definition at line 1069 of file godleyTableWindow.cc.
References minsky::Minsky::balanceDuplicateColumns(), minsky::Minsky::canvas, minsky::Minsky::importDuplicateColumn(), minsky::Canvas::item, pyminsky::minsky, minsky::Minsky::model, minsky::Minsky::redrawAllGodleyTables(), minsky::Canvas::renameAllInstances(), and minsky::Canvas::requestRedraw().
|
inline |
Definition at line 125 of file godleyTableWindow.h.
References colLeftMargin.
|
private |
mouse button pressed
Definition at line 82 of file godleyTableWindow.h.
std::vector<double> minsky::GodleyTableEditor::colLeftMargin |
computed positions of the table columns
Definition at line 112 of file godleyTableWindow.h.
Referenced by width().
|
static |
Definition at line 88 of file godleyTableWindow.h.
|
protected |
Definition at line 201 of file godleyTableWindow.h.
bool minsky::GodleyTableEditor::drawButtons =true |
whether to draw row/column buttons
Definition at line 99 of file godleyTableWindow.h.
Referenced by disableButtons(), and m_enableButtons().
|
protected |
Definition at line 208 of file godleyTableWindow.h.
std::size_t minsky::GodleyTableEditor::historyPtr =0 |
Definition at line 174 of file godleyTableWindow.h.
int minsky::GodleyTableEditor::hoverCol =-1 |
Definition at line 110 of file godleyTableWindow.h.
int minsky::GodleyTableEditor::hoverRow =-1 |
Definition at line 110 of file godleyTableWindow.h.
unsigned minsky::GodleyTableEditor::insertIdx =0 |
location of insertion pointer in selected cell, as well as other end of selection (if mouse-swiped)
Definition at line 117 of file godleyTableWindow.h.
double minsky::GodleyTableEditor::leftTableOffset =4*ButtonWidget<col>::buttonSpacing |
offset of the table within the window
Definition at line 90 of file godleyTableWindow.h.
Referenced by disableButtons(), and m_enableButtons().
|
private |
Godley icon that owns this.
Definition at line 81 of file godleyTableWindow.h.
Referenced by godleyIcon().
std::size_t minsky::GodleyTableEditor::maxHistory {100} |
maximum no. of history states to save
Definition at line 173 of file godleyTableWindow.h.
|
static |
Definition at line 94 of file godleyTableWindow.h.
|
protected |
current cell under mouse motion
Definition at line 206 of file godleyTableWindow.h.
|
protected |
Definition at line 206 of file godleyTableWindow.h.
|
static |
space for ▼ in stackVar cells minimum column width (for eg empty columns)
Definition at line 92 of file godleyTableWindow.h.
double minsky::GodleyTableEditor::rowHeight =0 |
computed height of each row
Definition at line 114 of file godleyTableWindow.h.
|
protected |
Definition at line 200 of file godleyTableWindow.h.
unsigned minsky::GodleyTableEditor::scrollColStart =1 |
Definition at line 104 of file godleyTableWindow.h.
unsigned minsky::GodleyTableEditor::scrollRowStart =1 |
starting row/col number of the scrolling region
Definition at line 104 of file godleyTableWindow.h.
int minsky::GodleyTableEditor::selectedCol =-1 |
Definition at line 106 of file godleyTableWindow.h.
int minsky::GodleyTableEditor::selectedRow =-1 |
which cell is active, none initially
Definition at line 106 of file godleyTableWindow.h.
unsigned minsky::GodleyTableEditor::selectIdx =0 |
Definition at line 117 of file godleyTableWindow.h.
int minsky::GodleyTableEditor::srcCol =-1 |
Definition at line 108 of file godleyTableWindow.h.
int minsky::GodleyTableEditor::srcRow =-1 |
src cell in the event of a move
Definition at line 108 of file godleyTableWindow.h.
double minsky::GodleyTableEditor::topTableOffset =30 |
Definition at line 91 of file godleyTableWindow.h.
Referenced by disableButtons(), and m_enableButtons().
double minsky::GodleyTableEditor::zoomFactor =1 |
zoom the display
Definition at line 118 of file godleyTableWindow.h.
Referenced by clickTypeZoomed(), colXZoomed(), rowYZoomed(), minsky::GodleyTableWindow::zoom(), and minsky::GodleyTableWindow::zoomFactor().