22#include "../../kernel/core/ui/language.hpp"
23#include "../../kernel/core/utils/tools.hpp"
24#include "../../kernel/core/datamanagement/tablecolumn.hpp"
25#include "../../kernel/core/io/file.hpp"
26#include <wx/clipbrd.h>
27#include <wx/dataobj.h>
28#include <wx/tokenzr.h>
34#define STATUSBAR_PRECISION 5
35#define MAXIMAL_RENDERING_SIZE 5000
67 : wxGrid(parent,
id, pos, size, style,
name), nHeight(600), nWidth(800), nFirstNumRow(1), readOnly(true)
70 SetDefaultCellAlignment(wxALIGN_RIGHT, wxALIGN_CENTER);
74 m_popUpMenu.Append(ID_MENU_CVS,
_guilang.
get(
"GUI_TABLE_CVS"));
75 m_popUpMenu.AppendSeparator();
79 m_statusBar = statusbar;
80 m_parentPanel = parentPanel;
82 isGridNumeReTable =
false;
86 int widths[3] = {120, 120, -1};
87 m_statusBar->SetStatusWidths(3, widths);
114 for (
int j = 0; j < GetNumberCols(); j++)
118 wxGridCellAttr* attr =
nullptr;
122 attr =
new wxGridCellAttr(*wxBLACK, *wxWHITE, this->GetDefaultCellFont(),
123 wxALIGN_LEFT, wxALIGN_CENTER);
128 attr =
new wxGridCellAttr(*wxBLACK, *wxWHITE, this->GetDefaultCellFont(),
129 wxALIGN_CENTER, wxALIGN_CENTER);
134 attr =
new wxGridCellAttr(*wxBLACK, *wxWHITE, this->GetDefaultCellFont(),
135 wxALIGN_CENTER, wxALIGN_CENTER);
140 attr =
new wxGridCellAttr(*wxBLACK, *wxWHITE, this->GetDefaultCellFont(),
141 wxALIGN_RIGHT, wxALIGN_CENTER);
155 for (
int i = 0; i < GetNumberRows(); i++)
157 for (
int j = 0; j < GetNumberCols(); j++)
159 if (i >= (
int)
nFirstNumRow && GetCellValue(i, j)[0] ==
'"')
160 SetCellAlignment(wxALIGN_LEFT, i, j);
170 int nColSize = GetColSize(0);
172 nHeight = GetRowHeight(0) * (GetNumberRows()+3.5);
173 nWidth = nColSize*(GetNumberCols()+1.5);
200 if (event.GetKeyCode() == WXK_ESCAPE)
202 else if (event.GetKeyCode() == WXK_UP)
203 this->MoveCursorUp(
false);
204 else if (event.GetKeyCode() == WXK_DOWN)
205 this->MoveCursorDown(
false);
206 else if (event.GetKeyCode() == WXK_RETURN)
207 this->MoveCursorDown(
false);
208 else if (event.GetKeyCode() == WXK_LEFT)
209 this->MoveCursorLeft(
false);
210 else if (event.GetKeyCode() == WXK_RIGHT)
211 this->MoveCursorRight(
false);
212 else if (event.GetKeyCode() == WXK_TAB)
213 this->MoveCursorRight(
false);
214 else if (event.GetKeyCode() == WXK_DELETE)
219 else if (event.ControlDown() && event.ShiftDown())
221 if (event.GetKeyCode() ==
'C')
223 else if (event.GetKeyCode() ==
'V')
246 if (this->GetCursorColumn()+1 == this->GetCols())
253 if (this->GetCursorRow()+1 == this->GetRows())
291 SetCellValue(event.GetRow(), event.GetCol(), event.GetString());
310 wxGridCellCoords coords(event.GetRow(), event.GetCol());
328 if (event.Selecting())
330 if (event.GetTopLeftCoords() == wxGridCellCoords(0, 0)
331 && event.GetBottomRightCoords() == wxGridCellCoords(GetRows()-1, GetCols()-1))
338 for (
int i = event.GetTopLeftCoords().GetRow(); i <= event.GetBottomRightCoords().GetRow(); i++)
340 for (
int j = event.GetTopLeftCoords().GetCol(); j <= event.GetBottomRightCoords().GetCol(); j++)
350 for (
int i = event.GetTopLeftCoords().GetRow(); i <= event.GetBottomRightCoords().GetRow(); i++)
352 for (
int j = event.GetTopLeftCoords().GetCol(); j <= event.GetBottomRightCoords().GetCol(); j++)
377 if (event.GetCol() >= 0)
378 AutoSizeColumn(event.GetCol());
392 for (
int i = this->GetRows()-1; i >= 0; i--)
394 if (GetCellValue(i, nCol).length() && GetCellValue(i, nCol) !=
"---")
412 wxFont font = this->GetCellFont(0,0);
413 font.SetWeight(wxFONTWEIGHT_NORMAL);
419 for (
int i = 0; i < this->GetRows(); i++)
421 for (
int j = 0; j < this->GetCols(); j++)
423 if (i+1 == this->GetRows() || j+1 == this->GetCols())
431 SetCellFont(i, j, this->GetCellFont(i, j).MakeBold());
433 SetCellAlignment(wxALIGN_LEFT, i, j);
435 else if ((i+2 == this->GetRows() || j+2 == this->GetCols())
439 SetCellBackgroundColour(i, j, *wxWHITE);
459 if (GetSelectedCells().size())
461 else if (GetSelectionBlockTopLeft().size() && GetSelectionBlockBottomRight().size())
463 else if (GetSelectedCols().size())
465 else if (GetSelectedRows().size())
470 SetCellValue(GetCursorRow(), GetCursorColumn(),
"");
483 SetCellValue(i, j,
"");
500 static std::string sNums =
"0123456789,.eE+-* INFinf";
501 return sCell.find_first_not_of(sNums) == std::string::npos;
516 if (col >= this->GetCols() || col < 0)
521 if (GetCellValue(i, col).length() && GetCellValue(i, col) !=
"---")
540 wxString sReturn = sStr;
542 while (sReturn.find(
'_') != std::string::npos)
543 sReturn[sReturn.find(
'_')] =
' ';
564 if (!(GetSelectedCells().size() || GetSelectedCols().size() || GetSelectedRows().size() || GetSelectionBlockTopLeft().size() || GetSelectionBlockBottomRight().size()))
565 sSelection =
copyCell(this->GetCursorRow(), this->GetCursorColumn());
568 if (GetSelectedCells().size())
571 wxGridCellCoordsArray cellarray = GetSelectedCells();
573 for (
size_t i = 0; i < cellarray.size(); i++)
575 sSelection +=
copyCell(cellarray[i].GetRow(), cellarray[i].GetCol());
577 if (i < cellarray.size()-1)
581 else if (GetSelectionBlockTopLeft().size() && GetSelectionBlockBottomRight().size())
584 wxGridCellCoordsArray topleftarray = GetSelectionBlockTopLeft();
585 wxGridCellCoordsArray bottomrightarray = GetSelectionBlockBottomRight();
587 for (
int i = topleftarray[0].GetRow(); i <= bottomrightarray[0].GetRow(); i++)
589 for (
int j = topleftarray[0].GetCol(); j <= bottomrightarray[0].GetCol(); j++)
593 if (j < bottomrightarray[0].GetCol())
597 if (i < bottomrightarray[0].GetRow())
601 else if (GetSelectedCols().size())
604 wxArrayInt colarray = GetSelectedCols();
606 for (
int i = 0; i < GetRows(); i++)
608 for (
size_t j = 0; j < colarray.size(); j++)
610 sSelection +=
copyCell(i, colarray[j]);
612 if (j < colarray.size()-1)
620 else if (GetSelectedRows().size())
623 wxArrayInt rowarray = GetSelectedRows();
625 for (
size_t i = 0; i < rowarray.size(); i++)
627 for (
int j = 0; j < GetCols(); j++)
629 sSelection +=
copyCell(rowarray[i], j);
635 if (i < rowarray.size()-1)
640 if (!sSelection.length())
644 if (wxTheClipboard->Open())
646 wxTheClipboard->SetData(
new wxTextDataObject(sSelection));
647 wxTheClipboard->Close();
665 std::vector<wxString> vTableData;
669 if (wxTheClipboard->Open())
673 if (wxTheClipboard->IsSupported(wxDF_TEXT))
675 wxTextDataObject data;
676 wxTheClipboard->GetData(data);
680 wxTheClipboard->Close();
686 if (!vTableData.size())
689 int nLines = vTableData.size();
693 if (nLines && !useCursor && !
isNumerical(vTableData.front().ToStdString()))
704 for (
unsigned int i = 0; i < vTableData.size(); i++)
706 wxStringTokenizer tok(vTableData[i],
" ");
708 if (nCols < (
int)tok.CountTokens())
709 nCols = (int)tok.CountTokens();
716 for (
unsigned int i = 0; i < vTableData.size(); i++)
719 wxStringTokenizer tok(vTableData[i],
" ");
726 while (tok.HasMoreTokens())
728 sLine = tok.GetNextToken();
729 sLine.Replace(
"\1",
" ");
732 if (sLine[sLine.length()-1] ==
'%')
733 sLine.erase(sLine.length()-1);
736 this->SetCellValue(topleft.GetRow()+i-nSkip, topleft.GetCol()+j, sLine);
747 this->GoToCell(topleft);
748 this->SelectBlock(topleft, wxGridCellCoords(topleft.GetRow()+nLines-1, topleft.GetCol()+nCols-1));
764 if (GetSelectedCells().size())
766 else if (GetSelectionBlockTopLeft().size() && GetSelectionBlockBottomRight().size())
768 else if (GetSelectedCols().size())
770 else if (GetSelectedRows().size())
780 if (dialog.ShowModal() == wxID_OK)
795 int h_align, v_align;
798 wxGridCellAttr* attr =
new wxGridCellAttr(*wxBLACK, *wxWHITE, this->GetDefaultCellFont(),
799 h_align, wxALIGN_CENTER);
806 SetColAttr(j, attr,
true);
815 if (!coordsContainer.
contains(i, j))
842 std::vector<int> vTypes;
844 if (col+1 == GetNumberCols())
852 if (col < (
int)vTypes.size())
858 wxGridCellAttr* attr =
new wxGridCellAttr(*wxBLACK, *wxWHITE, this->GetDefaultCellFont(),
859 wxALIGN_LEFT, wxALIGN_CENTER);
861 SetColAttr(col, attr);
865 wxGridCellAttr* attr =
new wxGridCellAttr(*wxBLACK, *wxWHITE, this->GetDefaultCellFont(),
866 wxALIGN_CENTER, wxALIGN_CENTER);
868 SetColAttr(col, attr);
872 wxGridCellAttr* attr =
new wxGridCellAttr(*wxBLACK, *wxWHITE, this->GetDefaultCellFont(),
873 wxALIGN_CENTER, wxALIGN_CENTER);
875 SetColAttr(col, attr);
879 wxGridCellAttr* attr =
new wxGridCellAttr(*wxBLACK, *wxWHITE, this->GetDefaultCellFont(),
880 wxALIGN_RIGHT, wxALIGN_CENTER);
882 SetColAttr(col, attr);
892 for (
int i = (
int)
nFirstNumRow; i < GetNumberRows(); i++)
894 if (GetCellValue(i, col)[0] ==
'"')
895 SetCellAlignment(wxALIGN_LEFT, i, col);
897 SetCellAlignment(wxALIGN_RIGHT, i, col);
917 wxGridCellCoords topLeft(headrows,0);
925 while (this->GetRowLabelValue(topLeft.GetRow()) ==
"#")
926 topLeft.SetRow(topLeft.GetRow()+1);
928 if (this->GetCols()-1 < topLeft.GetCol() + cols)
929 this->AppendCols(topLeft.GetCol() + cols - this->GetCols()+1,
true);
931 if (this->GetRows()-1 < topLeft.GetRow() + rows)
932 this->AppendRows(topLeft.GetRow() + rows - this->GetRows()+1,
true);
938 for (
int i = this->GetCols()-1; i >= 0; i--)
942 if (this->GetCols()-i-1 < cols+1)
943 this->AppendCols(cols-(this->GetCols()-(i+1))+1);
951 if (this->GetCols()-1 < cols)
952 this->AppendCols(cols-(this->GetCols()-1));
959 for (
int i = 0; i < this->GetRows(); i++)
961 if (this->GetRowLabelValue(i) !=
"#")
967 if (this->GetRows()-i < rows+1)
969 this->AppendRows(rows-(this->GetRows()-i)+1);
975 this->InsertRows(i, headrows-(i-1));
977 for (
int j = i-1; j < GetRows(); j++)
978 this->SetRowLabelValue(j, this->GetRowLabelValue(j));
980 if (this->GetRows()-headrows < rows+1)
982 this->AppendRows(rows-(this->GetRows()-headrows)+1);
1009 return *
static_cast<mu::value_type*
>(GetTable()->GetValueAsCustom(row, col,
"complex"));
1011 if (GetCellValue(row, col)[0] !=
'"' &&
isNumerical(GetCellValue(row, col).ToStdString()))
1012 return StrToCmplx(GetCellValue(row, col).ToStdString());
1147 return dSum / (double)nCount;
1169 wxString dim =
"Dim: ";
1170 dim << this->GetRowLabelValue(GetRows()-2) <<
"x" << GetCols()-1;
1173 wxString sel =
"Cur: ";
1175 sel << this->GetRowLabelValue(cursor->GetRow()) <<
"," << cursor->GetCol()+1;
1206 wxMenu* menuFile =
new wxMenu();
1211 menuBar->Append(menuFile,
_guilang.
get(
"GUI_MENU_FILE"));
1214 wxMenu* menuEdit =
new wxMenu();
1219 menuEdit->AppendSeparator();
1223 menuEdit->AppendSeparator();
1228 menuBar->Append(menuEdit,
_guilang.
get(
"GUI_MENU_EDIT"));
1231 wxMenu* menuTools =
new wxMenu();
1237 menuBar->Append(menuTools,
_guilang.
get(
"GUI_MENU_TOOLS"));
1256 return this->GetCellValue(row, col);
1271 wxArrayString toks = wxStringTokenize(text);
1274 for (
size_t i = 0; i < toks.size(); i++)
1277 toks[i].Replace(
",",
".");
1300 bool bKeepColumns =
false;
1303 if (text.find(
' ') == std::string::npos)
1305 bKeepColumns =
true;
1307 if (text[0] ==
'\t')
1308 text.insert(0,
"---");
1315 while ((pos = text.find(
'\t')) != std::string::npos)
1319 if (bKeepColumns && pos+1 < text.length() && text[pos+1] ==
'\t')
1320 text.insert(pos + 1,
"---");
1357 std::vector<wxString> vPaste;
1358 wxString sClipboard = data;
1364 bool tabSeparated =
false;
1367 if (!sClipboard.length() || sClipboard ==
"\n")
1371 sLine = sClipboard.substr(0, sClipboard.find(
'\n'));
1374 if (sLine.length() && sLine[sLine.length()-1] == (
char)13)
1375 sLine.erase(sLine.length()-1);
1378 if (sLine.find(
'\t') != std::string::npos)
1379 tabSeparated =
true;
1382 if (sClipboard.find(
'\n') != std::string::npos)
1383 sClipboard.erase(0, sClipboard.find(
'\n')+1);
1391 && (tabSeparated || sLine.find(
" ") != std::string::npos))
1393 for (
unsigned int i = 1; i < sLine.length()-1; i++)
1395 if (sLine[i] ==
' ' && sLine[i-1] !=
' ' && sLine[i+1] !=
' ')
1405 if (sLine.find_first_not_of(
' ') == std::string::npos)
1411 if (sLine.find(
',') != std::string::npos && (sLine.find(
'.') == std::string::npos || tabSeparated))
1413 else if (!tabSeparated && sLine.find(
',') != std::string::npos && sLine.find(
';') != std::string::npos)
1417 for (
unsigned int i = 0; i < sLine.length(); i++)
1419 if (sLine[i] ==
',')
1422 if (sLine[i] ==
';')
1428 else if (!tabSeparated)
1432 for (
unsigned int i = 0; i < sLine.length(); i++)
1434 if (sLine[i] ==
',')
1442 vPaste.push_back(sLine);
1470 this->CreateGrid(_stringTable.
getRows()+1, _stringTable.
getCols()+1);
1476 for (
size_t i = 0; i < _stringTable.
getRows()+1; i++)
1478 this->SetRowLabelValue(i, GetRowLabelValue(i));
1480 for (
size_t j = 0; j < _stringTable.
getCols()+1; j++)
1484 this->SetColLabelValue(j,
toString(j+1));
1488 if (_stringTable.
get(i, j).length())
1497 wxMenu* toolsMenu = menuBar->GetMenu(menuBar->FindMenu(
_guilang.
get(
"GUI_MENU_TOOLS")));
1578 wxMenu* toolsMenu = menuBar->GetMenu(menuBar->FindMenu(
_guilang.
get(
"GUI_MENU_TOOLS")));
1588 wxMenu* editMenu = menuBar->GetMenu(menuBar->FindMenu(
_guilang.
get(
"GUI_MENU_EDIT")));
1617 CreateGrid(rows+1,cols+1);
1619 for (
size_t i = 0; i < rows+1; i++)
1621 SetRowLabelValue(i, GetRowLabelValue(i));
1623 for (
size_t j = 0; j < cols+1; j++)
1627 SetCellAlignment(i, j, wxALIGN_RIGHT, wxALIGN_CENTRE);
1628 SetCellFont(i, j, this->GetCellFont(i, j).MakeBold());
1629 SetCellBackgroundColour(i, j, *wxLIGHT_GREY);
1631 else if (i == rows || j == cols)
1633 SetColLabelValue(j, GetColLabelValue(j));
1634 SetCellBackgroundColour(i, j, wxColor(230,230,230));
1639 SetCellAlignment(i, j, wxALIGN_RIGHT, wxALIGN_CENTER);
1667 int id = GetPopupMenuSelectionFromUser(
m_popUpMenu, event.GetPosition());
1669 if (
id == wxID_NONE)
1673 wxCommandEvent evt(wxEVT_MENU,
id);
1674 GetEventHandler()->ProcessEvent(evt);
1695 if (event.GetRow() == -1)
1702 else if (event.GetCol() == -1)
1715 int id = GetPopupMenuSelectionFromUser(
m_popUpMenu, event.GetPosition());
1717 if (
id == wxID_NONE)
1721 wxCommandEvent evt(wxEVT_MENU,
id);
1722 GetEventHandler()->ProcessEvent(evt);
1742 switch (event.GetId())
1815 if (nLastLine+2 == GetRows())
1889 if (saveAs || !filename.length())
1892 _guilang.
get(
"COMMON_FILETYPE_NDAT") +
" (*.ndat)|*.ndat|"
1893 +
_guilang.
get(
"COMMON_FILETYPE_DAT") +
" (*.dat)|*.dat|"
1894 +
_guilang.
get(
"COMMON_FILETYPE_TXT") +
" (*.txt)|*.txt|"
1895 +
_guilang.
get(
"COMMON_FILETYPE_CSV") +
" (*.csv)|*.csv|"
1896 +
_guilang.
get(
"COMMON_FILETYPE_XLS") +
" (*.xls)|*.xls|"
1897 +
_guilang.
get(
"COMMON_FILETYPE_TEX") +
" (*.tex)|*.tex",
1898 wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
1900 if (fd.ShowModal() == wxID_CANCEL)
1903 filename = fd.GetPath().ToStdString();
1906 filename = vPaths[
SAVEPATH ] +
"/" + filename;
1913 wxMessageBox(
"Cannot save to this file: " + filename,
"NumeRe: Error", wxID_OK | wxICON_ERROR,
this);
1923 file->setTextfilePrecision(7);
1925 if (file->getExtension() ==
"ndat")
1935 wxMessageBox(
"Cannot save to this file: " + filename,
"NumeRe: Error", wxID_OK | wxICON_ERROR,
this);
1983 if (GetSelectionBlockTopLeft().size() && GetSelectionBlockBottomRight().size())
1985 else if (GetSelectedCols().size())
1987 else if (GetSelectedCells().size())
1994 wxArrayString types;
1996 for (
const auto& t : vTypes)
2001 wxString strType = wxGetSingleChoice(
_guilang.
get(
"GUI_TABLE_CHANGE_TYPE"),
_guilang.
get(
"GUI_TABLE_CHANGE_TYPE_HEAD"), types, 0,
this);
2003 if (!strType.length())
2015 if (!coordsContainer.
contains(0, j))
2041 SaveEditControlValue();
2055 if (!(GetSelectedCells().size()
2056 || GetSelectedCols().size()
2057 || GetSelectedRows().size()
2058 || GetSelectionBlockTopLeft().size()
2059 || GetSelectionBlockBottomRight().size()))
2060 return this->GetCellValue(this->GetCursorRow(), this->GetCursorColumn());
2065 if (GetSelectedCells().size())
2068 wxGridCellCoordsArray cellarray = GetSelectedCells();
2070 for (
size_t i = 0; i < cellarray.size(); i++)
2072 values += this->GetCellValue(cellarray[i]) +
",";
2075 else if (GetSelectionBlockTopLeft().size() && GetSelectionBlockBottomRight().size())
2078 wxGridCellCoordsArray topleftarray = GetSelectionBlockTopLeft();
2079 wxGridCellCoordsArray bottomrightarray = GetSelectionBlockBottomRight();
2081 for (
int i = topleftarray[0].GetRow(); i <= bottomrightarray[0].GetRow(); i++)
2083 for (
int j = topleftarray[0].GetCol(); j <= bottomrightarray[0].GetCol(); j++)
2085 values += GetCellValue(i, j) +
",";
2089 else if (GetSelectedCols().size())
2092 wxArrayInt colarray = GetSelectedCols();
2094 for (
int i = 0; i < GetRows(); i++)
2096 for (
size_t j = 0; j < colarray.size(); j++)
2098 values += this->GetCellValue(i, colarray[j]) +
",";
2105 wxArrayInt rowarray = GetSelectedRows();
2107 for (
size_t i = 0; i < rowarray.size(); i++)
2109 for (
int j = 0; j < GetCols(); j++)
2111 values += this->GetCellValue(rowarray[i], j) +
",";
2116 if (values.length())
2117 return values.substr(0, values.length()-1);
static wxColour HighlightColor
static wxColour FrameColor
static wxColour HeadlineColor
This class represents a special renderer for three-state booleans, i.e. booleans, which may have a un...
This class represents an extension to the usual cell string renderer to provide functionalities to hi...
This class implements the dialog for choosing the shader properties of the selected cells.
const CellValueShader & getShader() const
Get a reference to the internally available shader instance.
This class represents the grid cell editor which automatically selects the necessary edit control for...
This class is a specialisation for the standard wxGridTableBase supporting complex numbers as well as...
std::vector< int > getColumnTypes() const
Returns the types of the handled table.
This class handles the internal language system and returns the language strings of the selected lang...
std::string get(const std::string &sMessage, const std::vector< std::string > &vTokens) const
This member function returns the language string for the passed language identifier and replaces all ...
T & get(size_t row, size_t col)
This class resembles the binary NumeRe data file format. The data is red and written in binary mode u...
virtual bool write() override
Pure virtual declaration of the write access method. Has to be implemented in all derived classes and...
This data container is a copy- efficient table to interchange data between Kernel and GUI.
bool isEmpty() const
Return, whether the table is empty.
void setComment(const std::string &_comment)
Setter function for the table comment.
int getHeadCount() const
Getter function for the needed number of headlines (depending on the number of linebreaks found in th...
TableColumnArray & getTableData()
size_t getCols() const
Get the number of columns.
TableMetaData getMetaData() const
Getter function for the table meta data.
size_t getLines() const
Get the number of lines.
bool setColumnType(size_t j, TableColumn::ColumnType _type)
Tries to change the column type of the selected column.
The terminal class for the GUI. It's a specialisation of the GenericTerminal.
NumeRe::Table getTable(const std::string &sTableName)
This function will return the named table from the kernel to be shown in a GUI window.
NumeRe::Container< std::string > getStringTable(const std::string &sStringTableName)
This member function will return the named table containing strings.
std::vector< std::string > getPathSettings()
Returns the standard paths as a STL vector.
Generic table panel, which also contains all meta UI elements.
void update(const NumeRe::TableMetaData &meta)
Update the panel with the passed table meta data.
std::string getComment() const
Returns the comment listed in the documentation field.
wxFrame * getFrame()
Returns a pointer to the parent frame.
NumeReTerminal * GetTerminal()
wxMenuBar * getMenuBar()
Returns a pointer to the menu bar of the parent frame. If no menu bar exists, a new one is created.
This class is an adaption of the wxGrid class to present the tabular data in NumeRe's memory and enab...
void OnCellSelect(wxGridEvent &event)
This member function will highlight the cursor position in the grid and update the status bar corresp...
void deleteSelection()
This member function will delete the contents of the selected cells by setting them to NaN.
wxGridCellCoords CreateEmptyGridSpace(int rows, int headrows, int cols, bool useCursor=false)
This member function creates the needed space in the grid, which is needed to paste data.
double calculateMax(const wxGridCellCoordsContainer &coords)
This member function calculates the maximal value of the selected cells.
void applyConditionalCellColourScheme()
Apply a conditional cell colour scheme to the selected cells.
void replaceDecimalSign(wxString &text)
This member function replaces the german comma decimal sign with the dot used in anglo-american notat...
std::vector< int > m_currentColTypes
void SetData(NumeRe::Container< std::string > &_stringTable, const std::string &sName, const std::string &sIntName)
This member function is the data setter for string and cluster tables.
void copyContents()
This member function will copy the contents of the selected cells to the clipboard.
void UpdateColumnAlignment(int col)
Changes the alignment of a whole column to reflect its internal type.
void changeColType()
Enables the switching of the column types of the selected columns.
bool isEmptyCol(int col)
This member function will determine, whether the selected column is completely empty or not.
void OnLabelRightClick(wxGridEvent &event)
This member function displays the context menu for labels.
void createZeroElementTable()
This member function creates a zero- element table to visualize empty tables (or non-existent ones).
wxGridCellCoords m_lastRightClick
void saveTable(bool saveAs=false)
Saves the currently displayed table directly to the selected file.
int findLastElement(int nCol)
This member function will search the last non-empty cell in the selected column.
NumeRe::Table GetData()
This member function returns the internal NumeRe::Table from the data provider object.
mu::value_type calculateSum(const wxGridCellCoordsContainer &coords)
This member function calculates the sum of the selected cells.
void OnChar(wxKeyEvent &event)
This member function appends necessary columns or rows, if the user entered a character in the last c...
std::string m_displayName
void finalize()
Ensure that the editors are all closed.
double calculateMin(const wxGridCellCoordsContainer &coords)
This member function calculates the minimal value of the selected cells.
void SetDefaultSize(size_t rows=1, size_t cols=1) __attribute__((deprecated))
This member function creates an empty table of some size.
void OnMenu(wxCommandEvent &event)
This member function is the menu command event handler function. It will redirect the control to the ...
void layoutGrid()
This private member function will layout the initial grid after the data table was set.
bool isNumerical(const std::string &sCell)
This is a simple helper function to determine, whether the entered cell value is a numerical value.
void removeElement(int id)
This member function processes the removing of cells, columns or rows.
@ ID_MENU_CHANGE_COL_TYPE
void OnCellChange(wxGridEvent &event)
This member function processes the values entered in the table and updates the frame after entering (...
wxStatusBar * m_statusBar
void SetTableReadOnly(bool isReadOnly=true)
This member function declares the table to be read-only and enables the context menu entries,...
void OnCellRangeSelect(wxGridRangeSelectEvent &event)
This member function will calculate the simple statistics if the user selected a range of cells in th...
void replaceTabSign(wxString &text)
This member function replaces the tabulator character with whitespaces.
mu::value_type calculateAvg(const wxGridCellCoordsContainer &coords)
This member function calculates the average of the selected cells.
void reloadTable()
Reloads the currently displayed table data from the kernel.
wxString copyCell(int row, int col)
This member function returns the contents of the selected cells and replaces whitespaces with undersc...
void updateFrame()
This member function is called every time the grid itself changes to draw the frame colours.
void OnCellRightClick(wxGridEvent &event)
This member function displays the context menu for cells.
void OnLabelDoubleClick(wxGridEvent &event)
This member function will autosize the columns, if the user double clicked on their labels.
wxString getSelectedValues()
Returns the values of all selected cells as a string list.
mu::value_type CellToCmplx(int row, int col)
Return the cell value as value_type.
void OnEnter(wxMouseEvent &event)
This member function is the event handler for entering this window. It will activate the focus and br...
std::vector< wxString > getLinesFromPaste(const wxString &data)
This member function transformes the data obtained by the clipboard into a table- like layout.
void createMenuBar()
Creates a menu bar in the top frame.
NumeRe::Table GetDataCopy()
This member function returns a safe copy of the internal NumeRe::Table.
TablePanel * m_parentPanel
wxString replaceCtrlChars(const wxString &sStr)
This member function is a simple helper to replace underscores with whitespaces.
void OnKeyDown(wxKeyEvent &event)
This member function tracks the entered keys and processes a keybord navigation.
wxGridCellCoordsArray selectedCells
void updateStatusBar(const wxGridCellCoordsContainer &coords, wxGridCellCoords *cursor=nullptr)
This member function updates the status bar of the enclosing ViewerFrame.
void insertElement(int id)
This member function processes the insertion of new empty cells, columns or rows.
void pasteContents(bool useCursor=false)
This member function handles the case that the user tries to paste text contents, which may be be con...
A class to simplify the access to different types of grid cell coords. Especially useful in the conte...
const wxGridCellsExtent & getExtent() const
Get the maximal needed enclosing box in terms of wxGridCellCoordinates.
bool contains(const wxGridCellCoords &cell) const
Does this wxGridCellCoordsContainer contain the passed coordinates?
bool isBlock() const
Returns true, if the contained coordinates actually form a contigious block.
bool columnsSelected() const
Returns true, if the contained coordinates originated from complete columns.
GenericFile * getFileByType(const string &filename)
This function determines the correct class to be used for the filename passed to this function....
MUP_BASETYPE value_type
The numeric datatype used by the parser.
bool isnan(const value_type &v)
static ColumnType stringToType(const std::string &sType)
Converts the passed string representation to a ColumnType value.
static std::vector< std::string > getTypesAsString()
Returns a list of all available column types as strings.
std::string toString(int)
Converts an integer to a string without the Settings bloat.
A simple structure to define the needed grid space to enclose all cells contained in the wxGridCellCo...
wxGridCellCoords m_topleft
wxGridCellCoords m_bottomright
#define MAXIMAL_RENDERING_SIZE
#define STATUSBAR_PRECISION