NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
TableViewer Class Reference

This class is an adaption of the wxGrid class to present the tabular data in NumeRe's memory and enabling copy-pasting of tabular data to an from NumeRe. More...

#include <tableviewer.hpp>

Inheritance diagram for TableViewer:
Collaboration diagram for TableViewer:

Public Types

enum  TableViewerIDs {
  ID_MENU_SAVE = 15000 , ID_MENU_SAVE_AS , ID_MENU_INSERT_ROW , ID_MENU_INSERT_COL ,
  ID_MENU_INSERT_CELL , ID_MENU_REMOVE_ROW , ID_MENU_REMOVE_COL , ID_MENU_REMOVE_CELL ,
  ID_MENU_COPY , ID_MENU_PASTE , ID_MENU_PASTE_HERE , ID_MENU_RELOAD ,
  ID_MENU_CHANGE_COL_TYPE , ID_MENU_CVS
}
 

Public Member Functions

 TableViewer (wxWindow *parent, wxWindowID id, wxStatusBar *statusbar, TablePanel *parentPanel, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxWANTS_CHARS, const wxString &name=wxGridNameStr)
 Constructor. More...
 
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. More...
 
void SetData (NumeRe::Table &_table, const std::string &sName, const std::string &sIntName)
 This member function is the data setter function. It will create an internal GridNumeReTable object, which will provide the data for the grid. More...
 
NumeRe::Table GetData ()
 This member function returns the internal NumeRe::Table from the data provider object. More...
 
NumeRe::Table GetDataCopy ()
 This member function returns a safe copy of the internal NumeRe::Table. More...
 
void SetTableReadOnly (bool isReadOnly=true)
 This member function declares the table to be read-only and enables the context menu entries, if the table is set to be not read-only. More...
 
void SetDefaultSize (size_t rows=1, size_t cols=1) __attribute__((deprecated))
 This member function creates an empty table of some size. More...
 
void OnLabelRightClick (wxGridEvent &event)
 This member function displays the context menu for labels. More...
 
void OnCellRightClick (wxGridEvent &event)
 This member function displays the context menu for cells. More...
 
void OnMenu (wxCommandEvent &event)
 This member function is the menu command event handler function. It will redirect the control to the specified functions. More...
 
void insertElement (int id)
 This member function processes the insertion of new empty cells, columns or rows. More...
 
void removeElement (int id)
 This member function processes the removing of cells, columns or rows. More...
 
void saveTable (bool saveAs=false)
 Saves the currently displayed table directly to the selected file. More...
 
void reloadTable ()
 Reloads the currently displayed table data from the kernel. More...
 
void changeColType ()
 Enables the switching of the column types of the selected columns. More...
 
void finalize ()
 Ensure that the editors are all closed. More...
 
wxString getSelectedValues ()
 Returns the values of all selected cells as a string list. More...
 
size_t GetHeight ()
 
size_t GetWidth ()
 
 DECLARE_EVENT_TABLE ()
 

Private Member Functions

void layoutGrid ()
 This private member function will layout the initial grid after the data table was set. More...
 
void OnKeyDown (wxKeyEvent &event)
 This member function tracks the entered keys and processes a keybord navigation. More...
 
void OnChar (wxKeyEvent &event)
 This member function appends necessary columns or rows, if the user entered a character in the last column or the last row. More...
 
void OnEnter (wxMouseEvent &event)
 This member function is the event handler for entering this window. It will activate the focus and bring it to the front. More...
 
void OnCellChange (wxGridEvent &event)
 This member function processes the values entered in the table and updates the frame after entering (due to a possible created new headline row). More...
 
void OnCellSelect (wxGridEvent &event)
 This member function will highlight the cursor position in the grid and update the status bar correspondingly. More...
 
void OnCellRangeSelect (wxGridRangeSelectEvent &event)
 This member function will calculate the simple statistics if the user selected a range of cells in the table. More...
 
void OnLabelDoubleClick (wxGridEvent &event)
 This member function will autosize the columns, if the user double clicked on their labels. More...
 
void updateFrame ()
 This member function is called every time the grid itself changes to draw the frame colours. More...
 
void deleteSelection ()
 This member function will delete the contents of the selected cells by setting them to NaN. More...
 
int findLastElement (int nCol)
 This member function will search the last non-empty cell in the selected column. More...
 
bool isNumerical (const std::string &sCell)
 This is a simple helper function to determine, whether the entered cell value is a numerical value. More...
 
bool isEmptyCol (int col)
 This member function will determine, whether the selected column is completely empty or not. More...
 
wxString replaceCtrlChars (const wxString &sStr)
 This member function is a simple helper to replace underscores with whitespaces. More...
 
void copyContents ()
 This member function will copy the contents of the selected cells to the clipboard. More...
 
void pasteContents (bool useCursor=false)
 This member function handles the case that the user tries to paste text contents, which may be be converted into a table. More...
 
void applyConditionalCellColourScheme ()
 Apply a conditional cell colour scheme to the selected cells. More...
 
void UpdateColumnAlignment (int col)
 Changes the alignment of a whole column to reflect its internal type. More...
 
std::vector< wxString > getLinesFromPaste (const wxString &data)
 This member function transformes the data obtained by the clipboard into a table- like layout. More...
 
void replaceDecimalSign (wxString &text)
 This member function replaces the german comma decimal sign with the dot used in anglo-american notation. More...
 
void replaceTabSign (wxString &text)
 This member function replaces the tabulator character with whitespaces. More...
 
void createZeroElementTable ()
 This member function creates a zero- element table to visualize empty tables (or non-existent ones). More...
 
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. More...
 
mu::value_type CellToCmplx (int row, int col)
 Return the cell value as value_type. More...
 
double calculateMin (const wxGridCellCoordsContainer &coords)
 This member function calculates the minimal value of the selected cells. More...
 
double calculateMax (const wxGridCellCoordsContainer &coords)
 This member function calculates the maximal value of the selected cells. More...
 
mu::value_type calculateSum (const wxGridCellCoordsContainer &coords)
 This member function calculates the sum of the selected cells. More...
 
mu::value_type calculateAvg (const wxGridCellCoordsContainer &coords)
 This member function calculates the average of the selected cells. More...
 
void updateStatusBar (const wxGridCellCoordsContainer &coords, wxGridCellCoords *cursor=nullptr)
 This member function updates the status bar of the enclosing ViewerFrame. More...
 
void createMenuBar ()
 Creates a menu bar in the top frame. More...
 
wxString copyCell (int row, int col)
 This member function returns the contents of the selected cells and replaces whitespaces with underscores on-the-fly. More...
 

Private Attributes

size_t nHeight
 
size_t nWidth
 
size_t nFirstNumRow
 
bool readOnly
 
bool isGridNumeReTable
 
wxGridCellCoords lastCursorPosition
 
wxGridCellCoordsArray selectedCells
 
std::vector< int > m_currentColTypes
 
std::string m_displayName
 
std::string m_intName
 
TablePanelm_parentPanel
 
wxStatusBar * m_statusBar
 
wxMenu m_popUpMenu
 
wxGridCellCoords m_lastRightClick
 

Detailed Description

This class is an adaption of the wxGrid class to present the tabular data in NumeRe's memory and enabling copy-pasting of tabular data to an from NumeRe.

Definition at line 41 of file tableviewer.hpp.

Member Enumeration Documentation

◆ TableViewerIDs

Enumerator
ID_MENU_SAVE 
ID_MENU_SAVE_AS 
ID_MENU_INSERT_ROW 
ID_MENU_INSERT_COL 
ID_MENU_INSERT_CELL 
ID_MENU_REMOVE_ROW 
ID_MENU_REMOVE_COL 
ID_MENU_REMOVE_CELL 
ID_MENU_COPY 
ID_MENU_PASTE 
ID_MENU_PASTE_HERE 
ID_MENU_RELOAD 
ID_MENU_CHANGE_COL_TYPE 
ID_MENU_CVS 

Definition at line 126 of file tableviewer.hpp.

Constructor & Destructor Documentation

◆ TableViewer()

TableViewer::TableViewer ( wxWindow *  parent,
wxWindowID  id,
wxStatusBar *  statusbar,
TablePanel parentPanel,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxWANTS_CHARS,
const wxString &  name = wxGridNameStr 
)

Constructor.

Parameters
parentwxWindow*
idwxWindowID
statusbarwxStatusBar*
parentPanelTablePanel*
posconst wxPoint&
sizeconst wxSize&
stylelong
nameconst wxString&

Definition at line 66 of file tableviewer.cpp.

References _guilang, Language::get(), and ID_MENU_COPY.

Here is the call graph for this function:

Member Function Documentation

◆ applyConditionalCellColourScheme()

void TableViewer::applyConditionalCellColourScheme ( )
private

Apply a conditional cell colour scheme to the selected cells.

Returns
void

Definition at line 759 of file tableviewer.cpp.

References calculateMax(), calculateMin(), wxGridCellCoordsContainer::columnsSelected(), wxGridCellCoordsContainer::contains(), wxGridCellCoordsContainer::getExtent(), CellValueShaderDialog::getShader(), wxGridCellCoordsContainer::isBlock(), wxGridCellsExtent::m_bottomright, m_currentColTypes, wxGridCellsExtent::m_topleft, nFirstNumRow, and TableColumn::TYPE_LOGICAL.

Referenced by OnMenu().

Here is the call graph for this function:

◆ calculateAvg()

mu::value_type TableViewer::calculateAvg ( const wxGridCellCoordsContainer coords)
private

This member function calculates the average of the selected cells.

Parameters
coordsconst wxGridCellCoordsContainer&
Returns
mu::value_type

Definition at line 1122 of file tableviewer.cpp.

References CellToCmplx(), wxGridCellCoordsContainer::contains(), wxGridCellCoordsContainer::getExtent(), isGridNumeReTable, mu::isnan(), wxGridCellsExtent::m_bottomright, and wxGridCellsExtent::m_topleft.

Referenced by updateStatusBar().

Here is the call graph for this function:

◆ calculateMax()

double TableViewer::calculateMax ( const wxGridCellCoordsContainer coords)
private

This member function calculates the maximal value of the selected cells.

Parameters
coordsconst wxGridCellCoordsContainer&
Returns
double

Definition at line 1058 of file tableviewer.cpp.

References CellToCmplx(), wxGridCellCoordsContainer::contains(), wxGridCellCoordsContainer::getExtent(), isGridNumeReTable, mu::isnan(), wxGridCellsExtent::m_bottomright, wxGridCellsExtent::m_topleft, and max.

Referenced by applyConditionalCellColourScheme(), and updateStatusBar().

Here is the call graph for this function:

◆ calculateMin()

double TableViewer::calculateMin ( const wxGridCellCoordsContainer coords)
private

This member function calculates the minimal value of the selected cells.

Parameters
coordsconst wxGridCellCoordsContainer&
Returns
double

Definition at line 1026 of file tableviewer.cpp.

References CellToCmplx(), wxGridCellCoordsContainer::contains(), wxGridCellCoordsContainer::getExtent(), isGridNumeReTable, mu::isnan(), wxGridCellsExtent::m_bottomright, wxGridCellsExtent::m_topleft, and min.

Referenced by applyConditionalCellColourScheme(), and updateStatusBar().

Here is the call graph for this function:

◆ calculateSum()

mu::value_type TableViewer::calculateSum ( const wxGridCellCoordsContainer coords)
private

This member function calculates the sum of the selected cells.

Parameters
coordsconst wxGridCellCoordsContainer&
Returns
mu::value_type

Definition at line 1090 of file tableviewer.cpp.

References CellToCmplx(), wxGridCellCoordsContainer::contains(), wxGridCellCoordsContainer::getExtent(), isGridNumeReTable, mu::isnan(), wxGridCellsExtent::m_bottomright, and wxGridCellsExtent::m_topleft.

Referenced by updateStatusBar().

Here is the call graph for this function:

◆ CellToCmplx()

mu::value_type TableViewer::CellToCmplx ( int  row,
int  col 
)
private

Return the cell value as value_type.

Parameters
rowint
colint
Returns
mu::value_type

Definition at line 1006 of file tableviewer.cpp.

References isGridNumeReTable, isNumerical(), and StrToCmplx().

Referenced by calculateAvg(), calculateMax(), calculateMin(), and calculateSum().

Here is the call graph for this function:

◆ changeColType()

void TableViewer::changeColType ( )

Enables the switching of the column types of the selected columns.

Returns
void

Definition at line 1975 of file tableviewer.cpp.

References _guilang, wxGridCellCoordsContainer::contains(), Language::get(), wxGridCellCoordsContainer::getExtent(), TableColumn::getTypesAsString(), isGridNumeReTable, wxGridCellsExtent::m_bottomright, wxGridCellsExtent::m_topleft, NumeRe::Table::setColumnType(), TableColumn::stringToType(), and UpdateColumnAlignment().

Referenced by OnMenu().

Here is the call graph for this function:

◆ copyCell()

wxString TableViewer::copyCell ( int  row,
int  col 
)
private

This member function returns the contents of the selected cells and replaces whitespaces with underscores on-the-fly.

Parameters
rowint
colint
Returns
wxString

Definition at line 1254 of file tableviewer.cpp.

Referenced by copyContents().

◆ copyContents()

void TableViewer::copyContents ( )
private

This member function will copy the contents of the selected cells to the clipboard.

Returns
void
Note
Maybe it should consider the language and convert the decimal dots correspondingly?

Definition at line 559 of file tableviewer.cpp.

References copyCell().

Referenced by OnKeyDown(), and OnMenu().

Here is the call graph for this function:

◆ CreateEmptyGridSpace()

wxGridCellCoords TableViewer::CreateEmptyGridSpace ( int  rows,
int  headrows,
int  cols,
bool  useCursor = false 
)
private

This member function creates the needed space in the grid, which is needed to paste data.

Parameters
rowsint
headrowsint
colsint
useCursorbool
Returns
wxGridCellCoords

Definition at line 915 of file tableviewer.cpp.

References isEmptyCol(), m_lastRightClick, nFirstNumRow, and updateFrame().

Referenced by pasteContents().

Here is the call graph for this function:

◆ createMenuBar()

void TableViewer::createMenuBar ( )
private

Creates a menu bar in the top frame.

Returns
void

Definition at line 1198 of file tableviewer.cpp.

References _guilang, Language::get(), TablePanel::getFrame(), TablePanel::getMenuBar(), ID_MENU_CHANGE_COL_TYPE, ID_MENU_COPY, ID_MENU_CVS, ID_MENU_INSERT_CELL, ID_MENU_INSERT_COL, ID_MENU_INSERT_ROW, ID_MENU_PASTE, ID_MENU_PASTE_HERE, ID_MENU_RELOAD, ID_MENU_REMOVE_CELL, ID_MENU_REMOVE_COL, ID_MENU_REMOVE_ROW, ID_MENU_SAVE, ID_MENU_SAVE_AS, m_parentPanel, and OnMenu().

Here is the call graph for this function:

◆ createZeroElementTable()

void TableViewer::createZeroElementTable ( )
private

This member function creates a zero- element table to visualize empty tables (or non-existent ones).

Returns
void

Definition at line 1333 of file tableviewer.cpp.

References isGridNumeReTable, layoutGrid(), nFirstNumRow, and updateStatusBar().

Referenced by SetData().

Here is the call graph for this function:

◆ DECLARE_EVENT_TABLE()

TableViewer::DECLARE_EVENT_TABLE ( )

◆ deleteSelection()

void TableViewer::deleteSelection ( )
private

This member function will delete the contents of the selected cells by setting them to NaN.

Returns
void

Definition at line 454 of file tableviewer.cpp.

References wxGridCellCoordsContainer::contains(), wxGridCellCoordsContainer::getExtent(), wxGridCellsExtent::m_bottomright, and wxGridCellsExtent::m_topleft.

Referenced by OnKeyDown().

Here is the call graph for this function:

◆ finalize()

void TableViewer::finalize ( )

Ensure that the editors are all closed.

Returns
void

Definition at line 2039 of file tableviewer.cpp.

Referenced by TableEditPanel::OnButtonCancel(), TableEditPanel::OnButtonOk(), TablePanel::OnClose(), and TableEditPanel::OnClose().

◆ findLastElement()

int TableViewer::findLastElement ( int  nCol)
private

This member function will search the last non-empty cell in the selected column.

Parameters
nColint
Returns
int

Definition at line 390 of file tableviewer.cpp.

Referenced by insertElement(), and removeElement().

◆ GetData()

NumeRe::Table TableViewer::GetData ( )

This member function returns the internal NumeRe::Table from the data provider object.

Returns
NumeRe::Table
Note
The data provider is most likely not in a valid state after a call to this function.

Definition at line 2133 of file tableviewer.cpp.

References TablePanel::getComment(), m_parentPanel, readOnly, and NumeRe::Table::setComment().

Referenced by TableEditPanel::OnButtonOk().

Here is the call graph for this function:

◆ GetDataCopy()

NumeRe::Table TableViewer::GetDataCopy ( )

This member function returns a safe copy of the internal NumeRe::Table.

Returns
NumeRe::Table

Definition at line 2151 of file tableviewer.cpp.

References TablePanel::getComment(), m_parentPanel, readOnly, and NumeRe::Table::setComment().

Referenced by CustomWindow::getItemParameters().

Here is the call graph for this function:

◆ GetHeight()

size_t TableViewer::GetHeight ( )
inline

Definition at line 123 of file tableviewer.hpp.

References nHeight.

Referenced by NumeReWindow::editTable(), and NumeReWindow::openTable().

◆ getLinesFromPaste()

std::vector< wxString > TableViewer::getLinesFromPaste ( const wxString &  data)
private

This member function transformes the data obtained by the clipboard into a table- like layout.

Parameters
dataconst wxString&
Returns
std::vector<wxString>

Definition at line 1355 of file tableviewer.cpp.

References isNumerical(), replaceDecimalSign(), and replaceTabSign().

Referenced by pasteContents().

Here is the call graph for this function:

◆ getSelectedValues()

wxString TableViewer::getSelectedValues ( )

Returns the values of all selected cells as a string list.

Returns
wxString

Definition at line 2052 of file tableviewer.cpp.

Referenced by CustomWindow::getItemParameters().

◆ GetWidth()

size_t TableViewer::GetWidth ( )
inline

Definition at line 124 of file tableviewer.hpp.

References nWidth.

Referenced by NumeReWindow::editTable(), and NumeReWindow::openTable().

◆ insertElement()

void TableViewer::insertElement ( int  id)

This member function processes the insertion of new empty cells, columns or rows.

Parameters
idint
Returns
void

Definition at line 1793 of file tableviewer.cpp.

References findLastElement(), ID_MENU_INSERT_COL, ID_MENU_INSERT_ROW, m_lastRightClick, nFirstNumRow, and updateFrame().

Referenced by OnMenu().

Here is the call graph for this function:

◆ isEmptyCol()

bool TableViewer::isEmptyCol ( int  col)
private

This member function will determine, whether the selected column is completely empty or not.

Parameters
colint
Returns
bool

Definition at line 514 of file tableviewer.cpp.

References nFirstNumRow.

Referenced by CreateEmptyGridSpace().

◆ isNumerical()

bool TableViewer::isNumerical ( const std::string &  sCell)
private

This is a simple helper function to determine, whether the entered cell value is a numerical value.

Parameters
sCellconst std::string&
Returns
bool

Definition at line 498 of file tableviewer.cpp.

Referenced by CellToCmplx(), getLinesFromPaste(), pasteContents(), and replaceDecimalSign().

◆ layoutGrid()

void TableViewer::layoutGrid ( )
private

This private member function will layout the initial grid after the data table was set.

Returns
void

Definition at line 101 of file tableviewer.cpp.

References GridNumeReTable::getColumnTypes(), isGridNumeReTable, m_currentColTypes, nFirstNumRow, nHeight, nWidth, readOnly, TableColumn::TYPE_CATEGORICAL, TableColumn::TYPE_LOGICAL, and TableColumn::TYPE_STRING.

Referenced by createZeroElementTable(), and SetData().

Here is the call graph for this function:

◆ OnCellChange()

void TableViewer::OnCellChange ( wxGridEvent &  event)
private

This member function processes the values entered in the table and updates the frame after entering (due to a possible created new headline row).

Parameters
eventwxGridEvent&
Returns
void

Definition at line 289 of file tableviewer.cpp.

References UpdateColumnAlignment().

Here is the call graph for this function:

◆ OnCellRangeSelect()

void TableViewer::OnCellRangeSelect ( wxGridRangeSelectEvent &  event)
private

This member function will calculate the simple statistics if the user selected a range of cells in the table.

Parameters
eventwxGridRangeSelectEvent&
Returns
void

Definition at line 326 of file tableviewer.cpp.

References selectedCells, and updateStatusBar().

Here is the call graph for this function:

◆ OnCellRightClick()

void TableViewer::OnCellRightClick ( wxGridEvent &  event)

This member function displays the context menu for cells.

Parameters
eventwxGridEvent&
Returns
void

Definition at line 1655 of file tableviewer.cpp.

References ID_MENU_INSERT_ROW, ID_MENU_PASTE_HERE, ID_MENU_REMOVE_CELL, m_lastRightClick, m_popUpMenu, and readOnly.

◆ OnCellSelect()

void TableViewer::OnCellSelect ( wxGridEvent &  event)
private

This member function will highlight the cursor position in the grid and update the status bar correspondingly.

Parameters
eventwxGridEvent&
Returns
void

Definition at line 308 of file tableviewer.cpp.

References updateStatusBar().

Here is the call graph for this function:

◆ OnChar()

void TableViewer::OnChar ( wxKeyEvent &  event)
private

This member function appends necessary columns or rows, if the user entered a character in the last column or the last row.

Parameters
eventwxKeyEvent&
Returns
void

Definition at line 240 of file tableviewer.cpp.

References readOnly, and updateFrame().

Here is the call graph for this function:

◆ OnEnter()

void TableViewer::OnEnter ( wxMouseEvent &  event)
private

This member function is the event handler for entering this window. It will activate the focus and bring it to the front.

Parameters
eventwxMouseEvent&
Returns
void

Definition at line 272 of file tableviewer.cpp.

◆ OnKeyDown()

void TableViewer::OnKeyDown ( wxKeyEvent &  event)
private

This member function tracks the entered keys and processes a keybord navigation.

Parameters
eventwxKeyEvent&
Returns
void

Definition at line 197 of file tableviewer.cpp.

References copyContents(), deleteSelection(), pasteContents(), and readOnly.

Here is the call graph for this function:

◆ OnLabelDoubleClick()

void TableViewer::OnLabelDoubleClick ( wxGridEvent &  event)
private

This member function will autosize the columns, if the user double clicked on their labels.

Parameters
eventwxGridEvent&
Returns
void

Definition at line 375 of file tableviewer.cpp.

◆ OnLabelRightClick()

void TableViewer::OnLabelRightClick ( wxGridEvent &  event)

This member function displays the context menu for labels.

Parameters
eventwxGridEvent&
Returns
void

Definition at line 1687 of file tableviewer.cpp.

References ID_MENU_INSERT_CELL, ID_MENU_INSERT_COL, ID_MENU_INSERT_ROW, ID_MENU_PASTE_HERE, ID_MENU_REMOVE_CELL, ID_MENU_REMOVE_COL, ID_MENU_REMOVE_ROW, m_lastRightClick, m_popUpMenu, and readOnly.

◆ OnMenu()

void TableViewer::OnMenu ( wxCommandEvent &  event)

This member function is the menu command event handler function. It will redirect the control to the specified functions.

Parameters
eventwxCommandEvent&
Returns
void

Definition at line 1737 of file tableviewer.cpp.

References applyConditionalCellColourScheme(), changeColType(), copyContents(), ID_MENU_CHANGE_COL_TYPE, ID_MENU_COPY, ID_MENU_CVS, ID_MENU_INSERT_CELL, ID_MENU_INSERT_COL, ID_MENU_INSERT_ROW, ID_MENU_PASTE, ID_MENU_PASTE_HERE, ID_MENU_RELOAD, ID_MENU_REMOVE_CELL, ID_MENU_REMOVE_COL, ID_MENU_REMOVE_ROW, ID_MENU_SAVE, ID_MENU_SAVE_AS, insertElement(), m_lastRightClick, pasteContents(), reloadTable(), removeElement(), and saveTable().

Referenced by createMenuBar().

Here is the call graph for this function:

◆ pasteContents()

void TableViewer::pasteContents ( bool  useCursor = false)
private

This member function handles the case that the user tries to paste text contents, which may be be converted into a table.

Parameters
useCursorbool
Returns
void

Definition at line 663 of file tableviewer.cpp.

References CreateEmptyGridSpace(), getLinesFromPaste(), and isNumerical().

Referenced by OnKeyDown(), and OnMenu().

Here is the call graph for this function:

◆ reloadTable()

void TableViewer::reloadTable ( )

Reloads the currently displayed table data from the kernel.

Returns
void

Definition at line 1948 of file tableviewer.cpp.

References NumeReTerminal::getStringTable(), NumeReTerminal::getTable(), TablePanel::GetTerminal(), isGridNumeReTable, m_displayName, m_intName, m_parentPanel, and SetData().

Referenced by OnMenu().

Here is the call graph for this function:

◆ removeElement()

void TableViewer::removeElement ( int  id)

This member function processes the removing of cells, columns or rows.

Parameters
idint
Returns
void

Definition at line 1838 of file tableviewer.cpp.

References findLastElement(), ID_MENU_REMOVE_COL, ID_MENU_REMOVE_ROW, m_lastRightClick, nFirstNumRow, and updateFrame().

Referenced by OnMenu().

Here is the call graph for this function:

◆ replaceCtrlChars()

wxString TableViewer::replaceCtrlChars ( const wxString &  sStr)
private

This member function is a simple helper to replace underscores with whitespaces.

Parameters
sStrconst wxString&
Returns
wxString

Definition at line 538 of file tableviewer.cpp.

◆ replaceDecimalSign()

void TableViewer::replaceDecimalSign ( wxString &  text)
private

This member function replaces the german comma decimal sign with the dot used in anglo-american notation.

Parameters
textwxString&
Returns
void

Definition at line 1269 of file tableviewer.cpp.

References isNumerical().

Referenced by getLinesFromPaste().

Here is the call graph for this function:

◆ replaceTabSign()

void TableViewer::replaceTabSign ( wxString &  text)
private

This member function replaces the tabulator character with whitespaces.

Parameters
textwxString&
Returns
void

Definition at line 1295 of file tableviewer.cpp.

Referenced by getLinesFromPaste().

◆ saveTable()

void TableViewer::saveTable ( bool  saveAs = false)

Saves the currently displayed table directly to the selected file.

Parameters
saveAsbool
Returns
void

Definition at line 1879 of file tableviewer.cpp.

References _guilang, NumeRe::TableMetaData::comment, Language::get(), NumeRe::Table::getCols(), NumeRe::getFileByType(), NumeRe::Table::getLines(), NumeRe::Table::getMetaData(), NumeReTerminal::getPathSettings(), NumeRe::Table::getTableData(), TablePanel::GetTerminal(), isGridNumeReTable, m_displayName, m_parentPanel, SAVEPATH, and NumeRe::NumeReDataFile::write().

Referenced by OnMenu().

Here is the call graph for this function:

◆ SetData() [1/2]

void TableViewer::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.

Parameters
_stringTableNumeRe::Container<std::string>&
sNameconst std::string&
sIntNameconst std::string&
Returns
void

Definition at line 1459 of file tableviewer.cpp.

References _guilang, createZeroElementTable(), Language::get(), NumeRe::Container< T >::get(), NumeRe::Container< T >::getCols(), TablePanel::getMenuBar(), NumeRe::Container< T >::getRows(), ID_MENU_CHANGE_COL_TYPE, isGridNumeReTable, layoutGrid(), m_displayName, m_intName, m_parentPanel, nFirstNumRow, replaceControlCharacters(), toString(), and updateStatusBar().

Referenced by NumeReWindow::editTable(), CustomWindow::layoutChild(), NumeReWindow::openTable(), reloadTable(), and CustomWindow::setItemValue().

Here is the call graph for this function:

◆ SetData() [2/2]

void TableViewer::SetData ( NumeRe::Table _table,
const std::string &  sName,
const std::string &  sIntName 
)

This member function is the data setter function. It will create an internal GridNumeReTable object, which will provide the data for the grid.

Parameters
_tableNumeRe::Table&
sNameconst std::string&
Returns
void

Definition at line 1520 of file tableviewer.cpp.

References createZeroElementTable(), NumeRe::Table::getHeadCount(), NumeRe::Table::getLines(), NumeRe::Table::getMetaData(), NumeRe::Table::isEmpty(), isGridNumeReTable, layoutGrid(), m_displayName, m_intName, m_parentPanel, nFirstNumRow, TablePanel::update(), and updateStatusBar().

Here is the call graph for this function:

◆ SetDefaultSize()

void TableViewer::SetDefaultSize ( size_t  rows = 1,
size_t  cols = 1 
)

This member function creates an empty table of some size.

Parameters
rowssize_t
colssize_t
Returns
void
Deprecated:
It's declared as deprecated

Definition at line 1615 of file tableviewer.cpp.

References readOnly.

◆ SetTableReadOnly()

void TableViewer::SetTableReadOnly ( bool  isReadOnly = true)

This member function declares the table to be read-only and enables the context menu entries, if the table is set to be not read-only.

Parameters
isReadOnlybool
Returns
void

Definition at line 1557 of file tableviewer.cpp.

References _guilang, Language::get(), TablePanel::getMenuBar(), ID_MENU_INSERT_CELL, ID_MENU_INSERT_COL, ID_MENU_INSERT_ROW, ID_MENU_PASTE, ID_MENU_PASTE_HERE, ID_MENU_RELOAD, ID_MENU_REMOVE_CELL, ID_MENU_REMOVE_COL, ID_MENU_REMOVE_ROW, m_parentPanel, m_popUpMenu, and readOnly.

Referenced by CustomWindow::layoutChild().

Here is the call graph for this function:

◆ UpdateColumnAlignment()

void TableViewer::UpdateColumnAlignment ( int  col)
private

Changes the alignment of a whole column to reflect its internal type.

Parameters
colint
Returns
void

Definition at line 840 of file tableviewer.cpp.

References GridNumeReTable::getColumnTypes(), isGridNumeReTable, m_currentColTypes, nFirstNumRow, TableColumn::TYPE_CATEGORICAL, TableColumn::TYPE_LOGICAL, and TableColumn::TYPE_STRING.

Referenced by changeColType(), and OnCellChange().

Here is the call graph for this function:

◆ updateFrame()

void TableViewer::updateFrame ( )
private

This member function is called every time the grid itself changes to draw the frame colours.

Returns
void

Definition at line 410 of file tableviewer.cpp.

References FrameColor, HeadlineColor, HighlightColor, MAXIMAL_RENDERING_SIZE, and nFirstNumRow.

Referenced by CreateEmptyGridSpace(), insertElement(), OnChar(), and removeElement().

◆ updateStatusBar()

void TableViewer::updateStatusBar ( const wxGridCellCoordsContainer coords,
wxGridCellCoords *  cursor = nullptr 
)
private

This member function updates the status bar of the enclosing ViewerFrame.

Parameters
topLeftconst wxGridCellCoords&
bottomRightconst wxGridCellCoords&
cursorwxGridCellCoords*
Returns
void

Definition at line 1163 of file tableviewer.cpp.

References calculateAvg(), calculateMax(), calculateMin(), calculateSum(), m_statusBar, STATUSBAR_PRECISION, and toString().

Referenced by createZeroElementTable(), OnCellRangeSelect(), OnCellSelect(), and SetData().

Here is the call graph for this function:

Member Data Documentation

◆ isGridNumeReTable

◆ lastCursorPosition

wxGridCellCoords TableViewer::lastCursorPosition
private

Definition at line 49 of file tableviewer.hpp.

◆ m_currentColTypes

std::vector<int> TableViewer::m_currentColTypes
private

◆ m_displayName

std::string TableViewer::m_displayName
private

Definition at line 52 of file tableviewer.hpp.

Referenced by reloadTable(), saveTable(), and SetData().

◆ m_intName

std::string TableViewer::m_intName
private

Definition at line 53 of file tableviewer.hpp.

Referenced by reloadTable(), and SetData().

◆ m_lastRightClick

wxGridCellCoords TableViewer::m_lastRightClick
private

◆ m_parentPanel

TablePanel* TableViewer::m_parentPanel
private

◆ m_popUpMenu

wxMenu TableViewer::m_popUpMenu
private

Definition at line 96 of file tableviewer.hpp.

Referenced by OnCellRightClick(), OnLabelRightClick(), and SetTableReadOnly().

◆ m_statusBar

wxStatusBar* TableViewer::m_statusBar
private

Definition at line 57 of file tableviewer.hpp.

Referenced by updateStatusBar().

◆ nFirstNumRow

◆ nHeight

size_t TableViewer::nHeight
private

Definition at line 44 of file tableviewer.hpp.

Referenced by GetHeight(), and layoutGrid().

◆ nWidth

size_t TableViewer::nWidth
private

Definition at line 45 of file tableviewer.hpp.

Referenced by GetWidth(), and layoutGrid().

◆ readOnly

bool TableViewer::readOnly
private

◆ selectedCells

wxGridCellCoordsArray TableViewer::selectedCells
private

Definition at line 50 of file tableviewer.hpp.

Referenced by OnCellRangeSelect().


The documentation for this class was generated from the following files: