scidavis  2.3.0
About: SciDAVis is a free application for Scientific Data Analysis and Visualization (a fork off of QtiPlot).
  Fossies Dox: scidavis-2.3.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

future::Table Class Reference

Aspect providing a spreadsheet table with column logic. More...

#include <future_Table.h>

Inheritance diagram for future::Table:
[legend]
Collaboration diagram for future::Table:
[legend]

Classes

class  Private
 

Public Slots

virtual void copy ()
 Copy current selection. More...
 

Public Member Functions

 Table (AbstractScriptingEngine *engine, int rows, int columns, const QString &name)
 
virtual ~Table ()
 
void setView (TableView *view)
 set's the view attribute. Ownership not passed to this More...
 
virtual QIcon icon () const
 Return an icon to be used for decorating my views. More...
 
virtual QMenu * createContextMenu () const
 Return a new context menu. More...
 
virtual QWidget * view ()
 Construct a primary view on me. More...
 
void insertColumns (int before, QList< Column * > new_cols)
 Insert columns. More...
 
void appendColumns (QList< Column * > new_cols)
 Append columns. More...
 
void removeColumns (int first, int count)
 
void removeColumn (Column *col)
 
void removeRows (int first, int count)
 
void insertRows (int before, int count)
 
void appendRows (int count)
 
void setRowCount (int new_size)
 Set the number of rows of the table. More...
 
int columnCount () const
 Return the total number of columns in the table. More...
 
int rowCount () const
 Return the total number of rows in the table. More...
 
int columnCount (SciDAVis::PlotDesignation pd) const
 Return the number of columns matching the given designation. More...
 
Columncolumn (int index) const
 Return column number 'index'. More...
 
Columncolumn (const QString &name, bool legacy_kludge=true) const
 Return the column determined by the given name. More...
 
int columnIndex (const Column *col) const
 
void setColumnCount (int new_size)
 Set the number of columns. More...
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const
 
QMenu * createSelectionMenu (QMenu *append_to=0)
 Create a menu with selection related operations. More...
 
QMenu * createColumnMenu (QMenu *append_to=0)
 Create a menu with column related operations. More...
 
QMenu * createRowMenu (QMenu *append_to=0)
 Create a menu with row related operations. More...
 
QMenu * createTableMenu (QMenu *append_to=0)
 Create a menu with table related operations. More...
 
virtual bool fillProjectMenu (QMenu *menu)
 Fill the part specific menu for the main window including setting the title. More...
 
virtual bool fillProjectToolBar (QToolBar *bar)
 Fill the part specific tool bar for the main window including setting the title. More...
 
int colX (int col)
 Determine the corresponding X column. More...
 
int colY (int col)
 Determine the corresponding Y column. More...
 
void setPlotMenu (QMenu *menu)
 Set a plot menu. More...
 
void sortDialog (QList< Column * > cols)
 Open the sort dialog for the given columns. More...
 
QString text (int row, int col)
 Return the text displayed in the given cell. More...
 
void setSelectionAs (SciDAVis::PlotDesignation pd)
 
void copy (Table *other)
 
PartMdiViewmdiSubWindow ()
 Wrap the view() into a PartMdiView. More...
 
virtual void cut ()
 Cut current selection. More...
 
virtual void paste ()
 Paste at the current location or into the current selection. More...
 
AbstractAspectparentAspect () const
 Return my parent Aspect or 0 if I currently don't have one. More...
 
future::Folderfolder ()
 Return the folder the Aspect is contained in or 0 if not. More...
 
bool isDescendantOf (AbstractAspect *other)
 Return whether the there is a path upwards to the given aspect. More...
 
void addChild (AbstractAspect *child)
 Add the given Aspect to my list of children. More...
 
void insertChild (AbstractAspect *child, int index)
 Insert the given Aspect at a specific position in my list of children. More...
 
void removeChild (AbstractAspect *child, bool detach=false)
 Remove the given Aspect from my list of children. More...
 
void removeChild (int index)
 Remove the Aspect at the given index from my list of children. More...
 
AbstractAspectchild (int index) const
 Get a child by its position in my list of children. More...
 
int childCount () const
 Return the number of child Aspects. More...
 
int indexOfChild (const AbstractAspect *child) const
 Return the position of child in my list of children. More...
 
int index () const
 Return my position in my parent's list of children. More...
 
void moveChild (int from, int to)
 Change the positon of a child in my list of children. More...
 
void reparentChild (AbstractAspect *new_parent, AbstractAspect *child, int d_new_index)
 Move a child to another aspect and transfer ownership. More...
 
void reparentChild (AbstractAspect *new_parent, AbstractAspect *child)
 Move a child to another aspect and transfer ownership. More...
 
QList< AbstractAspect * > descendantsThatInherit (const char *class_name)
 Get all descendents that inherit the given class. More...
 
virtual void removeAllChildAspects ()
 Remove all child aspects. More...
 
virtual const Projectproject () const
 Return the Project this Aspect belongs to, or 0 if it is currently not part of one. More...
 
virtual Projectproject ()
 Return the Project this Aspect belongs to, or 0 if it is currently not part of one. More...
 
virtual QString path () const
 Return the path that leads from the top-most Aspect (usually a Project) to me. More...
 
QString name () const
 
QString comment () const
 
QString captionSpec () const
 Return the specification string used for constructing the caption(). More...
 
QDateTime creationTime () const
 
QString caption () const
 
void scriptingChangeEvent (ScriptingChangeEvent *)
 

Static Public Member Functions

static void setDefaultCommentVisibility (bool visible)
 Set default for comment visibility for table views. More...
 
static bool defaultCommentVisibility ()
 Return the default for comment visibility for table views. More...
 

Protected Attributes

ScriptingEnvscriptEnv
 

Private Attributes

PartMdiViewd_mdi_window
 The MDI sub-window that is wrapped around my primary view. More...
 
selection related actions
QAction * action_cut_selection
 
QAction * action_copy_selection
 
QAction * action_paste_into_selection
 
QAction * action_mask_selection
 
QAction * action_unmask_selection
 
QAction * action_set_formula
 
QAction * action_clear_selection
 
QAction * action_recalculate
 
QAction * action_fill_row_numbers
 
QAction * action_fill_random
 
QAction * action_normalize_selection
 
table related actions
QAction * action_toggle_comments
 
QAction * action_toggle_tabbar
 
QAction * action_select_all
 
QAction * action_add_column
 
QAction * action_clear_table
 
QAction * action_export_to_TeX
 
QAction * action_clear_masks
 
QAction * action_sort_table
 
QAction * action_go_to_cell
 
QAction * action_dimensions_dialog
 
QAction * action_formula_mode
 
column related actions
QAction * action_insert_columns
 
QAction * action_remove_columns
 
QAction * action_clear_columns
 
QAction * action_add_columns
 
QAction * action_set_as_x
 
QAction * action_set_as_y
 
QAction * action_set_as_z
 
QAction * action_set_as_xerr
 
QAction * action_set_as_yerr
 
QAction * action_set_as_none
 
QAction * action_normalize_columns
 
QAction * action_sort_columns
 
QAction * action_statistics_columns
 
QAction * action_type_format
 
QAction * action_edit_description
 
row related actions
QAction * action_insert_rows
 
QAction * action_remove_rows
 
QAction * action_clear_rows
 
QAction * action_add_rows
 
QAction * action_statistics_rows
 
QPointer< TableViewd_view
 
Private d_table_private
 

Friends

class Private
 

undo related

virtual QUndoStack * undoStack () const
 Return the undo stack of the Project, or 0 if this Aspect is not part of a Project. More...
 
void exec (QUndoCommand *command)
 Execute the given command, pushing it on the undoStack() if available. More...
 
void beginMacro (const QString &text)
 Begin an undo stack macro (series of commands) More...
 
void endMacro ()
 End the undo stack macro. More...
 
static QVariant global (const QString &key)
 Retrieve a global setting. More...
 
static void setGlobal (const QString &key, const QVariant &value)
 Update a global setting. More...
 
static void setGlobalDefault (const QString &key, const QVariant &value)
 Set default value for a global setting. More...
 

serialize/deserialize

Privated_aspect_private
 
void importV0x0001XXCreationTime (const QString &str)
 
void setName (const QString &value)
 
void setComment (const QString &value)
 
void setCaptionSpec (const QString &value)
 Set the specification string used for constructing the caption(). More...
 
virtual void remove ()
 Remove me from my parent's list of children. More...
 
QString uniqueNameFor (const QString &current_name) const
 Make the specified name unique among my children by incrementing a trailing number. More...
 
bool readBasicAttributes (XmlStreamReader *reader)
 Load name, creation time and caption spec from XML. More...
 
void writeBasicAttributes (QXmlStreamWriter *writer) const
 Save name, creation time and caption spec to XML. More...
 
void writeCommentElement (QXmlStreamWriter *writer) const
 Save the comment to XML. More...
 
bool readCommentElement (XmlStreamReader *reader)
 Load comment from an XML element. More...
 
void setCreationTime (const QDateTime &time)
 Set the creation time. More...
 
void info (const QString &text)
 Implementations should call this whenever status information should be given to the user. More...
 
void aspectDescriptionAboutToChange (const AbstractAspect *aspect)
 Emit this before the name, comment or caption spec is changed. More...
 
void aspectDescriptionChanged (const AbstractAspect *aspect)
 Emit this when the name, comment or caption spec changed. More...
 
void aspectAboutToBeAdded (const AbstractAspect *parent, int index)
 Emit this when a parent aspect is about to get a new child inserted. More...
 
void aspectAdded (const AbstractAspect *aspect)
 Emit this from a newly added aspect. More...
 
void aspectAdded (const AbstractAspect *parent, int index)
 Emit this from a parent after adding a new child to it. More...
 
void aspectAboutToBeRemoved (const AbstractAspect *aspect)
 Emit this from an aspect about to be removed from its parent's children. More...
 
void aspectAboutToBeRemoved (const AbstractAspect *parent, int index)
 Emit this from a parent before removing its child. More...
 
void aspectRemoved (const AbstractAspect *parent, int index)
 Emit this from the parent after removing a child. More...
 
void statusInfo (const QString &text)
 Emit this to give status information to the user. More...
 

serialize/deserialize

static ActionManageraction_manager = 0
 
static int default_column_width = 120
 
virtual void save (QXmlStreamWriter *) const
 Save as XML. More...
 
virtual bool load (XmlStreamReader *)
 Load from XML. More...
 
bool readColumnWidthElement (XmlStreamReader *reader)
 
void setColumnWidth (int col, int width)
 This method should only be called by the view. More...
 
int columnWidth (int col) const
 
static ActionManageractionManager ()
 
static void initActionManager ()
 
static int defaultColumnWidth ()
 
static void setDefaultColumnWidth (int width)
 
 Table ()
 Private ctor for initActionManager() only. More...
 
void connectColumn (const Column *col)
 Internal function to connect all column signals. More...
 
void disconnectColumn (const Column *col)
 Internal function to disconnect a column. More...
 
void clear ()
 Clear the whole table. More...
 
void clearMasks ()
 Clear all mask in the table. More...
 
void addColumn ()
 Append one column. More...
 
void addColumns ()
 Append as many columns as are selected. More...
 
void addRows ()
 Append as many rows as are selected. More...
 
void cutSelection ()
 
void copySelection ()
 
void pasteIntoSelection ()
 
void clearSelectedCells ()
 
void goToCell ()
 
void maskSelection ()
 
void unmaskSelection ()
 
void setFormulaForSelection ()
 
void recalculateSelectedCells ()
 
void fillSelectedCellsWithRowNumbers ()
 
void fillSelectedCellsWithRandomNumbers ()
 
void sortTable ()
 Open the sort dialog for all columns. More...
 
void insertEmptyColumns ()
 Insert columns depending on the selection. More...
 
void removeSelectedColumns ()
 
void clearSelectedColumns ()
 
void setSelectedColumnsAsX ()
 
void setSelectedColumnsAsY ()
 
void setSelectedColumnsAsZ ()
 
void setSelectedColumnsAsXError ()
 
void setSelectedColumnsAsYError ()
 
void setSelectedColumnsAsNone ()
 
void normalizeColumns (QList< Column * > cols)
 
void normalizeSelectedColumns ()
 
void normalizeSelection ()
 
void sortSelectedColumns ()
 
void statisticsOnSelectedColumns ()
 
void statisticsOnSelectedRows ()
 
void insertEmptyRows ()
 Insert rows depending on the selection. More...
 
void removeSelectedRows ()
 
void selectAll ()
 
void dimensionsDialog ()
 
void editTypeAndFormatOfSelectedColumns ()
 
void editDescriptionOfCurrentColumn ()
 
void moveColumn (int from, int to)
 
void sortColumns (Column *leading, QList< Column * > cols, bool ascending)
 Sort the given list of column. More...
 
void showTableViewContextMenu (const QPoint &pos)
 Show a context menu for the selected cells. More...
 
void showTableViewColumnContextMenu (const QPoint &pos)
 Show a context menu for the selected columns. More...
 
void showTableViewRowContextMenu (const QPoint &pos)
 Show a context menu for the selected rows. More...
 
void showTeXTableExportDialog ()
 Open export to TeX dialog. More...
 
bool export_to_TeX (QString fileName, TeXTableSettings &tex_settings)
 Export to TeX. More...
 
virtual void completeAspectInsertion (AbstractAspect *aspect, int index)
 Called after a new child has been inserted or added. More...
 
virtual void prepareAspectRemoval (AbstractAspect *aspect)
 Called before a child is removed. More...
 

Column event handlers

static bool d_default_comment_visibility = false
 
QMenu * d_plot_menu
 
void createActions ()
 
void connectActions ()
 
void addActionsToView ()
 
void translateActionsStrings ()
 
void handleDescriptionChange (const AbstractAspect *aspect)
 
void handleModeChange (const AbstractColumn *col)
 
void handlePlotDesignationChange (const AbstractColumn *col)
 
void handleDataChange (const AbstractColumn *col)
 
void handleRowsAboutToBeInserted (const AbstractColumn *col, int before, int count)
 
void handleRowsInserted (const AbstractColumn *col, int before, int count)
 
void handleRowsAboutToBeRemoved (const AbstractColumn *col, int first, int count)
 
void handleRowsRemoved (const AbstractColumn *col, int first, int count)
 
void adjustActionNames ()
 
void columnsAboutToBeInserted (int before, QList< Column * > new_cols)
 
void columnsInserted (int first, int count)
 
void columnsAboutToBeReplaced (int first, int count)
 
void columnsReplaced (int first, int count)
 
void columnsAboutToBeRemoved (int first, int count)
 
void columnsRemoved (int first, int count)
 
void rowsAboutToBeInserted (int before, int count)
 
void rowsInserted (int first, int count)
 
void rowsAboutToBeRemoved (int first, int count)
 
void rowsRemoved (int first, int count)
 
void dataChanged (int top, int left, int bottom, int right)
 
void headerDataChanged (Qt::Orientation orientation, int first, int last)
 

Detailed Description

Aspect providing a spreadsheet table with column logic.

This class (incl. Table::Private and its commands) is one aspect in the projet hierarchy that represents a spreadsheet table with column logic. Table provides the public API while Table::Private completely encapsulates the data. The table commands (derived from QUndoCommand) encapsulate all write operations which can be undone and redone, if the table has an undo stack associated with it (usually by the project root aspect).

The underlying private data object is not visible to any classes other then those meantioned above with one exeption: Pointers to columns can be passed around an manipulated directly. The owner Table (parent aspect of the Column objects) will be notified by emission of signals and react accordingly. All public methods of Table and Column are undo aware.

Table also manages its main view of class TableView. Table and TableView can call each others API in both directions. User interaction ist party handled in TableView and translated into Table API calls (e.g., when a user edits a cell this will be handled by the delegate of TableView and Table will not know whether a script or a user changed the data.). Other parts of the user interaction are handled by actions provides by Table, e.g., via a context menu.

Selections are handled by TableView and can be queried by Table. All selection based functions do nothing unless the view exists. The view is created by the first call to view();

Definition at line 82 of file future_Table.h.

Constructor & Destructor Documentation

◆ Table() [1/2]

Table::Table ( AbstractScriptingEngine *  engine,
int  rows,
int  columns,
const QString &  name 
)

Definition at line 91 of file future_Table.cpp.

92  : AbstractPart(name), d_plot_menu(0), scripted(engine), d_table_private(*this)
93 #else
94 Table::Table(int rows, int columns, const QString& name)
96 #endif
97 {
98  // set initial number of rows and columns
99  QList<Column*> cols;
100  for(int i=0; i<columns; i++)
101  {
102  Column * new_col = new Column(QString::number(i+1), SciDAVis::Numeric);
103  new_col->setPlotDesignation(i == 0 ? SciDAVis::X : SciDAVis::Y);
104  cols << new_col;
105  }
106  appendColumns(cols);
107  setRowCount(rows);
108 
109  d_view = NULL;
110  createActions();
111  connectActions();
112 }

References appendColumns(), connectActions(), createActions(), d_view, SciDAVis::Numeric, Column::setPlotDesignation(), setRowCount(), SciDAVis::X, and SciDAVis::Y.

Here is the call graph for this function:

◆ ~Table()

Table::~Table ( )
virtual

Definition at line 126 of file future_Table.cpp.

127 {}

◆ Table() [2/2]

Table::Table ( )
private

Private ctor for initActionManager() only.

Definition at line 115 of file future_Table.cpp.

116  : AbstractPart("temp"), scripted(0)
117 #else
118 Table::Table()
119  : AbstractPart("temp"), d_table_private(*this)
120 #endif
121 {
122  d_view = NULL;
123  createActions();
124 }

References createActions(), and d_view.

Referenced by initActionManager().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ actionManager()

ActionManager * Table::actionManager ( )
static

Definition at line 2433 of file future_Table.cpp.

2434 {
2435  if (!action_manager)
2437 
2438  return action_manager;
2439 }

References action_manager, and initActionManager().

Referenced by createActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addActionsToView()

void Table::addActionsToView ( )
private

Definition at line 1373 of file future_Table.cpp.

1374 {
1375  connect(action_toggle_comments, SIGNAL(triggered()), d_view, SLOT(toggleComments()));
1376  connect(action_toggle_tabbar, SIGNAL(triggered()), d_view, SLOT(toggleControlTabBar()));
1377  connect(action_formula_mode, SIGNAL(toggled(bool)), d_view, SLOT(activateFormulaMode(bool)));
1378 
1379  d_view->addAction(action_cut_selection);
1380  d_view->addAction(action_copy_selection);
1381  d_view->addAction(action_paste_into_selection);
1382 #ifndef LEGACY_CODE_0_2_x
1383  d_view->addAction(action_mask_selection);
1384  d_view->addAction(action_unmask_selection);
1385 #endif
1386  d_view->addAction(action_set_formula);
1387  d_view->addAction(action_clear_selection);
1388  d_view->addAction(action_recalculate);
1389  d_view->addAction(action_fill_row_numbers);
1390  d_view->addAction(action_fill_random);
1391  d_view->addAction(action_toggle_comments);
1392  d_view->addAction(action_toggle_tabbar);
1393  d_view->addAction(action_formula_mode);
1394  d_view->addAction(action_select_all);
1395  d_view->addAction(action_add_column);
1396  d_view->addAction(action_clear_table);
1397  d_view->addAction(action_export_to_TeX);
1398 #ifndef LEGACY_CODE_0_2_x
1399  d_view->addAction(action_clear_masks);
1400 #endif
1401  d_view->addAction(action_sort_table);
1402  d_view->addAction(action_go_to_cell);
1403  d_view->addAction(action_dimensions_dialog);
1404  d_view->addAction(action_insert_columns);
1405  d_view->addAction(action_remove_columns);
1406  d_view->addAction(action_clear_columns);
1407  d_view->addAction(action_add_columns);
1408  d_view->addAction(action_set_as_x);
1409  d_view->addAction(action_set_as_y);
1410  d_view->addAction(action_set_as_z);
1411  d_view->addAction(action_set_as_xerr);
1412  d_view->addAction(action_set_as_yerr);
1413  d_view->addAction(action_set_as_none);
1414  d_view->addAction(action_normalize_columns);
1415  d_view->addAction(action_normalize_selection);
1416  d_view->addAction(action_sort_columns);
1417  d_view->addAction(action_statistics_columns);
1418  d_view->addAction(action_type_format);
1419  d_view->addAction(action_edit_description);
1420  d_view->addAction(action_insert_rows);
1421  d_view->addAction(action_remove_rows);
1422  d_view->addAction(action_clear_rows);
1423  d_view->addAction(action_add_rows);
1424  d_view->addAction(action_statistics_rows);
1425 }

References action_add_column, action_add_columns, action_add_rows, action_clear_columns, action_clear_masks, action_clear_rows, action_clear_selection, action_clear_table, action_copy_selection, action_cut_selection, action_dimensions_dialog, action_edit_description, action_export_to_TeX, action_fill_random, action_fill_row_numbers, action_formula_mode, action_go_to_cell, action_insert_columns, action_insert_rows, action_mask_selection, action_normalize_columns, action_normalize_selection, action_paste_into_selection, action_recalculate, action_remove_columns, action_remove_rows, action_select_all, action_set_as_none, action_set_as_x, action_set_as_xerr, action_set_as_y, action_set_as_yerr, action_set_as_z, action_set_formula, action_sort_columns, action_sort_table, action_statistics_columns, action_statistics_rows, action_toggle_comments, action_toggle_tabbar, action_type_format, action_unmask_selection, and d_view.

Referenced by setView().

Here is the caller graph for this function:

◆ addChild()

void AbstractAspect::addChild ( AbstractAspect child)
inherited

Add the given Aspect to my list of children.

Definition at line 114 of file AbstractAspect.cpp.

115 {
116  Q_CHECK_PTR(child);
117  QString new_name = d_aspect_private->uniqueNameFor(child->name());
118  beginMacro(tr("%1: add %2.").arg(name()).arg(new_name));
119  if (new_name != child->name()) {
120  info(tr("Renaming \"%1\" to \"%2\" in order to avoid name collision.").arg(child->name()).arg(new_name));
121  child->setName(new_name);
122  }
125  endMacro();
126 }

References AbstractAspect::beginMacro(), AbstractAspect::child(), AbstractAspect::Private::childCount(), AbstractAspect::completeAspectInsertion(), AbstractAspect::d_aspect_private, AbstractAspect::endMacro(), AbstractAspect::exec(), AbstractAspect::info(), AbstractAspect::name(), AbstractAspect::setName(), and AbstractAspect::Private::uniqueNameFor().

Referenced by AbstractSimpleFilter::AbstractSimpleFilter(), Column::Column(), ApplicationWindow::convertMatrixToTable(), ApplicationWindow::convertTableToMatrix(), future::Matrix::duplicate(), ApplicationWindow::importImage(), Column::init(), ApplicationWindow::newMatrix(), ApplicationWindow::newTable(), ApplicationWindow::newTableStatistics(), future::Folder::readChildAspectElement(), and Column::setColumnMode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addColumn

void Table::addColumn ( )
slot

Append one column.

Definition at line 320 of file future_Table.cpp.

321 {
322  WAIT_CURSOR;
323  beginMacro(QObject::tr("%1: add column").arg(name()));
325  endMacro();
326  RESET_CURSOR;
327 }

References AbstractAspect::beginMacro(), columnCount(), AbstractAspect::endMacro(), AbstractAspect::name(), RESET_CURSOR, setColumnCount(), and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addColumns

void Table::addColumns ( )
slot

Append as many columns as are selected.

Definition at line 329 of file future_Table.cpp.

330 {
331  if (!d_view) return;
332  WAIT_CURSOR;
333  int count = d_view->selectedColumnCount(false);
334  beginMacro(QObject::tr("%1: add %2 column(s)").arg(name()).arg(count));
335  setColumnCount(columnCount() + count);
336  endMacro();
337  RESET_CURSOR;
338 }

References AbstractAspect::beginMacro(), columnCount(), d_view, AbstractAspect::endMacro(), AbstractAspect::name(), RESET_CURSOR, setColumnCount(), and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addRows

void Table::addRows ( )
slot

Append as many rows as are selected.

Definition at line 976 of file future_Table.cpp.

977 {
978  if (!d_view) return;
979  WAIT_CURSOR;
980  int count = d_view->selectedRowCount(false);
981  beginMacro(QObject::tr("%1: add %2 rows(s)").arg(name()).arg(count));
983  endMacro();
984  RESET_CURSOR;
985 }

References AbstractAspect::beginMacro(), d_table_private, d_view, AbstractAspect::endMacro(), AbstractAspect::exec(), AbstractAspect::name(), RESET_CURSOR, rowCount(), and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ adjustActionNames

void Table::adjustActionNames ( )
privateslot

Definition at line 2377 of file future_Table.cpp.

2378 {
2379  if (!d_view) return;
2380 
2381  QString action_name;
2382  if(d_view->areCommentsShown())
2383  action_name = tr("Hide Comments");
2384  else
2385  action_name = tr("Show Comments");
2386  action_toggle_comments->setText(action_name);
2387 
2388  if(d_view->isControlTabBarVisible())
2389  action_name = tr("Hide Controls");
2390  else
2391  action_name = tr("Show Controls");
2392  action_toggle_tabbar->setText(action_name);
2393 }

References action_toggle_comments, action_toggle_tabbar, and d_view.

Referenced by createColumnMenu(), createTableMenu(), and fillProjectMenu().

Here is the caller graph for this function:

◆ appendColumns()

void future::Table::appendColumns ( QList< Column * >  new_cols)
inline

Append columns.

Definition at line 132 of file future_Table.h.

132 { insertColumns(columnCount(), new_cols); }

References columnCount(), and insertColumns().

Referenced by copy(), AsciiTableImportFilter::importAspect(), load(), pasteIntoSelection(), setColumnCount(), and Table().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendRows()

void future::Table::appendRows ( int  count)
inline

Definition at line 137 of file future_Table.h.

137 { insertRows(rowCount(), count); }

References insertRows(), and rowCount().

Referenced by pasteIntoSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ aspectAboutToBeAdded

void AbstractAspect::aspectAboutToBeAdded ( const AbstractAspect parent,
int  index 
)
signalinherited

Emit this when a parent aspect is about to get a new child inserted.

Referenced by AbstractAspect::Private::insertChild().

Here is the caller graph for this function:

◆ aspectAboutToBeRemoved [1/2]

void AbstractAspect::aspectAboutToBeRemoved ( const AbstractAspect aspect)
signalinherited

Emit this from an aspect about to be removed from its parent's children.

Referenced by AbstractAspect::Private::insertChild(), and AbstractAspect::Private::removeChild().

Here is the caller graph for this function:

◆ aspectAboutToBeRemoved [2/2]

void AbstractAspect::aspectAboutToBeRemoved ( const AbstractAspect parent,
int  index 
)
signalinherited

Emit this from a parent before removing its child.

◆ aspectAdded [1/2]

void AbstractAspect::aspectAdded ( const AbstractAspect aspect)
signalinherited

Emit this from a newly added aspect.

Referenced by AbstractAspect::Private::insertChild().

Here is the caller graph for this function:

◆ aspectAdded [2/2]

void AbstractAspect::aspectAdded ( const AbstractAspect parent,
int  index 
)
signalinherited

Emit this from a parent after adding a new child to it.

◆ aspectDescriptionAboutToChange

void AbstractAspect::aspectDescriptionAboutToChange ( const AbstractAspect aspect)
signalinherited

Emit this before the name, comment or caption spec is changed.

Referenced by AbstractFilter::input(), and AbstractAspect::Private::insertChild().

Here is the caller graph for this function:

◆ aspectDescriptionChanged

void AbstractAspect::aspectDescriptionChanged ( const AbstractAspect aspect)
signalinherited

Emit this when the name, comment or caption spec changed.

Referenced by connectColumn(), AbstractFilter::input(), AbstractAspect::Private::insertChild(), and Column::notifyDisplayChange().

Here is the caller graph for this function:

◆ aspectRemoved

void AbstractAspect::aspectRemoved ( const AbstractAspect parent,
int  index 
)
signalinherited

Emit this from the parent after removing a child.

Referenced by AbstractAspect::Private::insertChild(), and AbstractAspect::Private::removeChild().

Here is the caller graph for this function:

◆ beginMacro()

void AbstractAspect::beginMacro ( const QString &  text)
inherited

Begin an undo stack macro (series of commands)

Definition at line 215 of file AbstractAspect.cpp.

216 {
217  QUndoStack *stack = undoStack();
218  if (stack)
219  stack->beginMacro(text);
220 }

References AbstractAspect::undoStack().

Referenced by AbstractAspect::addChild(), addColumn(), future::Matrix::addColumns(), addColumns(), future::Matrix::addRows(), addRows(), Matrix::applyFormula(), TableView::applyType(), future::Matrix::clear(), clear(), clearMasks(), future::Matrix::clearSelectedCells(), clearSelectedCells(), future::Matrix::clearSelectedColumns(), clearSelectedColumns(), future::Matrix::clearSelectedRows(), future::Matrix::copy(), copy(), future::Matrix::cutSelection(), cutSelection(), fillSelectedCellsWithRandomNumbers(), fillSelectedCellsWithRowNumbers(), AbstractAspect::insertChild(), future::Matrix::insertColumns(), insertColumns(), future::Matrix::insertEmptyColumns(), insertEmptyColumns(), future::Matrix::insertEmptyRows(), insertEmptyRows(), future::Matrix::insertRows(), insertRows(), maskSelection(), moveColumn(), normalizeColumns(), normalizeSelection(), future::Matrix::pasteIntoSelection(), pasteIntoSelection(), recalculateSelectedCells(), AbstractAspect::removeAllChildAspects(), AbstractAspect::removeChild(), future::Matrix::removeColumns(), removeColumns(), future::Matrix::removeRows(), removeRows(), future::Matrix::removeSelectedColumns(), removeSelectedColumns(), future::Matrix::removeSelectedRows(), removeSelectedRows(), AbstractAspect::reparentChild(), Column::setColumnMode(), future::Matrix::setDimensions(), setRowCount(), setSelectionAs(), sortColumns(), and unmaskSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ caption()

QString AbstractAspect::caption ( ) const
inherited

Definition at line 293 of file AbstractAspect.cpp.

294 {
295  return d_aspect_private->caption();
296 }

References AbstractAspect::Private::caption(), and AbstractAspect::d_aspect_private.

Referenced by PartMdiView::handleAspectDescriptionChanged().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ captionSpec()

QString AbstractAspect::captionSpec ( ) const
inherited

Return the specification string used for constructing the caption().

See setCaptionSpec() for format.

Definition at line 271 of file AbstractAspect.cpp.

272 {
273  return d_aspect_private->captionSpec();
274 }

References AbstractAspect::Private::captionSpec(), and AbstractAspect::d_aspect_private.

Referenced by copy(), and AbstractAspect::writeBasicAttributes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ child()

AbstractAspect * AbstractAspect::child ( int  index) const
inherited

Get a child by its position in my list of children.

Definition at line 180 of file AbstractAspect.cpp.

181 {
182  Q_ASSERT(index >= 0 && index <= childCount());
183  return d_aspect_private->child(index);
184 }

References AbstractAspect::Private::child(), AbstractAspect::childCount(), AbstractAspect::d_aspect_private, and AbstractAspect::index().

Referenced by AbstractAspect::addChild(), AbstractAspect::Private::addChild(), AbstractAspect::descendantsThatInherit(), ApplicationWindow::handleAspectAboutToBeRemoved(), ApplicationWindow::handleAspectAdded(), AbstractAspect::indexOfChild(), AbstractAspect::Private::indexOfChild(), AbstractAspect::insertChild(), AbstractAspect::Private::insertChild(), AbstractAspect::Private::removeChild(), AbstractAspect::removeChild(), AbstractAspect::reparentChild(), future::Folder::save(), AbstractAspect::Private::uniqueNameFor(), and AbstractAspect::Private::~Private().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ childCount()

int AbstractAspect::childCount ( ) const
inherited

Return the number of child Aspects.

Definition at line 186 of file AbstractAspect.cpp.

187 {
188  return d_aspect_private->childCount();
189 }

References AbstractAspect::Private::childCount(), and AbstractAspect::d_aspect_private.

Referenced by AbstractAspect::Private::child(), AbstractAspect::child(), AbstractAspect::descendantsThatInherit(), AbstractAspect::moveChild(), AbstractAspect::removeAllChildAspects(), AbstractAspect::removeChild(), AbstractAspect::reparentChild(), and future::Folder::save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear

void Table::clear ( )
slot

Clear the whole table.

Definition at line 296 of file future_Table.cpp.

297 {
298  WAIT_CURSOR;
299  beginMacro(QObject::tr("%1: clear").arg(name()));
300  int cols = columnCount();
301  for(int i=0; i<cols; i++)
302  column(i)->clear();
303  endMacro();
304  RESET_CURSOR;
305 }

References AbstractAspect::beginMacro(), Column::clear(), column(), columnCount(), AbstractAspect::endMacro(), AbstractAspect::name(), RESET_CURSOR, and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearMasks

void Table::clearMasks ( )
slot

Clear all mask in the table.

Definition at line 308 of file future_Table.cpp.

309 {
310  WAIT_CURSOR;
311  beginMacro(QObject::tr("%1: clear all masks").arg(name()));
312  int cols = columnCount();
313  for(int i=0; i<cols; i++)
314  column(i)->clearMasks();
315  endMacro();
316  RESET_CURSOR;
317 }

References AbstractAspect::beginMacro(), Column::clearMasks(), column(), columnCount(), AbstractAspect::endMacro(), AbstractAspect::name(), RESET_CURSOR, and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearSelectedCells

void Table::clearSelectedCells ( )
slot

Definition at line 933 of file future_Table.cpp.

934 {
935  if (!d_view) return;
936  int first = d_view->firstSelectedRow();
937  // because this is not marked constant, we'd better call it.
938  d_view->lastSelectedRow();
939  if( first < 0 ) return;
940 
941  WAIT_CURSOR;
942  beginMacro(QObject::tr("%1: clear selected cell(s)").arg(name()));
943  QList<Column*> list = d_view->selectedColumns();
944  foreach(Column * col_ptr, list)
945  {
946  if (d_view->formulaModeActive())
947  foreach(Interval<int> i, d_view->selectedRows().intervals())
948  col_ptr->setFormula(i, "");
949  else
950  foreach(Interval<int> i, d_view->selectedRows().intervals())
951  if (i.end() == col_ptr->rowCount()-1)
952  col_ptr->removeRows(i.start(), i.size());
953  else {
954  QStringList empties;
955  for (int j=0; j<i.size(); j++)
956  empties << QString();
957  col_ptr->asStringColumn()->replaceTexts(i.start(), empties);
958  }
959  }
960  endMacro();
961  RESET_CURSOR;
962 }

References Column::asStringColumn(), AbstractAspect::beginMacro(), d_view, AbstractAspect::endMacro(), AbstractAspect::name(), Column::removeRows(), ColumnStringIO::replaceTexts(), RESET_CURSOR, Column::rowCount(), Column::setFormula(), Interval< T >::size(), and WAIT_CURSOR.

Referenced by connectActions(), and cutSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearSelectedColumns

void Table::clearSelectedColumns ( )
slot

Definition at line 740 of file future_Table.cpp.

741 {
742  if (!d_view) return;
743  WAIT_CURSOR;
744  beginMacro(QObject::tr("%1: clear selected column(s)").arg(name()));
745 
746  QList< Column* > list = d_view->selectedColumns();
747  if (d_view->formulaModeActive())
748  {
749  foreach(Column* ptr, list)
750  ptr->clearFormulas();
751  }
752  else
753  {
754  foreach(Column* ptr, list)
755  ptr->clear();
756  }
757 
758  endMacro();
759  RESET_CURSOR;
760 }

References AbstractAspect::beginMacro(), Column::clear(), Column::clearFormulas(), d_view, AbstractAspect::endMacro(), AbstractAspect::name(), RESET_CURSOR, and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ column() [1/2]

Column * Table::column ( const QString &  name,
bool  legacy_kludge = true 
) const

Return the column determined by the given name.

This method should not be used unless absolutely necessary. Columns should be addressed by their index. This method is mainly meant to be used in scripts.

Definition at line 134 of file future_Table.cpp.

135 {
136  // TODO for 0.3.0: remove all name concatenation with _ in favor of Column * pointers
137  int pos=name.indexOf("_",Qt::CaseInsensitive);
138  QString label=name.right(name.length()-pos-1);
139  for (int i=0; i<columnCount(); i++)
140  {
141  Column *col = d_table_private.column(i);
142  if (col->name() == name || (legacy_kludge && col->name() == label))
143  return col;
144  }
145 
146  return NULL;
147 }

References future::Table::Private::column(), columnCount(), d_table_private, and AbstractAspect::name().

Here is the call graph for this function:

◆ column() [2/2]

Column * Table::column ( int  index) const

Return column number 'index'.

Definition at line 129 of file future_Table.cpp.

130 {
131  return d_table_private.column(index);
132 }

References future::Table::Private::column(), d_table_private, and AbstractAspect::index().

Referenced by clear(), clearMasks(), columnCount(), colX(), colY(), completeAspectInsertion(), copy(), copySelection(), export_to_TeX(), Table::importASCII(), load(), prepareAspectRemoval(), save(), sortTable(), and text().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ columnCount() [1/2]

int Table::columnCount ( ) const

Return the total number of columns in the table.

Definition at line 248 of file future_Table.cpp.

249 {
250  return d_table_private.columnCount();
251 }

References future::Table::Private::columnCount(), and d_table_private.

Referenced by addColumn(), addColumns(), appendColumns(), clear(), clearMasks(), column(), columnCount(), colX(), colY(), copy(), dimensionsDialog(), export_to_TeX(), goToCell(), handlePlotDesignationChange(), Table::importASCII(), insertColumns(), load(), pasteIntoSelection(), removeColumns(), save(), setColumnCount(), and sortTable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ columnCount() [2/2]

int Table::columnCount ( SciDAVis::PlotDesignation  pd) const

Return the number of columns matching the given designation.

Definition at line 258 of file future_Table.cpp.

259 {
260  int count = 0;
261  int cols = columnCount();
262  for(int i=0; i<cols; i++)
263  if(column(i)->plotDesignation() == pd) count++;
264 
265  return count;
266 }

References column(), and columnCount().

Here is the call graph for this function:

◆ columnIndex()

int Table::columnIndex ( const Column col) const

Definition at line 291 of file future_Table.cpp.

292 {
293  return d_table_private.columnIndex(col);
294 }

References future::Table::Private::columnIndex(), and d_table_private.

Referenced by fillSelectedCellsWithRandomNumbers(), fillSelectedCellsWithRowNumbers(), handleDataChange(), handleDescriptionChange(), handleModeChange(), handlePlotDesignationChange(), handleRowsInserted(), handleRowsRemoved(), maskSelection(), normalizeSelection(), prepareAspectRemoval(), removeColumn(), and unmaskSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ columnsAboutToBeInserted

void future::Table::columnsAboutToBeInserted ( int  before,
QList< Column * >  new_cols 
)
signal

◆ columnsAboutToBeRemoved

void future::Table::columnsAboutToBeRemoved ( int  first,
int  count 
)
signal

◆ columnsAboutToBeReplaced

void future::Table::columnsAboutToBeReplaced ( int  first,
int  count 
)
signal

◆ columnsInserted

void future::Table::columnsInserted ( int  first,
int  count 
)
signal

◆ columnsRemoved

void future::Table::columnsRemoved ( int  first,
int  count 
)
signal

◆ columnsReplaced

void future::Table::columnsReplaced ( int  first,
int  count 
)
signal

◆ columnWidth()

int Table::columnWidth ( int  col) const

Definition at line 2424 of file future_Table.cpp.

2425 {
2426  return d_table_private.columnWidth(col);
2427 }

References future::Table::Private::columnWidth(), and d_table_private.

Referenced by copy(), and save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ colX()

int Table::colX ( int  col)

Determine the corresponding X column.

Definition at line 1851 of file future_Table.cpp.

1852 {
1853  for(int i=col-1; i>=0; i--)
1854  {
1855  if (column(i)->plotDesignation() == SciDAVis::X)
1856  return i;
1857  }
1858  int cols = columnCount();
1859  for(int i=col+1; i<cols; i++)
1860  {
1861  if (column(i)->plotDesignation() == SciDAVis::X)
1862  return i;
1863  }
1864  return -1;
1865 }

References column(), columnCount(), and SciDAVis::X.

Here is the call graph for this function:

◆ colY()

int Table::colY ( int  col)

Determine the corresponding Y column.

Definition at line 1867 of file future_Table.cpp.

1868 {
1869  int cols = columnCount();
1870 
1871  if (column(col)->plotDesignation() == SciDAVis::xErr ||
1872  column(col)->plotDesignation() == SciDAVis::yErr) {
1873  // look to the left first
1874  for(int i=col-1; i>=0; i--) {
1875  if (column(i)->plotDesignation() == SciDAVis::Y)
1876  return i;
1877  }
1878  for(int i=col+1; i<cols; i++) {
1879  if (column(i)->plotDesignation() == SciDAVis::Y)
1880  return i;
1881  }
1882  } else {
1883  // look to the right first
1884  for(int i=col+1; i<cols; i++) {
1885  if (column(i)->plotDesignation() == SciDAVis::Y)
1886  return i;
1887  }
1888  for(int i=col-1; i>=0; i--) {
1889  if (column(i)->plotDesignation() == SciDAVis::Y)
1890  return i;
1891  }
1892  }
1893  return -1;
1894 }

References column(), columnCount(), SciDAVis::xErr, SciDAVis::Y, and SciDAVis::yErr.

Here is the call graph for this function:

◆ comment()

QString AbstractAspect::comment ( ) const
inherited

Definition at line 260 of file AbstractAspect.cpp.

261 {
262  return d_aspect_private->comment();
263 }

References AbstractAspect::Private::comment(), and AbstractAspect::d_aspect_private.

Referenced by Table::colComment(), Table::colComments(), copy(), Table::saveComments(), TableView::setColumnForControlTabs(), Matrix::windowLabel(), and AbstractAspect::writeCommentElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ completeAspectInsertion()

void Table::completeAspectInsertion ( AbstractAspect aspect,
int  index 
)
protectedvirtual

Called after a new child has been inserted or added.

Unlike the aspectAdded() signals, this method does not get called inside undo/redo actions; allowing subclasses to execute undo commands of their own.

Reimplemented from AbstractAspect.

Definition at line 2269 of file future_Table.cpp.

2270 {
2271  Column * column = qobject_cast<Column *>(aspect);
2272  if (!column) return;
2273  QList<Column*> cols;
2274  cols.append(column);
2276 }

References column(), d_table_private, AbstractAspect::exec(), and AbstractAspect::index().

Here is the call graph for this function:

◆ connectActions()

void Table::connectActions ( )
private

Definition at line 1323 of file future_Table.cpp.

1324 {
1325  connect(action_cut_selection, SIGNAL(triggered()), this, SLOT(cutSelection()));
1326  connect(action_copy_selection, SIGNAL(triggered()), this, SLOT(copySelection()));
1327  connect(action_paste_into_selection, SIGNAL(triggered()), this, SLOT(pasteIntoSelection()));
1328 #ifndef LEGACY_CODE_0_2_x
1329  connect(action_mask_selection, SIGNAL(triggered()), this, SLOT(maskSelection()));
1330  connect(action_unmask_selection, SIGNAL(triggered()), this, SLOT(unmaskSelection()));
1331 #endif
1332  connect(action_set_formula, SIGNAL(triggered()), this, SLOT(setFormulaForSelection()));
1333  connect(action_clear_selection, SIGNAL(triggered()), this, SLOT(clearSelectedCells()));
1334  connect(action_recalculate, SIGNAL(triggered()), this, SLOT(recalculateSelectedCells()));
1335  connect(action_fill_row_numbers, SIGNAL(triggered()), this, SLOT(fillSelectedCellsWithRowNumbers()));
1336  connect(action_fill_random, SIGNAL(triggered()), this, SLOT(fillSelectedCellsWithRandomNumbers()));
1337  connect(action_select_all, SIGNAL(triggered()), this, SLOT(selectAll()));
1338  connect(action_add_column, SIGNAL(triggered()), this, SLOT(addColumn()));
1339  connect(action_clear_table, SIGNAL(triggered()), this, SLOT(clear()));
1340 
1341  //Export to TeX
1342  connect(action_export_to_TeX, SIGNAL( triggered() ), this, SLOT( showTeXTableExportDialog() ) );
1343 
1344 #ifndef LEGACY_CODE_0_2_x
1345  connect(action_clear_masks, SIGNAL(triggered()), this, SLOT(clearMasks()));
1346 #endif
1347  connect(action_sort_table, SIGNAL(triggered()), this, SLOT(sortTable()));
1348  connect(action_go_to_cell, SIGNAL(triggered()), this, SLOT(goToCell()));
1349  connect(action_dimensions_dialog, SIGNAL(triggered()), this, SLOT(dimensionsDialog()));
1350  connect(action_insert_columns, SIGNAL(triggered()), this, SLOT(insertEmptyColumns()));
1351  connect(action_remove_columns, SIGNAL(triggered()), this, SLOT(removeSelectedColumns()));
1352  connect(action_clear_columns, SIGNAL(triggered()), this, SLOT(clearSelectedColumns()));
1353  connect(action_add_columns, SIGNAL(triggered()), this, SLOT(addColumns()));
1354  connect(action_set_as_x, SIGNAL(triggered()), this, SLOT(setSelectedColumnsAsX()));
1355  connect(action_set_as_y, SIGNAL(triggered()), this, SLOT(setSelectedColumnsAsY()));
1356  connect(action_set_as_z, SIGNAL(triggered()), this, SLOT(setSelectedColumnsAsZ()));
1357  connect(action_set_as_xerr, SIGNAL(triggered()), this, SLOT(setSelectedColumnsAsXError()));
1358  connect(action_set_as_yerr, SIGNAL(triggered()), this, SLOT(setSelectedColumnsAsYError()));
1359  connect(action_set_as_none, SIGNAL(triggered()), this, SLOT(setSelectedColumnsAsNone()));
1360  connect(action_normalize_columns, SIGNAL(triggered()), this, SLOT(normalizeSelectedColumns()));
1361  connect(action_normalize_selection, SIGNAL(triggered()), this, SLOT(normalizeSelection()));
1362  connect(action_sort_columns, SIGNAL(triggered()), this, SLOT(sortSelectedColumns()));
1363  connect(action_statistics_columns, SIGNAL(triggered()), this, SLOT(statisticsOnSelectedColumns()));
1364  connect(action_type_format, SIGNAL(triggered()), this, SLOT(editTypeAndFormatOfSelectedColumns()));
1365  connect(action_edit_description, SIGNAL(triggered()), this, SLOT(editDescriptionOfCurrentColumn()));
1366  connect(action_insert_rows, SIGNAL(triggered()), this, SLOT(insertEmptyRows()));
1367  connect(action_remove_rows, SIGNAL(triggered()), this, SLOT(removeSelectedRows()));
1368  connect(action_clear_rows, SIGNAL(triggered()), this, SLOT(clearSelectedCells()));
1369  connect(action_add_rows, SIGNAL(triggered()), this, SLOT(addRows()));
1370  connect(action_statistics_rows, SIGNAL(triggered()), this, SLOT(statisticsOnSelectedRows()));
1371 }

References action_add_column, action_add_columns, action_add_rows, action_clear_columns, action_clear_masks, action_clear_rows, action_clear_selection, action_clear_table, action_copy_selection, action_cut_selection, action_dimensions_dialog, action_edit_description, action_export_to_TeX, action_fill_random, action_fill_row_numbers, action_go_to_cell, action_insert_columns, action_insert_rows, action_mask_selection, action_normalize_columns, action_normalize_selection, action_paste_into_selection, action_recalculate, action_remove_columns, action_remove_rows, action_select_all, action_set_as_none, action_set_as_x, action_set_as_xerr, action_set_as_y, action_set_as_yerr, action_set_as_z, action_set_formula, action_sort_columns, action_sort_table, action_statistics_columns, action_statistics_rows, action_type_format, action_unmask_selection, addColumn(), addColumns(), addRows(), clear(), clearMasks(), clearSelectedCells(), clearSelectedColumns(), copySelection(), cutSelection(), dimensionsDialog(), editDescriptionOfCurrentColumn(), editTypeAndFormatOfSelectedColumns(), fillSelectedCellsWithRandomNumbers(), fillSelectedCellsWithRowNumbers(), goToCell(), insertEmptyColumns(), insertEmptyRows(), maskSelection(), normalizeSelectedColumns(), normalizeSelection(), pasteIntoSelection(), recalculateSelectedCells(), removeSelectedColumns(), removeSelectedRows(), selectAll(), setFormulaForSelection(), setSelectedColumnsAsNone(), setSelectedColumnsAsX(), setSelectedColumnsAsXError(), setSelectedColumnsAsY(), setSelectedColumnsAsYError(), setSelectedColumnsAsZ(), showTeXTableExportDialog(), sortSelectedColumns(), sortTable(), statisticsOnSelectedColumns(), statisticsOnSelectedRows(), and unmaskSelection().

Referenced by Table().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ connectColumn()

void Table::connectColumn ( const Column col)
private

Internal function to connect all column signals.

Definition at line 2235 of file future_Table.cpp.

2236 {
2237  connect(col, SIGNAL(aspectDescriptionChanged(const AbstractAspect *)), this,
2238  SLOT(handleDescriptionChange(const AbstractAspect *)));
2239  connect(col, SIGNAL(plotDesignationChanged(const AbstractColumn *)), this,
2241  connect(col, SIGNAL(modeChanged(const AbstractColumn *)), this,
2242  SLOT(handleDataChange(const AbstractColumn *)));
2243  connect(col, SIGNAL(dataChanged(const AbstractColumn *)), this,
2244  SLOT(handleDataChange(const AbstractColumn *)));
2245  connect(col, SIGNAL(modeChanged(const AbstractColumn *)), this,
2246  SLOT(handleModeChange(const AbstractColumn *)));
2247  connect(col, SIGNAL(rowsAboutToBeInserted(const AbstractColumn *, int, int)), this,
2248  SLOT(handleRowsAboutToBeInserted(const AbstractColumn *,int,int)));
2249  connect(col, SIGNAL(rowsInserted(const AbstractColumn *, int, int)), this,
2250  SLOT(handleRowsInserted(const AbstractColumn *,int,int)));
2251  connect(col, SIGNAL(rowsAboutToBeRemoved(const AbstractColumn *, int, int)), this,
2252  SLOT(handleRowsAboutToBeRemoved(const AbstractColumn *,int,int)));
2253  connect(col, SIGNAL(rowsRemoved(const AbstractColumn *, int, int)), this,
2254  SLOT(handleRowsRemoved(const AbstractColumn *,int,int)));
2255  connect(col, SIGNAL(maskingChanged(const AbstractColumn *)), this,
2256  SLOT(handleDataChange(const AbstractColumn *)));
2257 }

References AbstractAspect::aspectDescriptionChanged(), dataChanged(), handleDataChange(), handleDescriptionChange(), handleModeChange(), handlePlotDesignationChange(), handleRowsAboutToBeInserted(), handleRowsAboutToBeRemoved(), handleRowsInserted(), handleRowsRemoved(), rowsAboutToBeInserted(), rowsAboutToBeRemoved(), rowsInserted(), and rowsRemoved().

Here is the call graph for this function:

◆ copy [1/2]

virtual void AbstractPart::copy
inlineslot

Copy current selection.

Definition at line 79 of file AbstractPart.h.

79 {};

◆ copy() [2/2]

void Table::copy ( Table other)

Definition at line 1819 of file future_Table.cpp.

1820 {
1821  WAIT_CURSOR;
1822  beginMacro(QObject::tr("%1: copy %2").arg(name()).arg(other->name()));
1823 
1824  removeColumns(0, columnCount());
1825  QList<Column *> columns;
1826  for (int i=0; i<other->columnCount(); i++)
1827  {
1828  Column * src_col = other->column(i);
1829  Column * new_col = new Column(src_col->name(), src_col->columnMode());
1830  new_col->copy(src_col);
1831  new_col->setPlotDesignation(src_col->plotDesignation());
1832  QList< Interval<int> > masks = src_col->maskedIntervals();
1833  foreach(Interval<int> iv, masks)
1834  new_col->setMasked(iv);
1835  QList< Interval<int> > formulas = src_col->formulaIntervals();
1836  foreach(Interval<int> iv, formulas)
1837  new_col->setFormula(iv, src_col->formula(iv.start()));
1838  columns.append(new_col);
1839  }
1840  appendColumns(columns);
1841  setCaptionSpec(other->captionSpec());
1842  setComment(other->comment());
1843  for (int i=0; i<columnCount(); i++)
1844  setColumnWidth(i, other->columnWidth(i));
1845  if (d_view) d_view->rereadSectionSizes();
1846 
1847  endMacro();
1848  RESET_CURSOR;
1849 }

References appendColumns(), AbstractAspect::beginMacro(), AbstractAspect::captionSpec(), column(), columnCount(), Column::columnMode(), columnWidth(), AbstractAspect::comment(), Column::copy(), d_view, AbstractAspect::endMacro(), Column::formula(), Column::formulaIntervals(), Column::maskedIntervals(), AbstractAspect::name(), Column::plotDesignation(), removeColumns(), RESET_CURSOR, AbstractAspect::setCaptionSpec(), setColumnWidth(), AbstractAspect::setComment(), Column::setFormula(), Column::setMasked(), Column::setPlotDesignation(), and WAIT_CURSOR.

Here is the call graph for this function:

◆ copySelection

void Table::copySelection ( )
slot

Definition at line 354 of file future_Table.cpp.

355 {
356  if (!d_view) return;
357  int first_col = d_view->firstSelectedColumn(false);
358  if(first_col == -1) return;
359  int last_col = d_view->lastSelectedColumn(false);
360  if(last_col == -2) return;
361  int first_row = d_view->firstSelectedRow(false);
362  if(first_row == -1) return;
363  int last_row = d_view->lastSelectedRow(false);
364  if(last_row == -2) return;
365  int cols = last_col - first_col +1;
366  int rows = last_row - first_row +1;
367 
368  WAIT_CURSOR;
369  QString output_str;
370 
371  for(int r=0; r<rows; r++)
372  {
373  for(int c=0; c<cols; c++)
374  {
375  Column *col_ptr = column(first_col + c);
376  if(d_view->isCellSelected(first_row + r, first_col + c))
377  {
378  if (d_view->formulaModeActive())
379  {
380  output_str += col_ptr->formula(first_row + r);
381  }
382  else if (col_ptr->dataType() == SciDAVis::TypeDouble)
383  {
384  Double2StringFilter * out_fltr = static_cast<Double2StringFilter *>(col_ptr->outputFilter());
385  output_str += QLocale().toString(col_ptr->valueAt(first_row + r),
386  out_fltr->numericFormat(), 16); // copy with max. precision
387  }
388  else
389  {
390  output_str += text(first_row + r, first_col + c);
391  }
392  }
393  if(c < cols-1)
394  output_str += "\t";
395  }
396  if(r < rows-1)
397  output_str += "\n";
398  }
399  QApplication::clipboard()->setText(output_str);
400  RESET_CURSOR;
401 }

References column(), d_view, Column::dataType(), Column::formula(), Double2StringFilter::numericFormat(), Column::outputFilter(), RESET_CURSOR, text(), SciDAVis::TypeDouble, Column::valueAt(), and WAIT_CURSOR.

Referenced by connectActions(), and cutSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createActions()

void Table::createActions ( )
private

Definition at line 1069 of file future_Table.cpp.

1070 {
1071  QIcon * icon_temp;
1072 
1073  // selection related actions
1074  action_cut_selection = new QAction(QIcon(QPixmap(":/cut.xpm")), tr("Cu&t"), this);
1075  actionManager()->addAction(action_cut_selection, "cut_selection");
1076 
1077  action_copy_selection = new QAction(QIcon(QPixmap(":/copy.xpm")), tr("&Copy"), this);
1078  actionManager()->addAction(action_copy_selection, "copy_selection");
1079 
1080  action_paste_into_selection = new QAction(QIcon(QPixmap(":/paste.xpm")), tr("Past&e"), this);
1081  actionManager()->addAction(action_paste_into_selection, "paste_into_selection");
1082 
1083 #ifndef LEGACY_CODE_0_2_x
1084  action_mask_selection = new QAction(QIcon(QPixmap(":/mask.xpm")), tr("&Mask","mask selection"), this);
1085  actionManager()->addAction(action_mask_selection, "mask_selection");
1086 
1087  action_unmask_selection = new QAction(QIcon(QPixmap(":/unmask.xpm")), tr("&Unmask","unmask selection"), this);
1088  actionManager()->addAction(action_unmask_selection, "unmask_selection");
1089 #endif
1090 
1091  icon_temp = new QIcon();
1092  icon_temp->addPixmap(QPixmap(":/16x16/fx.png"));
1093  icon_temp->addPixmap(QPixmap(":/32x32/fx.png"));
1094  action_set_formula = new QAction(*icon_temp, tr("Assign &Formula"), this);
1095  action_set_formula->setShortcut(tr("Alt+Q"));
1096  actionManager()->addAction(action_set_formula, "set_formula");
1097  delete icon_temp;
1098 
1099  icon_temp = new QIcon();
1100  icon_temp->addPixmap(QPixmap(":/16x16/clear.png"));
1101  icon_temp->addPixmap(QPixmap(":/32x32/clear.png"));
1102  action_clear_selection = new QAction(*icon_temp, tr("Clea&r","clear selection"), this);
1103  actionManager()->addAction(action_clear_selection, "clear_selection");
1104  delete icon_temp;
1105 
1106  icon_temp = new QIcon();
1107  icon_temp->addPixmap(QPixmap(":/16x16/recalculate.png"));
1108  icon_temp->addPixmap(QPixmap(":/32x32/recalculate.png"));
1109  action_recalculate = new QAction(*icon_temp, tr("Recalculate"), this);
1110  action_recalculate->setShortcut(tr("Ctrl+Return"));
1111  actionManager()->addAction(action_recalculate, "recalculate");
1112  delete icon_temp;
1113 
1114  action_fill_row_numbers = new QAction(QIcon(QPixmap(":/rowNumbers.xpm")), tr("Row Numbers"), this);
1115  actionManager()->addAction(action_fill_row_numbers, "fill_row_numbers");
1116 
1117  action_fill_random = new QAction(QIcon(QPixmap(":/randomNumbers.xpm")), tr("Random Values"), this);
1118  actionManager()->addAction(action_fill_random, "fill_random");
1119 
1120  //table related actions
1121  icon_temp = new QIcon();
1122  icon_temp->addPixmap(QPixmap(":/16x16/table_header.png"));
1123  icon_temp->addPixmap(QPixmap(":/32x32/table_header.png"));
1124  action_toggle_comments = new QAction(*icon_temp, QString("Show/Hide comments"), this); // show/hide column comments
1125  actionManager()->addAction(action_toggle_comments, "toggle_comments");
1126  delete icon_temp;
1127 
1128  icon_temp = new QIcon();
1129  icon_temp->addPixmap(QPixmap(":/16x16/table_options.png"));
1130  icon_temp->addPixmap(QPixmap(":/32x32/table_options.png"));
1131  action_toggle_tabbar = new QAction(*icon_temp, QString("Show/Hide Controls"), this); // show/hide control tabs
1132  action_toggle_tabbar->setShortcut(tr("F12"));
1133  actionManager()->addAction(action_toggle_tabbar, "toggle_tabbar");
1134  delete icon_temp;
1135 
1136  action_formula_mode = new QAction(tr("Formula Edit Mode"), this);
1137  action_formula_mode->setCheckable(true);
1138  actionManager()->addAction(action_formula_mode, "formula_mode");
1139 
1140  icon_temp = new QIcon();
1141  icon_temp->addPixmap(QPixmap(":/16x16/select_all.png"));
1142  icon_temp->addPixmap(QPixmap(":/32x32/select_all.png"));
1143  action_select_all = new QAction(*icon_temp, tr("Select All"), this);
1144  actionManager()->addAction(action_select_all, "select_all");
1145  delete icon_temp;
1146 
1147  icon_temp = new QIcon();
1148  icon_temp->addPixmap(QPixmap(":/16x16/add_column.png"));
1149  icon_temp->addPixmap(QPixmap(":/32x32/add_column.png"));
1150  action_add_column = new QAction(*icon_temp, tr("&Add Column"), this);
1151  action_add_column->setToolTip(tr("append a new column to the table"));
1152  actionManager()->addAction(action_add_column, "add_column");
1153  delete icon_temp;
1154 
1155  icon_temp = new QIcon();
1156  icon_temp->addPixmap(QPixmap(":/16x16/clear_table.png"));
1157  icon_temp->addPixmap(QPixmap(":/32x32/clear_table.png"));
1158  action_clear_table = new QAction(*icon_temp, tr("Clear Table"), this);
1159  actionManager()->addAction(action_clear_table, "clear_table");
1160  delete icon_temp;
1161 
1162  icon_temp = new QIcon();
1163  icon_temp->addPixmap(QPixmap(":/16x16/TeX.png"));
1164  icon_temp->addPixmap(QPixmap(":/32x32/TeX.png"));
1165  action_export_to_TeX = new QAction(*icon_temp, tr("Export to TeX..."), this);
1166  actionManager()->addAction(action_export_to_TeX, "export_to_TeX");
1167  delete icon_temp;
1168 
1169 
1170 #ifndef LEGACY_CODE_0_2_x
1171  action_clear_masks = new QAction(QIcon(QPixmap(":/unmask.xpm")), tr("Clear Masks"), this);
1172  actionManager()->addAction(action_clear_masks, "clear_masks");
1173 #endif
1174 
1175  icon_temp = new QIcon();
1176  icon_temp->addPixmap(QPixmap(":/16x16/sort.png"));
1177  icon_temp->addPixmap(QPixmap(":/32x32/sort.png"));
1178  action_sort_table = new QAction(*icon_temp, tr("&Sort Table"), this);
1179  actionManager()->addAction(action_sort_table, "sort_table");
1180  delete icon_temp;
1181 
1182  icon_temp = new QIcon();
1183  icon_temp->addPixmap(QPixmap(":/16x16/go_to_cell.png"));
1184  icon_temp->addPixmap(QPixmap(":/32x32/go_to_cell.png"));
1185  action_go_to_cell = new QAction(*icon_temp, tr("&Go to Cell"), this);
1186  action_go_to_cell->setShortcut(tr("Ctrl+Alt+G"));
1187  actionManager()->addAction(action_go_to_cell, "go_to_cell");
1188  delete icon_temp;
1189 
1190  action_dimensions_dialog = new QAction(QIcon(QPixmap(":/resize.xpm")), tr("&Dimensions", "table size"), this);
1191  action_dimensions_dialog->setToolTip(tr("change the table size"));
1192  actionManager()->addAction(action_dimensions_dialog, "dimensions_dialog");
1193 
1194  // column related actions
1195  icon_temp = new QIcon();
1196  icon_temp->addPixmap(QPixmap(":/16x16/insert_column.png"));
1197  icon_temp->addPixmap(QPixmap(":/32x32/insert_column.png"));
1198  action_insert_columns = new QAction(*icon_temp, tr("&Insert Empty Columns"), this);
1199  actionManager()->addAction(action_insert_columns, "insert_columns");
1200  delete icon_temp;
1201 
1202  icon_temp = new QIcon();
1203  icon_temp->addPixmap(QPixmap(":/16x16/remove_column.png"));
1204  icon_temp->addPixmap(QPixmap(":/32x32/remove_column.png"));
1205  action_remove_columns = new QAction(*icon_temp, tr("Remo&ve Columns"), this);
1206  actionManager()->addAction(action_remove_columns, "remove_columns");
1207  delete icon_temp;
1208 
1209  icon_temp = new QIcon();
1210  icon_temp->addPixmap(QPixmap(":/16x16/clear_column.png"));
1211  icon_temp->addPixmap(QPixmap(":/32x32/clear_column.png"));
1212  action_clear_columns = new QAction(*icon_temp, tr("Clea&r Columns"), this);
1213  actionManager()->addAction(action_clear_columns, "clear_columns");
1214  delete icon_temp;
1215 
1216  icon_temp = new QIcon();
1217  icon_temp->addPixmap(QPixmap(":/16x16/add_columns.png"));
1218  icon_temp->addPixmap(QPixmap(":/32x32/add_columns.png"));
1219  action_add_columns = new QAction(*icon_temp, tr("&Add Columns"), this);
1220  actionManager()->addAction(action_add_columns, "add_columns");
1221  delete icon_temp;
1222 
1223  action_set_as_x = new QAction(QIcon(QPixmap()), tr("X","plot designation"), this);
1224  actionManager()->addAction(action_set_as_x, "set_as_x");
1225 
1226  action_set_as_y = new QAction(QIcon(QPixmap()), tr("Y","plot designation"), this);
1227  actionManager()->addAction(action_set_as_y, "set_as_y");
1228 
1229  action_set_as_z = new QAction(QIcon(QPixmap()), tr("Z","plot designation"), this);
1230  actionManager()->addAction(action_set_as_z, "set_as_z");
1231 
1232  icon_temp = new QIcon();
1233  icon_temp->addPixmap(QPixmap(":/16x16/x_error.png"));
1234  icon_temp->addPixmap(QPixmap(":/32x32/x_error.png"));
1235  action_set_as_xerr = new QAction(*icon_temp, tr("X Error","plot designation"), this);
1236  actionManager()->addAction(action_set_as_xerr, "set_as_xerr");
1237  delete icon_temp;
1238 
1239  icon_temp = new QIcon();
1240  icon_temp->addPixmap(QPixmap(":/16x16/y_error.png"));
1241  icon_temp->addPixmap(QPixmap(":/32x32/y_error.png"));
1242  action_set_as_yerr = new QAction(*icon_temp, tr("Y Error","plot designation"), this);
1243  actionManager()->addAction(action_set_as_yerr, "set_as_yerr");
1244  delete icon_temp;
1245 
1246  action_set_as_none = new QAction(QIcon(QPixmap()), tr("None","plot designation"), this);
1247  actionManager()->addAction(action_set_as_none, "set_as_none");
1248 
1249  icon_temp = new QIcon();
1250  icon_temp->addPixmap(QPixmap(":/16x16/normalize.png"));
1251  icon_temp->addPixmap(QPixmap(":/32x32/normalize.png"));
1252  action_normalize_columns = new QAction(*icon_temp, tr("&Normalize Columns"), this);
1253  actionManager()->addAction(action_normalize_columns, "normalize_columns");
1254  delete icon_temp;
1255 
1256  icon_temp = new QIcon();
1257  icon_temp->addPixmap(QPixmap(":/16x16/normalize.png"));
1258  icon_temp->addPixmap(QPixmap(":/32x32/normalize.png"));
1259  action_normalize_selection = new QAction(*icon_temp, tr("&Normalize Selection"), this);
1260  actionManager()->addAction(action_normalize_selection, "normalize_selection");
1261  delete icon_temp;
1262 
1263  icon_temp = new QIcon();
1264  icon_temp->addPixmap(QPixmap(":/16x16/sort.png"));
1265  icon_temp->addPixmap(QPixmap(":/32x32/sort.png"));
1266  action_sort_columns = new QAction(*icon_temp, tr("&Sort Columns"), this);
1267  actionManager()->addAction(action_sort_columns, "sort_columns");
1268  delete icon_temp;
1269 
1270  action_statistics_columns = new QAction(QIcon(QPixmap(":/col_stat.xpm")), tr("Column Statisti&cs"), this);
1271  action_statistics_columns->setToolTip(tr("statistics on columns"));
1272  actionManager()->addAction(action_statistics_columns, "statistics_columns");
1273 
1274  icon_temp = new QIcon();
1275  icon_temp->addPixmap(QPixmap(":/16x16/column_format_type.png"));
1276  icon_temp->addPixmap(QPixmap(":/32x32/column_format_type.png"));
1277  action_type_format = new QAction(*icon_temp, tr("Change &Type && Format"), this);
1278  action_type_format->setShortcut(tr("Ctrl+Alt+O"));
1279  actionManager()->addAction(action_type_format, "type_format");
1280  delete icon_temp;
1281 
1282  icon_temp = new QIcon();
1283  icon_temp->addPixmap(QPixmap(":/16x16/column_description.png"));
1284  icon_temp->addPixmap(QPixmap(":/32x32/column_description.png"));
1285  action_edit_description = new QAction(*icon_temp, tr("Edit Column &Description"), this);
1286  actionManager()->addAction(action_edit_description, "edit_description");
1287  delete icon_temp;
1288 
1289  // row related actions
1290  icon_temp = new QIcon();
1291  icon_temp->addPixmap(QPixmap(":/16x16/insert_row.png"));
1292  icon_temp->addPixmap(QPixmap(":/32x32/insert_row.png"));
1293  action_insert_rows = new QAction(*icon_temp ,tr("&Insert Empty Rows"), this);
1294  actionManager()->addAction(action_insert_rows, "insert_rows");
1295  delete icon_temp;
1296 
1297  icon_temp = new QIcon();
1298  icon_temp->addPixmap(QPixmap(":/16x16/remove_row.png"));
1299  icon_temp->addPixmap(QPixmap(":/32x32/remove_row.png"));
1300  action_remove_rows = new QAction(*icon_temp, tr("Remo&ve Rows"), this);
1301  actionManager()->addAction(action_remove_rows, "remove_rows");
1302  delete icon_temp;
1303 
1304  icon_temp = new QIcon();
1305  icon_temp->addPixmap(QPixmap(":/16x16/clear_row.png"));
1306  icon_temp->addPixmap(QPixmap(":/32x32/clear_row.png"));
1307  action_clear_rows = new QAction(*icon_temp, tr("Clea&r Rows"), this);
1308  actionManager()->addAction(action_clear_rows, "clear_rows");
1309  delete icon_temp;
1310 
1311  icon_temp = new QIcon();
1312  icon_temp->addPixmap(QPixmap(":/16x16/add_rows.png"));
1313  icon_temp->addPixmap(QPixmap(":/32x32/add_rows.png"));
1314  action_add_rows = new QAction(*icon_temp, tr("&Add Rows"), this);
1315  actionManager()->addAction(action_add_rows, "add_rows");
1316  delete icon_temp;
1317 
1318  action_statistics_rows = new QAction(QIcon(QPixmap(":/stat_rows.xpm")), tr("Row Statisti&cs"), this);
1319  action_statistics_rows->setToolTip(tr("statistics on rows"));
1320  actionManager()->addAction(action_statistics_rows, "statistics_rows");
1321 }

References action_add_column, action_add_columns, action_add_rows, action_clear_columns, action_clear_masks, action_clear_rows, action_clear_selection, action_clear_table, action_copy_selection, action_cut_selection, action_dimensions_dialog, action_edit_description, action_export_to_TeX, action_fill_random, action_fill_row_numbers, action_formula_mode, action_go_to_cell, action_insert_columns, action_insert_rows, action_mask_selection, action_normalize_columns, action_normalize_selection, action_paste_into_selection, action_recalculate, action_remove_columns, action_remove_rows, action_select_all, action_set_as_none, action_set_as_x, action_set_as_xerr, action_set_as_y, action_set_as_yerr, action_set_as_z, action_set_formula, action_sort_columns, action_sort_table, action_statistics_columns, action_statistics_rows, action_toggle_comments, action_toggle_tabbar, action_type_format, action_unmask_selection, actionManager(), and ActionManager::addAction().

Referenced by Table().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createColumnMenu()

QMenu * Table::createColumnMenu ( QMenu *  append_to = 0)

Create a menu with column related operations.

Parameters
append_toif a pointer to a QMenu is passed to the function, the actions are appended to it instead of the creation of a new menu.

Definition at line 1685 of file future_Table.cpp.

1686 {
1687  QMenu * menu = append_to;
1688  if(!menu)
1689  menu = new QMenu();
1690 
1691  QMenu * submenu = new QMenu(tr("S&et Column(s) As"));
1692  submenu->addAction(action_set_as_x);
1693  submenu->addAction(action_set_as_y);
1694  submenu->addAction(action_set_as_z);
1695  submenu->addSeparator();
1696  submenu->addAction(action_set_as_xerr);
1697  submenu->addAction(action_set_as_yerr);
1698  submenu->addSeparator();
1699  submenu->addAction(action_set_as_none);
1700  menu->addMenu(submenu);
1701  menu->addSeparator();
1702 
1703  submenu = new QMenu(tr("Fi&ll Selection with"));
1704  submenu->addAction(action_fill_row_numbers);
1705  submenu->addAction(action_fill_random);
1706  menu->addMenu(submenu);
1707  menu->addSeparator();
1708 
1709  menu->addAction(action_insert_columns);
1710  menu->addAction(action_remove_columns);
1711  menu->addAction(action_clear_columns);
1712  menu->addAction(action_add_columns);
1713  menu->addSeparator();
1714 
1715  menu->addAction(action_normalize_columns);
1716  menu->addAction(action_sort_columns);
1717  menu->addSeparator();
1718 
1719  menu->addAction(action_edit_description);
1720  menu->addAction(action_type_format);
1721  connect(menu, SIGNAL(aboutToShow()), this, SLOT(adjustActionNames()));
1722  menu->addAction(action_toggle_comments);
1723  menu->addSeparator();
1724 
1725  menu->addAction(action_statistics_columns);
1726 
1727  return menu;
1728 }

References action_add_columns, action_clear_columns, action_edit_description, action_fill_random, action_fill_row_numbers, action_insert_columns, action_normalize_columns, action_remove_columns, action_set_as_none, action_set_as_x, action_set_as_xerr, action_set_as_y, action_set_as_yerr, action_set_as_z, action_sort_columns, action_statistics_columns, action_toggle_comments, action_type_format, and adjustActionNames().

Referenced by showTableViewColumnContextMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createContextMenu()

QMenu * Table::createContextMenu ( ) const
virtual

Return a new context menu.

The caller takes ownership of the menu.

Reimplemented from AbstractPart.

Definition at line 1049 of file future_Table.cpp.

1050 {
1051  QMenu *menu = AbstractPart::createContextMenu();
1052  Q_ASSERT(menu);
1053  menu->addSeparator();
1054 
1055  // TODO
1056  // Export to ASCII
1057  // Print --> maybe should go to AbstractPart::createContextMenu()
1058  // ----
1059  // Rename --> AbstractAspect::createContextMenu(); maybe call this "Properties" and include changing comment/caption spec
1060  // Duplicate --> AbstractPart::createContextMenu()
1061  // Hide/Show --> Do we need hiding of views (in addition to minimizing)? How do we avoid confusion with hiding of Aspects?
1062  // Activate ?
1063  // Resize --> AbstractPart::createContextMenu()
1064 
1065  return menu;
1066 }

References AbstractPart::createContextMenu().

Here is the call graph for this function:

◆ createRowMenu()

QMenu * Table::createRowMenu ( QMenu *  append_to = 0)

Create a menu with row related operations.

Parameters
append_toif a pointer to a QMenu is passed to the function, the actions are appended to it instead of the creation of a new menu.

Definition at line 1756 of file future_Table.cpp.

1757 {
1758  QMenu * menu = append_to;
1759  if(!menu)
1760  menu = new QMenu();
1761 
1762  menu->addAction(action_insert_rows);
1763  menu->addAction(action_remove_rows);
1764  menu->addAction(action_clear_rows);
1765  menu->addAction(action_add_rows);
1766  menu->addSeparator();
1767  QMenu *submenu = new QMenu(tr("Fi&ll Selection with"));
1768  submenu->addAction(action_fill_row_numbers);
1769  submenu->addAction(action_fill_random);
1770  menu->addMenu(submenu);
1771  menu->addSeparator();
1772  menu->addAction(action_statistics_rows);
1773 
1774  return menu;
1775 }

References action_add_rows, action_clear_rows, action_fill_random, action_fill_row_numbers, action_insert_rows, action_remove_rows, and action_statistics_rows.

Referenced by showTableViewRowContextMenu().

Here is the caller graph for this function:

◆ createSelectionMenu()

QMenu * Table::createSelectionMenu ( QMenu *  append_to = 0)

Create a menu with selection related operations.

Parameters
append_toif a pointer to a QMenu is passed to the function, the actions are appended to it instead of the creation of a new menu.

Definition at line 1653 of file future_Table.cpp.

1654 {
1655  QMenu * menu = append_to;
1656  if(!menu)
1657  menu = new QMenu();
1658 
1659  QMenu * submenu = new QMenu(tr("Fi&ll Selection with"));
1660  submenu->addAction(action_fill_row_numbers);
1661  submenu->addAction(action_fill_random);
1662  menu->addMenu(submenu);
1663  menu->addSeparator();
1664 
1665  menu->addAction(action_cut_selection);
1666  menu->addAction(action_copy_selection);
1667  menu->addAction(action_paste_into_selection);
1668  menu->addAction(action_clear_selection);
1669  menu->addSeparator();
1670 #ifndef LEGACY_CODE_0_2_x
1671  menu->addAction(action_mask_selection);
1672  menu->addAction(action_unmask_selection);
1673  menu->addSeparator();
1674 #endif
1675  menu->addAction(action_normalize_selection);
1676  menu->addSeparator();
1677  menu->addAction(action_set_formula);
1678  menu->addAction(action_recalculate);
1679  menu->addSeparator();
1680 
1681  return menu;
1682 }

References action_clear_selection, action_copy_selection, action_cut_selection, action_fill_random, action_fill_row_numbers, action_mask_selection, action_normalize_selection, action_paste_into_selection, action_recalculate, action_set_formula, and action_unmask_selection.

Referenced by showTableViewContextMenu().

Here is the caller graph for this function:

◆ createTableMenu()

QMenu * Table::createTableMenu ( QMenu *  append_to = 0)

Create a menu with table related operations.

Parameters
append_toif a pointer to a QMenu is passed to the function, the actions are appended to it instead of the creation of a new menu.

Definition at line 1730 of file future_Table.cpp.

1731 {
1732  QMenu * menu = append_to;
1733  if(!menu)
1734  menu = new QMenu();
1735 
1736  connect(menu, SIGNAL(aboutToShow()), this, SLOT(adjustActionNames()));
1737  menu->addAction(action_toggle_comments);
1738  menu->addAction(action_toggle_tabbar);
1739  menu->addAction(action_formula_mode);
1740  menu->addSeparator();
1741  menu->addAction(action_select_all);
1742  menu->addAction(action_clear_table);
1743  menu->addAction(action_export_to_TeX);
1744 #ifndef LEGACY_CODE_0_2_x
1745  menu->addAction(action_clear_masks);
1746  menu->addAction(action_sort_table);
1747 #endif
1748  menu->addSeparator();
1749  menu->addAction(action_add_column);
1750  menu->addSeparator();
1751  menu->addAction(action_go_to_cell);
1752 
1753  return menu;
1754 }

References action_add_column, action_clear_masks, action_clear_table, action_export_to_TeX, action_formula_mode, action_go_to_cell, action_select_all, action_sort_table, action_toggle_comments, action_toggle_tabbar, and adjustActionNames().

Referenced by showTableViewContextMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ creationTime()

QDateTime AbstractAspect::creationTime ( ) const
inherited

Definition at line 288 of file AbstractAspect.cpp.

289 {
290  return d_aspect_private->creationTime();
291 }

References AbstractAspect::Private::creationTime(), and AbstractAspect::d_aspect_private.

Referenced by Matrix::birthDate(), Matrix::init(), and AbstractAspect::writeBasicAttributes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cut()

virtual void AbstractPart::cut ( )
inlinevirtualinherited

Cut current selection.

Definition at line 81 of file AbstractPart.h.

81 {};

◆ cutSelection

void Table::cutSelection ( )
slot

Definition at line 340 of file future_Table.cpp.

341 {
342  if (!d_view) return;
343  int first = d_view->firstSelectedRow();
344  if( first < 0 ) return;
345 
346  WAIT_CURSOR;
347  beginMacro(tr("%1: cut selected cell(s)").arg(name()));
348  copySelection();
350  endMacro();
351  RESET_CURSOR;
352 }

References AbstractAspect::beginMacro(), clearSelectedCells(), copySelection(), d_view, AbstractAspect::endMacro(), AbstractAspect::name(), RESET_CURSOR, and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dataChanged

void future::Table::dataChanged ( int  top,
int  left,
int  bottom,
int  right 
)
signal

Referenced by connectColumn(), handleDataChange(), handleRowsInserted(), and handleRowsRemoved().

Here is the caller graph for this function:

◆ defaultColumnWidth()

static int future::Table::defaultColumnWidth ( )
inlinestatic

Definition at line 232 of file future_Table.h.

232 { return default_column_width; }

References default_column_width.

Referenced by TableView::init(), and future::Table::Private::insertColumns().

Here is the caller graph for this function:

◆ defaultCommentVisibility()

static bool future::Table::defaultCommentVisibility ( )
inlinestatic

Return the default for comment visibility for table views.

Definition at line 213 of file future_Table.h.

References d_default_comment_visibility.

◆ descendantsThatInherit()

QList< AbstractAspect * > AbstractAspect::descendantsThatInherit ( const char *  class_name)
inherited

Get all descendents that inherit the given class.

Definition at line 342 of file AbstractAspect.cpp.

343 {
344  QList<AbstractAspect *> list;
345  if (inherits(class_name))
346  list << this;
347  for (int i=0; i<childCount(); i++)
348  list << child(i)->descendantsThatInherit(class_name);
349  return list;
350 }

References AbstractAspect::child(), AbstractAspect::childCount(), and AbstractAspect::descendantsThatInherit().

Referenced by AbstractAspect::descendantsThatInherit(), and ApplicationWindow::tableWindows().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dimensionsDialog

void Table::dimensionsDialog ( )
slot

Definition at line 1793 of file future_Table.cpp.

1794 {
1795  Ui::DimensionsDialog ui;
1796  QDialog dialog;
1797  ui.setupUi(&dialog);
1798  dialog.setWindowTitle(tr("Set Table Dimensions"));
1799  ui.columnsSpinBox->setValue(columnCount());
1800  ui.rowsSpinBox->setValue(rowCount());
1801  connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
1802  connect(ui.buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
1803 
1804  if (dialog.exec())
1805  {
1806  setColumnCount(ui.columnsSpinBox->value());
1807  setRowCount(ui.rowsSpinBox->value());
1808  }
1809 }

References columnCount(), rowCount(), setColumnCount(), and setRowCount().

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ disconnectColumn()

void Table::disconnectColumn ( const Column col)
private

Internal function to disconnect a column.

Definition at line 2259 of file future_Table.cpp.

2260 {
2261  disconnect(col, 0, this, 0);
2262 }

◆ editDescriptionOfCurrentColumn

void Table::editDescriptionOfCurrentColumn ( )
slot

Definition at line 970 of file future_Table.cpp.

971 {
972  if (!d_view) return;
973  d_view->showControlDescriptionTab();
974 }

References d_view.

Referenced by connectActions().

Here is the caller graph for this function:

◆ editTypeAndFormatOfSelectedColumns

void Table::editTypeAndFormatOfSelectedColumns ( )
slot

Definition at line 964 of file future_Table.cpp.

965 {
966  if (!d_view) return;
967  d_view->showControlTypeTab();
968 }

References d_view.

Referenced by connectActions().

Here is the caller graph for this function:

◆ endMacro()

void AbstractAspect::endMacro ( )
inherited

End the undo stack macro.

Definition at line 222 of file AbstractAspect.cpp.

223 {
224  QUndoStack *stack = undoStack();
225  if (stack)
226  stack->endMacro();
227 }

References AbstractAspect::undoStack().

Referenced by AbstractAspect::addChild(), addColumn(), future::Matrix::addColumns(), addColumns(), future::Matrix::addRows(), addRows(), Matrix::applyFormula(), TableView::applyType(), future::Matrix::clear(), clear(), clearMasks(), future::Matrix::clearSelectedCells(), clearSelectedCells(), future::Matrix::clearSelectedColumns(), clearSelectedColumns(), future::Matrix::clearSelectedRows(), future::Matrix::copy(), copy(), future::Matrix::cutSelection(), cutSelection(), fillSelectedCellsWithRandomNumbers(), fillSelectedCellsWithRowNumbers(), AbstractAspect::insertChild(), future::Matrix::insertColumns(), insertColumns(), future::Matrix::insertEmptyColumns(), insertEmptyColumns(), future::Matrix::insertEmptyRows(), insertEmptyRows(), future::Matrix::insertRows(), insertRows(), maskSelection(), moveColumn(), normalizeColumns(), normalizeSelection(), future::Matrix::pasteIntoSelection(), pasteIntoSelection(), recalculateSelectedCells(), AbstractAspect::removeAllChildAspects(), AbstractAspect::removeChild(), future::Matrix::removeColumns(), removeColumns(), future::Matrix::removeRows(), removeRows(), future::Matrix::removeSelectedColumns(), removeSelectedColumns(), future::Matrix::removeSelectedRows(), removeSelectedRows(), AbstractAspect::reparentChild(), Column::setColumnMode(), future::Matrix::setDimensions(), setRowCount(), setSelectionAs(), sortColumns(), and unmaskSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ exec()

void AbstractAspect::exec ( QUndoCommand *  command)
inherited

Execute the given command, pushing it on the undoStack() if available.

Definition at line 203 of file AbstractAspect.cpp.

204 {
205  Q_CHECK_PTR(cmd);
206  QUndoStack *stack = undoStack();
207  if (stack)
208  stack->push(cmd);
209  else {
210  cmd->redo();
211  delete cmd;
212  }
213 }

References AbstractAspect::undoStack().

Referenced by AbstractAspect::addChild(), future::Matrix::addColumns(), future::Matrix::addRows(), addRows(), future::Matrix::clear(), Column::clear(), Column::clearFormulas(), Column::clearMasks(), future::Matrix::clearSelectedCells(), future::Matrix::clearSelectedColumns(), future::Matrix::clearSelectedRows(), Column::clearValidity(), completeAspectInsertion(), Column::copy(), AbstractAspect::insertChild(), future::Matrix::insertColumns(), future::Matrix::insertRows(), Column::insertRows(), future::Matrix::mirrorHorizontally(), future::Matrix::mirrorVertically(), AbstractAspect::moveChild(), moveColumn(), prepareAspectRemoval(), AbstractAspect::removeChild(), future::Matrix::removeColumns(), future::Matrix::removeRows(), removeRows(), Column::removeRows(), AbstractAspect::reparentChild(), Column::replaceDateTimes(), Column::replaceTexts(), Column::replaceValues(), AbstractAspect::setCaptionSpec(), future::Matrix::setCell(), future::Matrix::setColumnCells(), Column::setColumnMode(), AbstractAspect::setComment(), future::Matrix::setCoordinates(), AbstractAspect::setCreationTime(), Column::setDateTimeAt(), future::Matrix::setDimensions(), future::Matrix::setDisplayedDigits(), DateTime2StringFilter::setFormat(), String2DateTimeFilter::setFormat(), future::Matrix::setFormula(), Column::setFormula(), Column::setInvalid(), Column::setMasked(), AbstractAspect::setName(), Double2StringFilter::setNumDigits(), Double2StringFilter::setNumericFormat(), future::Matrix::setNumericFormat(), Column::setPlotDesignation(), future::Matrix::setRowCells(), setRowCount(), Column::setTextAt(), Column::setValueAt(), future::Matrix::setXEnd(), future::Matrix::setXStart(), future::Matrix::setYEnd(), future::Matrix::setYStart(), and future::Matrix::transpose().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ export_to_TeX

bool Table::export_to_TeX ( QString  fileName,
TeXTableSettings tex_settings 
)
slot

Export to TeX.

Definition at line 1559 of file future_Table.cpp.

1560 {
1561 
1562  WAIT_CURSOR;
1563 
1564  QFile file( fileName );
1565 
1566  if (!file.open( QIODevice::WriteOnly ))
1567  {
1568  QApplication::restoreOverrideCursor();
1569  QMessageBox::critical(0, tr("TeX Export Error"),
1570  tr("Could not write to file: <br><h4>%1</h4><p>Please verify that you have the right to write to this location!").arg(fileName));
1571  return false;
1572  }
1573 
1574 
1575  QList< Column* > columns_list;
1576  int first_row_index = 0;
1577  int last_row_index = 0;
1578 
1579 
1580  if (d_view->selectedColumnCount() != 0)
1581  {
1582  //Get selected columns
1583  for (int i = 0; i < columnCount(); i++)
1584  {
1585  if (d_view->isColumnSelected( i ))
1586  columns_list << column( i );
1587  }
1588 
1589  // Get the first and last selected row index
1590  first_row_index = d_view->firstSelectedRow();
1591  last_row_index = d_view->lastSelectedRow();
1592  }
1593  else
1594  {
1595  //Get all columns
1596  for( int i = 0; i < columnCount(); i++ )
1597  columns_list << column( i );
1598 
1599  // Get the first and last row index
1600  first_row_index = 0;
1601  if( rowCount() > 0 ) last_row_index = rowCount()-1;
1602  else last_row_index = 0;
1603  }
1604 
1605  // Get the TeX column alignment
1606  char cl_alignment = 'c';
1607  if (tex_settings.columnsAlignment() == ALIGN_LEFT) cl_alignment = 'l';
1608  else if (tex_settings.columnsAlignment() == ALIGN_RIGHT) cl_alignment = 'r';
1609 
1610  QTextStream out(&file);
1611 
1612  //Check whether the TeX table should have caption
1613  if (tex_settings.with_caption())
1614  out << "\\begin{table} \n \\caption{" << name() << "}\n";
1615 
1616  //begin tabular with all parameters
1617  out << QString("\\begin{tabular}{|*{") + QString().setNum( columns_list.count() )
1618  + ("}{") + QString(cl_alignment) + QString("|}}\n");
1619  out << "\\hline \n";
1620 
1621  //Check if export with table labels
1622  if (tex_settings.with_labels())
1623  {
1624  //Get the columns labes
1625  QStringList columns_labels;
1626  foreach (Column* col, columns_list) columns_labels << col->name();
1627  out << columns_labels.join(" & ") << "\\\\ \\hline \n";
1628  }
1629 
1630 
1631  //Export TeX table content
1632  QStringList str_row;
1633  for ( int row_index = first_row_index; row_index < last_row_index+1; row_index++)
1634  {
1635  str_row.clear();
1636  foreach( Column* col, columns_list )
1637  str_row << col->asStringColumn()->textAt( row_index );
1638  out << str_row.join(" & ") << " \\\\ \\hline \n ";
1639  }
1640 
1641  out << "\\end{tabular} \n";
1642 
1643  if( tex_settings.with_caption() ) out << "\\end{table} \n";
1644 
1645  RESET_CURSOR;
1646 
1647  return true;
1648 }

References ALIGN_LEFT, ALIGN_RIGHT, Column::asStringColumn(), column(), columnCount(), TeXTableSettings::columnsAlignment(), d_view, AbstractAspect::name(), RESET_CURSOR, rowCount(), ColumnStringIO::textAt(), WAIT_CURSOR, TeXTableSettings::with_caption(), and TeXTableSettings::with_labels().

Referenced by showTeXTableExportDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fillProjectMenu()

bool Table::fillProjectMenu ( QMenu *  menu)
virtual

Fill the part specific menu for the main window including setting the title.

Returns
true on success, otherwise false (e.g. part has no actions).

Reimplemented from AbstractPart.

Definition at line 987 of file future_Table.cpp.

988 {
989  menu->setTitle(tr("&Table"));
990 
991  QMenu * submenu = new QMenu(tr("S&et Column(s) As"));
992  submenu->addAction(action_set_as_x);
993  submenu->addAction(action_set_as_y);
994  submenu->addAction(action_set_as_z);
995  submenu->addSeparator();
996  submenu->addAction(action_set_as_xerr);
997  submenu->addAction(action_set_as_yerr);
998  submenu->addSeparator();
999  submenu->addAction(action_set_as_none);
1000  menu->addMenu(submenu);
1001  menu->addSeparator();
1002 
1003  submenu = new QMenu(tr("Fi&ll Selection with"));
1004  submenu->addAction(action_fill_row_numbers);
1005  submenu->addAction(action_fill_random);
1006  menu->addMenu(submenu);
1007  menu->addSeparator();
1008 
1009  connect(menu, SIGNAL(aboutToShow()), this, SLOT(adjustActionNames()));
1010  menu->addAction(action_toggle_comments);
1011  menu->addAction(action_toggle_tabbar);
1012  menu->addAction(action_formula_mode);
1013  menu->addAction(action_edit_description);
1014  menu->addAction(action_type_format);
1015  menu->addSeparator();
1016  menu->addAction(action_clear_table);
1017 #ifndef LEGACY_CODE_0_2_x
1018  menu->addAction(action_clear_masks);
1019 #endif
1020  menu->addAction(action_sort_table);
1021  menu->addSeparator();
1022  menu->addAction(action_set_formula);
1023  menu->addAction(action_recalculate);
1024  menu->addSeparator();
1025  menu->addAction(action_add_column);
1026  menu->addAction(action_dimensions_dialog);
1027  menu->addSeparator();
1028  menu->addAction(action_go_to_cell);
1029  if (action_edit_description->text() != tr("Edit Column &Description"))
1031 
1032  return true;
1033 
1034  // TODO:
1035  // Convert to Matrix
1036  // Export
1037 }

References action_add_column, action_clear_masks, action_clear_table, action_dimensions_dialog, action_edit_description, action_fill_random, action_fill_row_numbers, action_formula_mode, action_go_to_cell, action_recalculate, action_set_as_none, action_set_as_x, action_set_as_xerr, action_set_as_y, action_set_as_yerr, action_set_as_z, action_set_formula, action_sort_table, action_toggle_comments, action_toggle_tabbar, action_type_format, adjustActionNames(), and translateActionsStrings().

Here is the call graph for this function:

◆ fillProjectToolBar()

bool Table::fillProjectToolBar ( QToolBar *  bar)
virtual

Fill the part specific tool bar for the main window including setting the title.

Returns
true on success, otherwise false (e.g. part has no actions to be shown in a toolbar).

Reimplemented from AbstractPart.

Definition at line 1039 of file future_Table.cpp.

1040 {
1041  bar->addAction(action_dimensions_dialog);
1042  bar->addAction(action_add_column);
1043  bar->addAction(action_statistics_columns);
1044  bar->addAction(action_statistics_rows);
1045 
1046  return true;
1047 }

References action_add_column, action_dimensions_dialog, action_statistics_columns, and action_statistics_rows.

◆ fillSelectedCellsWithRandomNumbers

void Table::fillSelectedCellsWithRandomNumbers ( )
slot

Definition at line 623 of file future_Table.cpp.

624 {
625  if (!d_view) return;
626  if(d_view->selectedColumnCount() < 1) return;
627  int first = d_view->firstSelectedRow();
628  int last = d_view->lastSelectedRow();
629  if( first < 0 ) return;
630 
631  WAIT_CURSOR;
632  beginMacro(tr("%1: fill cells with random values").arg(name()));
633  qsrand(QTime::currentTime().msec());
634  foreach(Column *col_ptr, d_view->selectedColumns()) {
635  int col = columnIndex(col_ptr);
636  switch (col_ptr->columnMode()) {
637  case SciDAVis::Numeric:
638  {
639  QVector<qreal> results(last-first+1);
640  for (int row=first; row<=last; row++)
641  if (d_view->isCellSelected(row, col))
642  results[row-first] = double(qrand())/double(RAND_MAX);
643  else
644  results[row-first] = col_ptr->valueAt(row);
645  col_ptr->replaceValues(first, results);
646  break;
647  }
648  case SciDAVis::Text:
649  {
650  QStringList results;
651  for (int row=first; row<=last; row++)
652  if (d_view->isCellSelected(row, col))
653  results << QString::number(double(qrand())/double(RAND_MAX));
654  else
655  results << col_ptr->textAt(row);
656  col_ptr->replaceTexts(first, results);
657  break;
658  }
659  case SciDAVis::DateTime:
660  case SciDAVis::Month:
661  case SciDAVis::Day:
662  {
663  QList<QDateTime> results;
664  QDate earliestDate(1,1,1);
665  QDate latestDate(2999,12,31);
666  QTime midnight(0,0,0,0);
667  for (int row=first; row<=last; row++)
668  if (d_view->isCellSelected(row, col))
669  results << QDateTime(
670  earliestDate.addDays(((double)qrand())*((double)earliestDate.daysTo(latestDate))/((double)RAND_MAX)),
671  midnight.addMSecs(((qint64)qrand())*1000*60*60*24/RAND_MAX));
672  else
673  results << col_ptr->dateTimeAt(row);
674  col_ptr->replaceDateTimes(first, results);
675  break;
676  }
677  }
678  }
679  endMacro();
680  RESET_CURSOR;
681 }

References AbstractAspect::beginMacro(), columnIndex(), Column::columnMode(), d_view, SciDAVis::DateTime, Column::dateTimeAt(), SciDAVis::Day, AbstractAspect::endMacro(), SciDAVis::Month, AbstractAspect::name(), SciDAVis::Numeric, Column::replaceDateTimes(), Column::replaceTexts(), Column::replaceValues(), RESET_CURSOR, SciDAVis::Text, Column::textAt(), Column::valueAt(), and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fillSelectedCellsWithRowNumbers

void Table::fillSelectedCellsWithRowNumbers ( )
slot

Definition at line 580 of file future_Table.cpp.

581 {
582  if (!d_view) return;
583  if(d_view->selectedColumnCount() < 1) return;
584  int first = d_view->firstSelectedRow();
585  int last = d_view->lastSelectedRow();
586  if( first < 0 ) return;
587 
588  WAIT_CURSOR;
589  beginMacro(tr("%1: fill cells with row numbers").arg(name()));
590  foreach(Column *col_ptr, d_view->selectedColumns()) {
591  int col = columnIndex(col_ptr);
592  switch (col_ptr->columnMode()) {
593  case SciDAVis::Numeric:
594  {
595  QVector<qreal> results(last-first+1);
596  for (int row=first; row<=last; row++)
597  if(d_view->isCellSelected(row, col))
598  results[row-first] = row+1;
599  else
600  results[row-first] = col_ptr->valueAt(row);
601  col_ptr->replaceValues(first, results);
602  break;
603  }
604  case SciDAVis::Text:
605  {
606  QStringList results;
607  for (int row=first; row<=last; row++)
608  if (d_view->isCellSelected(row, col))
609  results << QString::number(row+1);
610  else
611  results << col_ptr->textAt(row);
612  col_ptr->replaceTexts(first, results);
613  break;
614  }
615  default:
616  break;
617  }
618  }
619  endMacro();
620  RESET_CURSOR;
621 }

References AbstractAspect::beginMacro(), columnIndex(), Column::columnMode(), d_view, AbstractAspect::endMacro(), AbstractAspect::name(), SciDAVis::Numeric, Column::replaceTexts(), Column::replaceValues(), RESET_CURSOR, SciDAVis::Text, Column::textAt(), Column::valueAt(), and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ folder()

future::Folder * AbstractAspect::folder ( )
inherited

Return the folder the Aspect is contained in or 0 if not.

The returned folder may be the aspect itself if it inherits Folder.

Definition at line 316 of file AbstractAspect.cpp.

317 {
318  if(inherits("future::Folder")) return static_cast<future::Folder *>(this);
319  AbstractAspect * parent_aspect = parentAspect();
320  while(parent_aspect && !parent_aspect->inherits("future::Folder"))
321  parent_aspect = parent_aspect->parentAspect();
322  return static_cast<future::Folder *>(parent_aspect);
323 }

References AbstractAspect::parentAspect().

Referenced by Project::createFolderContextMenu(), future::Matrix::duplicate(), and future::Folder::readChildAspectElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ global()

QVariant AbstractAspect::global ( const QString &  key)
staticinherited

Retrieve a global setting.

Definition at line 360 of file AbstractAspect.cpp.

361 {
362  QString qualified_key = QString(staticMetaObject.className()) + "/" + key;
363  QVariant result = Private::g_settings->value(qualified_key);
364  if (result.isValid())
365  return result;
366  else
367  return Private::g_defaults[qualified_key];
368 }

References AbstractAspect::Private::g_defaults, and AbstractAspect::Private::g_settings.

Referenced by future::Matrix::importImageDialog(), and ProjectConfigPage::ProjectConfigPage().

Here is the caller graph for this function:

◆ goToCell

void Table::goToCell ( )
slot

Definition at line 1777 of file future_Table.cpp.

1778 {
1779  if (!d_view) return;
1780  bool ok;
1781 
1782  int col = QInputDialog::getInt(0, tr("Go to Cell"), tr("Enter column"),
1783  1, 1, columnCount(), 1, &ok);
1784  if ( !ok ) return;
1785 
1786  int row = QInputDialog::getInt(0, tr("Go to Cell"), tr("Enter row"),
1787  1, 1, rowCount(), 1, &ok);
1788  if ( !ok ) return;
1789 
1790  d_view->goToCell(row-1, col-1);
1791 }

References columnCount(), d_view, and rowCount().

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleDataChange

void Table::handleDataChange ( const AbstractColumn col)
privateslot

Definition at line 2193 of file future_Table.cpp.

2194 {
2195  int index = columnIndex(static_cast<const Column *>(col));
2196  if(index != -1)
2197  {
2198  if (col->rowCount() > rowCount())
2199  setRowCount(col->rowCount());
2200  emit dataChanged(0, index, col->rowCount()-1, index);
2201  }
2202 }

References columnIndex(), dataChanged(), AbstractAspect::index(), rowCount(), AbstractColumn::rowCount(), and setRowCount().

Referenced by connectColumn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleDescriptionChange

void Table::handleDescriptionChange ( const AbstractAspect aspect)
privateslot

Definition at line 2179 of file future_Table.cpp.

2180 {
2181  int index = columnIndex(static_cast<const Column *>(aspect));
2182  if(index != -1)
2184 }

References columnIndex(), d_table_private, AbstractAspect::index(), and future::Table::Private::updateHorizontalHeader().

Referenced by connectColumn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleModeChange

void Table::handleModeChange ( const AbstractColumn col)
privateslot

Definition at line 2172 of file future_Table.cpp.

2173 {
2174  int index = columnIndex(static_cast<const Column *>(col));
2175  if(index != -1)
2177 }

References columnIndex(), d_table_private, AbstractAspect::index(), and future::Table::Private::updateHorizontalHeader().

Referenced by connectColumn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePlotDesignationChange

void Table::handlePlotDesignationChange ( const AbstractColumn col)
privateslot

Definition at line 2186 of file future_Table.cpp.

2187 {
2188  int index = columnIndex(static_cast<const Column *>(col));
2189  if(index != -1)
2191 }

References columnCount(), columnIndex(), d_table_private, AbstractAspect::index(), and future::Table::Private::updateHorizontalHeader().

Referenced by connectColumn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRowsAboutToBeInserted

void Table::handleRowsAboutToBeInserted ( const AbstractColumn col,
int  before,
int  count 
)
privateslot

Definition at line 2204 of file future_Table.cpp.

2205 {
2206  int new_size = col->rowCount() + count;
2207  if(before <= col->rowCount() && new_size > rowCount())
2208  setRowCount(new_size);
2209 }

References rowCount(), AbstractColumn::rowCount(), and setRowCount().

Referenced by connectColumn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRowsAboutToBeRemoved

void Table::handleRowsAboutToBeRemoved ( const AbstractColumn col,
int  first,
int  count 
)
privateslot

Definition at line 2220 of file future_Table.cpp.

2221 {
2222  Q_UNUSED(col);
2223  Q_UNUSED(first);
2224  Q_UNUSED(count);
2225 }

Referenced by connectColumn().

Here is the caller graph for this function:

◆ handleRowsInserted

void Table::handleRowsInserted ( const AbstractColumn col,
int  before,
int  count 
)
privateslot

Definition at line 2211 of file future_Table.cpp.

2212 {
2213  Q_UNUSED(count);
2214  int index = columnIndex(static_cast<const Column *>(col));
2215  if(index != -1 && before <= col->rowCount())
2216  emit dataChanged(before, index, col->rowCount()-1, index);
2217 }

References columnIndex(), dataChanged(), AbstractAspect::index(), rowCount(), and AbstractColumn::rowCount().

Referenced by connectColumn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRowsRemoved

void Table::handleRowsRemoved ( const AbstractColumn col,
int  first,
int  count 
)
privateslot

Definition at line 2227 of file future_Table.cpp.

2228 {
2229  Q_UNUSED(count);
2230  int index = columnIndex(static_cast<const Column *>(col));
2231  if(index != -1)
2232  emit dataChanged(first, index, col->rowCount()-1, index);
2233 }

References columnIndex(), dataChanged(), AbstractAspect::index(), and AbstractColumn::rowCount().

Referenced by connectColumn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ headerData()

QVariant Table::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const

Definition at line 2264 of file future_Table.cpp.

2265 {
2266  return d_table_private.headerData(section, orientation, role);
2267 }

References d_table_private, and future::Table::Private::headerData().

Referenced by future::Table::Private::columnHeader().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ headerDataChanged

void future::Table::headerDataChanged ( Qt::Orientation  orientation,
int  first,
int  last 
)
signal

◆ icon()

QIcon Table::icon ( ) const
virtual

Return an icon to be used for decorating my views.

Reimplemented from AbstractAspect.

Definition at line 2144 of file future_Table.cpp.

2145 {
2146  QIcon ico;
2147  ico.addPixmap(QPixmap(":/16x16/table.png"));
2148  ico.addPixmap(QPixmap(":/24x24/table.png"));
2149  ico.addPixmap(QPixmap(":/32x32/table.png"));
2150  return ico;
2151 }

◆ importV0x0001XXCreationTime()

void AbstractAspect::importV0x0001XXCreationTime ( const QString &  str)
inlineinherited

Definition at line 255 of file AbstractAspect.h.

256  {
257  setCreationTime(QDateTime::fromString(str, Qt::LocalDate));
258  }

References AbstractAspect::setCreationTime(), and str.

Referenced by Matrix::setBirthDate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ index()

int AbstractAspect::index ( ) const
inlineinherited

Return my position in my parent's list of children.

Definition at line 137 of file AbstractAspect.h.

137 { return parentAspect() ? parentAspect()->indexOfChild(this) : 0; }

References AbstractAspect::indexOfChild(), and AbstractAspect::parentAspect().

Referenced by AbstractAspect::Private::child(), AbstractAspect::child(), column(), future::Table::Private::column(), AbstractAspect::completeAspectInsertion(), completeAspectInsertion(), handleDataChange(), handleDescriptionChange(), handleModeChange(), handlePlotDesignationChange(), handleRowsInserted(), handleRowsRemoved(), AbstractAspect::insertChild(), AbstractAspect::Private::insertChild(), AbstractAspect::Private::removeChild(), AbstractAspect::removeChild(), and Column::XmlReadRow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ indexOfChild()

int AbstractAspect::indexOfChild ( const AbstractAspect child) const
inherited

Return the position of child in my list of children.

Definition at line 191 of file AbstractAspect.cpp.

192 {
194 }

References AbstractAspect::child(), AbstractAspect::d_aspect_private, and AbstractAspect::Private::indexOfChild().

Referenced by AbstractAspect::index(), AbstractAspect::remove(), AbstractAspect::Private::removeChild(), AbstractAspect::removeChild(), and AbstractAspect::reparentChild().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ info()

void AbstractAspect::info ( const QString &  text)
inlineprotectedinherited

Implementations should call this whenever status information should be given to the user.

This will cause statusInfo() to be emitted. Typically, this will cause the specified string to be displayed in a status bar, a log window or some similar non-blocking way so as not to disturb the workflow.

Definition at line 307 of file AbstractAspect.h.

307 { emit statusInfo(text); }

References AbstractAspect::statusInfo().

Referenced by AbstractAspect::addChild(), AbstractAspect::insertChild(), AbstractAspect::reparentChild(), and AbstractAspect::setName().

Here is the caller graph for this function:

◆ initActionManager()

void Table::initActionManager ( )
static

Definition at line 2441 of file future_Table.cpp.

2442 {
2443  if (!action_manager)
2444  action_manager = new ActionManager();
2445 
2446  action_manager->setTitle(tr("Table"));
2447  volatile Table * action_creator = new Table(); // initialize the action texts
2448  delete action_creator;
2449 }

References action_manager, and Table().

Referenced by actionManager().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertChild()

void AbstractAspect::insertChild ( AbstractAspect child,
int  index 
)
inherited

Insert the given Aspect at a specific position in my list of children.

Definition at line 128 of file AbstractAspect.cpp.

129 {
130  Q_CHECK_PTR(child);
131  QString new_name = d_aspect_private->uniqueNameFor(child->name());
132  beginMacro(tr("%1: insert %2 at position %3.").arg(name()).arg(new_name).arg(index+1));
133  if (new_name != child->name()) {
134  info(tr("Renaming \"%1\" to \"%2\" in order to avoid name collision.").arg(child->name()).arg(new_name));
135  child->setName(new_name);
136  }
139  endMacro();
140 }

References AbstractAspect::beginMacro(), AbstractAspect::child(), AbstractAspect::completeAspectInsertion(), AbstractAspect::d_aspect_private, AbstractAspect::endMacro(), AbstractAspect::exec(), AbstractAspect::index(), AbstractAspect::info(), AbstractAspect::name(), AbstractAspect::setName(), and AbstractAspect::Private::uniqueNameFor().

Referenced by AbstractAspect::Private::addChild(), and insertColumns().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertColumns()

void Table::insertColumns ( int  before,
QList< Column * >  new_cols 
)

Insert columns.

Ownership of the columns is transferred to this Table.

If before == columnCount() this will do the same as appendColumns();

Definition at line 168 of file future_Table.cpp.

169 {
170  if( new_cols.size() < 1 || before < 0 || before > columnCount()) return;
171  WAIT_CURSOR;
172  beginMacro(QObject::tr("%1: insert %2 column(s)").arg(name()).arg(new_cols.size()));
173  int pos=before;
174  foreach(Column* col, new_cols)
175  insertChild(col, pos++);
176  // remark: the TableInsertColumnsCmd will be created in completeAspectInsertion()
177  endMacro();
178  RESET_CURSOR;
179 }

References AbstractAspect::beginMacro(), columnCount(), AbstractAspect::endMacro(), AbstractAspect::insertChild(), AbstractAspect::name(), RESET_CURSOR, and WAIT_CURSOR.

Referenced by future::Table::Private::appendColumns(), appendColumns(), and insertEmptyColumns().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertEmptyColumns

void Table::insertEmptyColumns ( )
slot

Insert columns depending on the selection.

Definition at line 693 of file future_Table.cpp.

694 {
695  if (!d_view) return;
696  int first = d_view->firstSelectedColumn();
697  int last = d_view->lastSelectedColumn();
698  if( first < 0 ) return;
699  int count, current = first;
700  QList<Column*> cols;
701 
702  WAIT_CURSOR;
703  beginMacro(QObject::tr("%1: insert empty column(s)").arg(name()));
704  while( current <= last )
705  {
706  current = first+1;
707  while( current <= last && d_view->isColumnSelected(current) ) current++;
708  count = current-first;
709  for(int i=0; i<count; i++)
710  {
711  Column * new_col = new Column(QString::number(i+1), SciDAVis::Numeric);
713  cols << new_col;
714  }
715  insertColumns(first, cols);
716  cols.clear();
717  current += count;
718  last += count;
719  while( current <= last && !d_view->isColumnSelected(current) ) current++;
720  first = current;
721  }
722  endMacro();
723  RESET_CURSOR;
724 }

References AbstractAspect::beginMacro(), d_view, AbstractAspect::endMacro(), insertColumns(), AbstractAspect::name(), SciDAVis::Numeric, RESET_CURSOR, Column::setPlotDesignation(), WAIT_CURSOR, and SciDAVis::Y.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertEmptyRows

void Table::insertEmptyRows ( )
slot

Insert rows depending on the selection.

Definition at line 895 of file future_Table.cpp.

896 {
897  if (!d_view) return;
898  int first = d_view->firstSelectedRow();
899  int last = d_view->lastSelectedRow();
900  int count, current = first;
901 
902  if( first < 0 ) return;
903 
904  WAIT_CURSOR;
905  beginMacro(QObject::tr("%1: insert empty rows(s)").arg(name()));
906  while( current <= last )
907  {
908  current = first+1;
909  while( current <= last && d_view->isRowSelected(current) ) current++;
910  count = current-first;
911  insertRows(first, count);
912  current += count;
913  last += count;
914  while( current <= last && !d_view->isRowSelected(current) ) current++;
915  first = current;
916  }
917  endMacro();
918  RESET_CURSOR;
919 }

References AbstractAspect::beginMacro(), d_view, AbstractAspect::endMacro(), insertRows(), AbstractAspect::name(), RESET_CURSOR, and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertRows()

void Table::insertRows ( int  before,
int  count 
)

Definition at line 214 of file future_Table.cpp.

215 {
216  if( count < 1 || before < 0 || before > rowCount()) return;
217  WAIT_CURSOR;
218  int new_row_count = rowCount() + count;
219  beginMacro(QObject::tr("%1: insert %2 row(s)").arg(name()).arg(count));
220  int end = d_table_private.columnCount();
221  for(int col=0; col<end; col++)
222  d_table_private.column(col)->insertRows(before, count);
223  setRowCount(new_row_count);
224  endMacro();
225  RESET_CURSOR;
226 }

References AbstractAspect::beginMacro(), future::Table::Private::column(), future::Table::Private::columnCount(), d_table_private, AbstractAspect::endMacro(), Column::insertRows(), AbstractAspect::name(), RESET_CURSOR, rowCount(), setRowCount(), and WAIT_CURSOR.

Referenced by appendRows(), and insertEmptyRows().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDescendantOf()

bool AbstractAspect::isDescendantOf ( AbstractAspect other)
inherited

Return whether the there is a path upwards to the given aspect.

This also returns true if other==this.

Definition at line 325 of file AbstractAspect.cpp.

326 {
327  if(other == this) return true;
328  AbstractAspect * parent_aspect = parentAspect();
329  while(parent_aspect)
330  {
331  if(parent_aspect == other) return true;
332  parent_aspect = parent_aspect->parentAspect();
333  }
334  return false;
335 }

References AbstractAspect::parentAspect().

Here is the call graph for this function:

◆ load()

bool Table::load ( XmlStreamReader reader)
virtual

Load from XML.

Reimplemented from AbstractAspect.

Definition at line 2310 of file future_Table.cpp.

2311 {
2312  if(reader->isStartElement() && reader->name() == "table")
2313  {
2314  setColumnCount(0);
2315  setRowCount(0);
2316  setComment("");
2317 
2318  if (!readBasicAttributes(reader)) return false;
2319 
2320  // read dimensions
2321  bool ok1, ok2;
2322  int rows, cols;
2323  rows = reader->readAttributeInt("rows", &ok1);
2324  cols = reader->readAttributeInt("columns", &ok2);
2325  if(!ok1 || !ok2)
2326  {
2327  reader->raiseError(tr("invalid row or column count"));
2328  return false;
2329  }
2330 
2331  setRowCount(rows);
2332  // read child elements
2333  while (!reader->atEnd())
2334  {
2335  reader->readNext();
2336 
2337  if (reader->isEndElement()) break;
2338 
2339  if (reader->isStartElement())
2340  {
2341  if (reader->name() == "comment")
2342  {
2343  if (!readCommentElement(reader)) return false;
2344  }
2345  else if(reader->name() == "column")
2346  {
2347  Column * column = new Column(tr("Column %1").arg(1), SciDAVis::Text);
2348  if (!column->load(reader))
2349  {
2350  setColumnCount(0);
2351  return false;
2352  }
2353  QList<Column *> columns;
2354  columns.append(column);
2355  appendColumns(columns);
2356  }
2357  else if(reader->name() == "column_width")
2358  {
2359  if (!readColumnWidthElement(reader)) return false;
2360  }
2361  else // unknown element
2362  {
2363  reader->raiseWarning(tr("unknown element '%1'").arg(reader->name().toString()));
2364  if (!reader->skipToEndElement()) return false;
2365  }
2366  }
2367  }
2368  if (cols != columnCount())
2369  reader->raiseWarning(tr("columns attribute and number of read columns do not match"));
2370  }
2371  else // no table element
2372  reader->raiseError(tr("no table element found"));
2373 
2374  return !reader->hasError();
2375 }

References appendColumns(), column(), columnCount(), Column::load(), XmlStreamReader::raiseError(), XmlStreamReader::raiseWarning(), XmlStreamReader::readAttributeInt(), AbstractAspect::readBasicAttributes(), readColumnWidthElement(), AbstractAspect::readCommentElement(), setColumnCount(), AbstractAspect::setComment(), setRowCount(), XmlStreamReader::skipToEndElement(), and SciDAVis::Text.

Here is the call graph for this function:

◆ maskSelection

void Table::maskSelection ( )
slot

Definition at line 521 of file future_Table.cpp.

522 {
523  if (!d_view) return;
524  int first = d_view->firstSelectedRow();
525  int last = d_view->lastSelectedRow();
526  if( first < 0 ) return;
527 
528  WAIT_CURSOR;
529  beginMacro(tr("%1: mask selected cell(s)").arg(name()));
530  QList<Column*> list = d_view->selectedColumns();
531  foreach(Column * col_ptr, list)
532  {
533  int col = columnIndex(col_ptr);
534  for(int row=first; row<=last; row++)
535  if(d_view->isCellSelected(row, col)) col_ptr->setMasked(row);
536  }
537  endMacro();
538  RESET_CURSOR;
539 }

References AbstractAspect::beginMacro(), columnIndex(), d_view, AbstractAspect::endMacro(), AbstractAspect::name(), RESET_CURSOR, Column::setMasked(), and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mdiSubWindow()

PartMdiView * AbstractPart::mdiSubWindow ( )
inherited

Wrap the view() into a PartMdiView.

A new view is only created the first time this method is called; after that, a pointer to the pre-existing view is returned.

File : AbstractPart.cpp Project : SciDAVis

Description : Base class of Aspects with MDI windows as views.

Copyright : (C) 2008-2009 Knut Franke (knut.franke*gmx.de) (replace * with @ in the email address)

  • This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. *
    • This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. *
    • You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA *

Definition at line 35 of file AbstractPart.cpp.

36 {
37  if (!d_mdi_window)
38  d_mdi_window = new PartMdiView(this, view());
39  return d_mdi_window;
40 }

References AbstractPart::d_mdi_window, and AbstractPart::view().

Here is the call graph for this function:

◆ moveChild()

void AbstractAspect::moveChild ( int  from,
int  to 
)
inherited

Change the positon of a child in my list of children.

Definition at line 196 of file AbstractAspect.cpp.

197 {
198  Q_ASSERT(0 <= from && from < d_aspect_private->childCount());
199  Q_ASSERT(0 <= to && to < d_aspect_private->childCount());
200  exec(new AspectChildMoveCmd(d_aspect_private, from, to));
201 }

References AbstractAspect::childCount(), AbstractAspect::d_aspect_private, and AbstractAspect::exec().

Referenced by moveColumn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ moveColumn

void Table::moveColumn ( int  from,
int  to 
)
slot

Definition at line 1811 of file future_Table.cpp.

1812 {
1813  beginMacro(tr("%1: move column %2 from position %3 to %4.").arg(name()).arg(d_table_private.column(from)->name()).arg(from+1).arg(to+1));
1814  moveChild(from, to);
1815  exec(new TableMoveColumnCmd(d_table_private, from, to));
1816  endMacro();
1817 }

References AbstractAspect::beginMacro(), future::Table::Private::column(), d_table_private, AbstractAspect::endMacro(), AbstractAspect::exec(), AbstractAspect::moveChild(), and AbstractAspect::name().

Here is the call graph for this function:

◆ name()

QString AbstractAspect::name ( ) const
inherited

Definition at line 229 of file AbstractAspect.cpp.

230 {
231  return d_aspect_private->name();
232 }

References AbstractAspect::d_aspect_private, and AbstractAspect::Private::name().

Referenced by AbstractAspect::addChild(), addColumn(), future::Matrix::addColumns(), addColumns(), Filter::addResultCurve(), future::Matrix::addRows(), addRows(), TableView::applyType(), AspectChildAddCmd::AspectChildAddCmd(), AspectChildRemoveCmd::AspectChildRemoveCmd(), AspectChildReparentCmd::AspectChildReparentCmd(), future::Matrix::clear(), clear(), clearMasks(), future::Matrix::clearSelectedCells(), clearSelectedCells(), future::Matrix::clearSelectedColumns(), clearSelectedColumns(), future::Matrix::clearSelectedRows(), Table::colLabel(), Table::colNames(), column(), Table::columnsList(), future::Matrix::copy(), copy(), future::Matrix::cutSelection(), cutSelection(), DateTime2StringFilterSetFormatCmd::DateTime2StringFilterSetFormatCmd(), ApplicationWindow::defineErrorBars(), Double2StringFilterSetDigitsCmd::Double2StringFilterSetDigitsCmd(), Double2StringFilterSetFormatCmd::Double2StringFilterSetFormatCmd(), Table::drawableColumnSelection(), future::Matrix::duplicate(), export_to_TeX(), fillSelectedCellsWithRandomNumbers(), fillSelectedCellsWithRowNumbers(), TableView::handleAspectAdded(), Matrix::handleAspectDescriptionChange(), Table::handleAspectDescriptionChange(), TableView::handleAspectDescriptionChanged(), Table::importASCII(), ApplicationWindow::importASCII(), Table::init(), AbstractAspect::insertChild(), future::Matrix::insertColumns(), insertColumns(), future::Matrix::insertEmptyColumns(), insertEmptyColumns(), future::Matrix::insertEmptyRows(), insertEmptyRows(), future::Matrix::insertRows(), insertRows(), maskSelection(), moveColumn(), Matrix::name(), future::Matrix::Private::name(), future::Table::Private::name(), normalizeColumns(), normalizeSelection(), Differentiation::output(), future::Matrix::pasteIntoSelection(), pasteIntoSelection(), AbstractAspect::path(), AbstractAspect::readBasicAttributes(), recalculateSelectedCells(), AbstractAspect::removeAllChildAspects(), AbstractAspect::removeChild(), future::Matrix::removeColumns(), removeColumns(), future::Matrix::removeRows(), removeRows(), future::Matrix::removeSelectedColumns(), removeSelectedColumns(), future::Matrix::removeSelectedRows(), removeSelectedRows(), AbstractAspect::reparentChild(), Table::selectedColumns(), Table::selectedErrColumns(), Table::selectedYColumns(), Table::selectedYLabels(), TableView::setColumnForControlTabs(), Column::setColumnMode(), future::Matrix::setDimensions(), Graph::setLabelsTextFormat(), setRowCount(), setSelectionAs(), showTeXTableExportDialog(), sortColumns(), String2DateTimeFilterSetFormatCmd::String2DateTimeFilterSetFormatCmd(), TableMoveColumnCmd::TableMoveColumnCmd(), ApplicationWindow::tableWindows(), AbstractAspect::Private::uniqueNameFor(), unmaskSelection(), AbstractAspect::writeBasicAttributes(), and Table::YColumns().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ normalizeColumns

void Table::normalizeColumns ( QList< Column * >  cols)
slot

Definition at line 806 of file future_Table.cpp.

807 {
808  if (!d_view) return;
809 
810  WAIT_CURSOR;
811  beginMacro(QObject::tr("%1: normalize column(s)").arg(name()));
812  foreach(Column * col, cols)
813  {
814  if (col->dataType() == SciDAVis::TypeDouble)
815  {
816  double max = 0.0;
817  for (int row=0; row<col->rowCount(); row++)
818  {
819  if (col->valueAt(row) > max)
820  max = col->valueAt(row);
821  }
822  QVector<qreal> results(col->rowCount());
823  if (max != 0.0) // avoid division by zero
824  for (int row=0; row<col->rowCount(); row++)
825  results[row] = col->valueAt(row) / max;
826  col->replaceValues(0, results);
827  }
828  }
829  endMacro();
830  RESET_CURSOR;
831 }

References AbstractAspect::beginMacro(), d_view, Column::dataType(), AbstractAspect::endMacro(), AbstractAspect::name(), Column::replaceValues(), RESET_CURSOR, Column::rowCount(), SciDAVis::TypeDouble, Column::valueAt(), and WAIT_CURSOR.

Referenced by normalizeSelectedColumns().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ normalizeSelectedColumns

void Table::normalizeSelectedColumns ( )
slot

Definition at line 833 of file future_Table.cpp.

834 {
835  normalizeColumns(d_view->selectedColumns());
836 }

References d_view, and normalizeColumns().

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ normalizeSelection

void Table::normalizeSelection ( )
slot

Definition at line 838 of file future_Table.cpp.

839 {
840  if (!d_view) return;
841 
842  WAIT_CURSOR;
843  beginMacro(QObject::tr("%1: normalize selection").arg(name()));
844  double max = 0.0;
845  foreach(Column *col_ptr, d_view->selectedColumns()) {
846  int col = columnIndex(col_ptr);
847  if (col_ptr->dataType() == SciDAVis::TypeDouble)
848  for (int row=0; row<col_ptr->rowCount(); row++)
849  if (d_view->isCellSelected(row, col) && col_ptr->valueAt(row) > max)
850  max = col_ptr->valueAt(row);
851  }
852 
853  if (max != 0.0) // avoid division by zero
854  {
855  foreach(Column *col_ptr, d_view->selectedColumns()) {
856  int col = columnIndex(col_ptr);
857  if (col_ptr->dataType() == SciDAVis::TypeDouble) {
858  QVector<qreal> results(rowCount());
859  for (int row=0; row<col_ptr->rowCount(); row++)
860  if (d_view->isCellSelected(row, col))
861  results[row] = col_ptr->valueAt(row) / max;
862  else
863  results[row] = col_ptr->valueAt(row);
864  col_ptr->replaceValues(0, results);
865  }
866  }
867  }
868  endMacro();
869  RESET_CURSOR;
870 }

References AbstractAspect::beginMacro(), columnIndex(), d_view, Column::dataType(), AbstractAspect::endMacro(), AbstractAspect::name(), Column::replaceValues(), RESET_CURSOR, rowCount(), Column::rowCount(), SciDAVis::TypeDouble, Column::valueAt(), and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parentAspect()

AbstractAspect * AbstractAspect::parentAspect ( ) const
inherited

Return my parent Aspect or 0 if I currently don't have one.

Definition at line 109 of file AbstractAspect.cpp.

110 {
111  return d_aspect_private->parent();
112 }

References AbstractAspect::d_aspect_private, and AbstractAspect::Private::parent().

Referenced by DateTime2StringFilterSetFormatCmd::DateTime2StringFilterSetFormatCmd(), Double2StringFilterSetDigitsCmd::Double2StringFilterSetDigitsCmd(), Double2StringFilterSetFormatCmd::Double2StringFilterSetFormatCmd(), AbstractAspect::folder(), TableView::handleAspectAdded(), TableView::handleAspectDescriptionChanged(), AbstractAspect::index(), AbstractAspect::isDescendantOf(), AbstractAspect::path(), AbstractAspect::project(), AbstractAspect::remove(), Graph::setLabelsTextFormat(), String2DateTimeFilterSetFormatCmd::String2DateTimeFilterSetFormatCmd(), and AbstractAspect::undoStack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ paste()

virtual void AbstractPart::paste ( )
inlinevirtualinherited

Paste at the current location or into the current selection.

Definition at line 83 of file AbstractPart.h.

83 {};

◆ pasteIntoSelection

void Table::pasteIntoSelection ( )
slot

Definition at line 403 of file future_Table.cpp.

404 {
405  if (!d_view) return;
406  if(columnCount() < 1 || rowCount() < 1) return;
407 
408  WAIT_CURSOR;
409  beginMacro(tr("%1: paste from clipboard").arg(name()));
410 
411  int first_col = d_view->firstSelectedColumn(false);
412  int last_col = d_view->lastSelectedColumn(false);
413  int first_row = d_view->firstSelectedRow(false);
414  int last_row = d_view->lastSelectedRow(false);
415  int input_row_count = 0;
416  int input_col_count = 0;
417  int rows, cols;
418 
419  const QClipboard *clipboard = QApplication::clipboard();
420  const QMimeData *mimeData = clipboard->mimeData();;
421  if(mimeData->hasText())
422  {
423  QString input_str = clipboard->text().trimmed();
424  QList< QStringList > cell_texts;
425  QStringList input_rows(input_str.split(QRegExp("\\n|\\r\\n|\\r")));
426  input_row_count = input_rows.count();
427  input_col_count = 0;
428  for(int i=0; i<input_row_count; i++)
429  {
430  cell_texts.append(input_rows.at(i).trimmed().split(QRegExp("( +|\\s)"),QString::KeepEmptyParts));
431  if(cell_texts.at(i).count() > input_col_count) input_col_count = cell_texts.at(i).count();
432  }
433 
434  if( (first_col == -1 || first_row == -1) ||
435  (last_row == first_row && last_col == first_col) )
436  // if the is no selection or only one cell selected, the
437  // selection will be expanded to the needed size from the current cell
438  {
439  int current_row, current_col;
440  d_view->getCurrentCell(&current_row, &current_col);
441  if(current_row == -1) current_row = 0;
442  if(current_col == -1) current_col = 0;
443  d_view->setCellSelected(current_row, current_col);
444  first_col = current_col;
445  first_row = current_row;
446  last_row = first_row + input_row_count -1;
447  last_col = first_col + input_col_count -1;
448  // resize the table if necessary
449  if(last_col >= columnCount())
450  {
451  QList<Column*> cols;
452  for(int i=0; i<last_col+1-columnCount(); i++)
453  {
454  Column * new_col = new Column(QString::number(i+1), SciDAVis::Numeric);
456  cols << new_col;
457  }
458  appendColumns(cols);
459  }
460  if(last_row >= rowCount())
461  appendRows(last_row+1-rowCount());
462  // select the rectangle to be pasted in
463  d_view->setCellsSelected(first_row, first_col, last_row, last_col);
464  }
465 
466  rows = last_row - first_row + 1;
467  cols = last_col - first_col + 1;
468  if ((d_view->formulaModeActive()) || (d_view->hasMultiSelection()))
469  {
470  for(int r=0; r<rows && r<input_row_count; r++)
471  {
472  for(int c=0; c<cols && c<input_col_count; c++)
473  {
474  if(d_view->isCellSelected(first_row + r, first_col + c) && (c < cell_texts.at(r).count()) )
475  {
476  Column * col_ptr = d_table_private.column(first_col + c);
477  col_ptr->setFormula(first_row + r, cell_texts.at(r).at(c));
478  col_ptr->setInvalid(first_row + r, false);
479  }
480  }
481  }
482  }
483  else
484  {
485  QList< QStringList > cols_texts;
486  // transpose clipboard data to use replaceTexts
487  for (int c=0; c<input_col_count; c++)
488  {
489  QStringList cur_column;
490  for (int r=0; r<input_row_count; r++)
491  {
492  if (c < cell_texts.at(r).size()) {
493  cur_column << cell_texts.at(r).at(c);
494  } else {
495  cur_column << QString();
496  }
497  }
498  cols_texts << cur_column;
499  }
500 
501  // regular expression for numeric data
502  QRegExp floatorintrx = QRegExp("^[-+]?(?=[^eE]*\\d)\\d*\\.?\\d*([eE][-+]?\\d+)?$");
503  for (int c=0; c<cols && c<input_col_count; c++)
504  {
505  Column * col_ptr = d_table_private.column(first_col + c);
506  if (col_ptr->columnMode() == SciDAVis::Numeric) {
507  if (cols_texts.at(c).size() != cols_texts.at(c).filter(floatorintrx).size())
508  col_ptr->setColumnMode(SciDAVis::Text);
509  }
510  col_ptr->asStringColumn()->replaceTexts(first_row, cols_texts.at(c).mid(0,rows));
511  }
512  }
513 
515  }
516  endMacro();
517  RESET_CURSOR;
518 }

References appendColumns(), appendRows(), Column::asStringColumn(), AbstractAspect::beginMacro(), future::Table::Private::column(), columnCount(), Column::columnMode(), d_table_private, d_view, AbstractAspect::endMacro(), AbstractAspect::name(), SciDAVis::Numeric, recalculateSelectedCells(), ColumnStringIO::replaceTexts(), RESET_CURSOR, rowCount(), Column::setColumnMode(), Column::setFormula(), Column::setInvalid(), Column::setPlotDesignation(), SciDAVis::Text, WAIT_CURSOR, and SciDAVis::Y.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ path()

virtual QString AbstractAspect::path ( ) const
inlinevirtualinherited

Return the path that leads from the top-most Aspect (usually a Project) to me.

Reimplemented in Project.

Definition at line 154 of file AbstractAspect.h.

154 { return parentAspect() ? parentAspect()->path() + "/" + name() : ""; }

References AbstractAspect::name(), AbstractAspect::parentAspect(), and AbstractAspect::path().

Referenced by AbstractAspect::path().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepareAspectRemoval()

void Table::prepareAspectRemoval ( AbstractAspect aspect)
protectedvirtual

Called before a child is removed.

Unlike the aspectAboutToBeRemoved() signals, this method does not get called inside undo/redo actions; allowing subclasses to execute undo commands of their own.

Reimplemented from AbstractAspect.

Definition at line 2278 of file future_Table.cpp.

2279 {
2280  Column * column = qobject_cast<Column *>(aspect);
2281  if (!column) return;
2282  int first = columnIndex(column);
2283  QList<Column*> cols;
2284  cols.append(column);
2285  exec(new TableRemoveColumnsCmd(d_table_private, first, 1, cols));
2286 }

References column(), columnIndex(), d_table_private, and AbstractAspect::exec().

Here is the call graph for this function:

◆ project() [1/2]

virtual Project* AbstractAspect::project ( )
inlinevirtualinherited

Return the Project this Aspect belongs to, or 0 if it is currently not part of one.

Reimplemented in Project.

Definition at line 152 of file AbstractAspect.h.

152 { return parentAspect() ? parentAspect()->project() : 0; }

References AbstractAspect::parentAspect(), and AbstractAspect::project().

Here is the call graph for this function:

◆ project() [2/2]

virtual const Project* AbstractAspect::project ( ) const
inlinevirtualinherited

Return the Project this Aspect belongs to, or 0 if it is currently not part of one.

Reimplemented in Project.

Definition at line 150 of file AbstractAspect.h.

150 { return parentAspect() ? parentAspect()->project() : 0; }

References AbstractAspect::parentAspect(), and AbstractAspect::project().

Referenced by future::Folder::createContextMenu(), and AbstractAspect::project().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readBasicAttributes()

bool AbstractAspect::readBasicAttributes ( XmlStreamReader reader)
protectedinherited

Load name, creation time and caption spec from XML.

Returns
false on error

Definition at line 77 of file AbstractAspect.cpp.

78 {
79  QString prefix(tr("XML read error: ","prefix for XML error messages"));
80  QString postfix(tr(" (non-critical)", "postfix for XML error messages"));
81 
82  QXmlStreamAttributes attribs = reader->attributes();
83  QString str;
84 
85  // read name
86  str = attribs.value(reader->namespaceUri().toString(), "name").toString();
87  if(str.isEmpty())
88  {
89  reader->raiseWarning(prefix+tr("aspect name missing or empty")+postfix);
90  }
91  setName(str);
92  // read creation time
93  str = attribs.value(reader->namespaceUri().toString(), "creation_time").toString();
94  QDateTime creation_time = QDateTime::fromString(str, "yyyy-dd-MM hh:mm:ss:zzz");
95  if(str.isEmpty() || !creation_time.isValid())
96  {
97  reader->raiseWarning(tr("Invalid creation time for '%1'. Using current time.").arg(name()));
98  setCreationTime(QDateTime::currentDateTime());
99  }
100  else
101  setCreationTime(creation_time);
102  // read caption spec
103  str = attribs.value(reader->namespaceUri().toString(), "caption_spec").toString();
105 
106  return true;
107 }

References AbstractAspect::name(), XmlStreamReader::raiseWarning(), AbstractAspect::setCaptionSpec(), AbstractAspect::setCreationTime(), AbstractAspect::setName(), and str.

Referenced by future::Folder::load(), future::Matrix::load(), load(), AbstractSimpleFilter::load(), and Column::load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readColumnWidthElement()

bool Table::readColumnWidthElement ( XmlStreamReader reader)

Definition at line 2395 of file future_Table.cpp.

2396 {
2397  Q_ASSERT(reader->isStartElement() && reader->name() == "column_width");
2398  bool ok;
2399  int col = reader->readAttributeInt("column", &ok);
2400  if(!ok)
2401  {
2402  reader->raiseError(tr("invalid or missing column index"));
2403  return false;
2404  }
2405  QString str = reader->readElementText();
2406  int value = str.toInt(&ok);
2407  if(!ok)
2408  {
2409  reader->raiseError(tr("invalid column width"));
2410  return false;
2411  }
2412  if (d_view)
2413  d_view->setColumnWidth(col, value);
2414  else
2415  setColumnWidth(col, value);
2416  return true;
2417 }

References d_view, XmlStreamReader::raiseError(), XmlStreamReader::readAttributeInt(), setColumnWidth(), and str.

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readCommentElement()

bool AbstractAspect::readCommentElement ( XmlStreamReader reader)
protectedinherited

Load comment from an XML element.

Definition at line 61 of file AbstractAspect.cpp.

62 {
63  Q_ASSERT(reader->isStartElement() && reader->name() == "comment");
64  QString temp = reader->readElementText();
65  temp.replace("\\n", "\n");
66  setComment(temp);
67  return true;
68 }

References AbstractAspect::setComment().

Referenced by future::Folder::load(), future::Matrix::load(), load(), AbstractSimpleFilter::load(), and Column::load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ recalculateSelectedCells

void Table::recalculateSelectedCells ( )
slot

Definition at line 568 of file future_Table.cpp.

569 {
570  if (!d_view) return;
571 #ifdef LEGACY_CODE_0_2_x
572  WAIT_CURSOR;
573  beginMacro(tr("%1: apply formula to selection").arg(name()));
574  emit recalculate();
575  endMacro();
576  RESET_CURSOR;
577 #endif
578 }

References AbstractAspect::beginMacro(), d_view, AbstractAspect::endMacro(), AbstractAspect::name(), RESET_CURSOR, and WAIT_CURSOR.

Referenced by connectActions(), and pasteIntoSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove

virtual void AbstractAspect::remove ( )
inlinevirtualslotinherited

Remove me from my parent's list of children.

Definition at line 250 of file AbstractAspect.h.

References AbstractAspect::indexOfChild(), AbstractAspect::parentAspect(), and AbstractAspect::removeChild().

Referenced by Matrix::closeEvent(), PartMdiView::closeEvent(), AbstractAspect::createContextMenu(), Table::importASCII(), Column::Private::removeRows(), and future::Matrix::Private::removeRows().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllChildAspects()

void AbstractAspect::removeAllChildAspects ( )
virtualinherited

Remove all child aspects.

Definition at line 352 of file AbstractAspect.cpp.

353 {
354  beginMacro(tr("%1: remove all children.").arg(name()));
355  for (int i=childCount()-1; i >= 0; i--)
356  removeChild(i);
357  endMacro();
358 }

References AbstractAspect::beginMacro(), AbstractAspect::childCount(), AbstractAspect::endMacro(), AbstractAspect::name(), and AbstractAspect::removeChild().

Referenced by future::Folder::load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeChild() [1/2]

void AbstractAspect::removeChild ( AbstractAspect child,
bool  detach = false 
)
inherited

Remove the given Aspect from my list of children.

Usually, the ownership of the child is transfered to the undo command, i.e., the aspect is deleted by the undo command. But by setting detach to true, you can remove a child from the Aspect tree without deleting it. Of course, that means whovere detaches an Aspect in responsible for deleting it (or re-attaching it somewhere in the tree).

See also
reparentChild()

Definition at line 142 of file AbstractAspect.cpp.

143 {
144  Q_ASSERT(indexOfChild(child) != -1);
145  beginMacro(tr("%1: remove %2.").arg(name()).arg(child->name()));
148  endMacro();
149 }

References AbstractAspect::beginMacro(), AbstractAspect::child(), AbstractAspect::d_aspect_private, AbstractAspect::endMacro(), AbstractAspect::exec(), AbstractAspect::indexOfChild(), AbstractAspect::name(), and AbstractAspect::prepareAspectRemoval().

Referenced by AbstractAspect::remove(), AbstractAspect::removeAllChildAspects(), AbstractAspect::removeChild(), removeColumns(), ApplicationWindow::removeDependentTableStatistics(), and Column::setColumnMode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeChild() [2/2]

void AbstractAspect::removeChild ( int  index)
inherited

Remove the Aspect at the given index from my list of children.

The ownership of the child is transfered to the undo command, i.e., the aspect is deleted by the undo command.

See also
reparentChild()

Definition at line 174 of file AbstractAspect.cpp.

175 {
176  Q_ASSERT(index >= 0 && index <= childCount());
178 }

References AbstractAspect::Private::child(), AbstractAspect::childCount(), AbstractAspect::d_aspect_private, AbstractAspect::index(), and AbstractAspect::removeChild().

Here is the call graph for this function:

◆ removeColumn()

void Table::removeColumn ( Column col)

Definition at line 196 of file future_Table.cpp.

197 {
198  removeColumns(columnIndex(col), 1);
199 }

References columnIndex(), and removeColumns().

Referenced by removeSelectedColumns().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeColumns()

void Table::removeColumns ( int  first,
int  count 
)

Definition at line 181 of file future_Table.cpp.

182 {
183  if( count < 1 || first < 0 || first+count > columnCount()) return;
184  WAIT_CURSOR;
185  beginMacro(QObject::tr("%1: remove %2 column(s)").arg(name()).arg(count));
186  QList<Column*> cols;
187  for(int i=first; i<(first+count); i++)
188  cols.append(d_table_private.column(i));
189  // remark: the TableRemoveColumnsCmd will be created in prepareAspectRemoval()
190  foreach(Column* col, cols)
191  removeChild(col);
192  endMacro();
193  RESET_CURSOR;
194 }

References AbstractAspect::beginMacro(), future::Table::Private::column(), columnCount(), d_table_private, AbstractAspect::endMacro(), AbstractAspect::name(), AbstractAspect::removeChild(), RESET_CURSOR, and WAIT_CURSOR.

Referenced by copy(), removeColumn(), and setColumnCount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeRows()

void Table::removeRows ( int  first,
int  count 
)

Definition at line 201 of file future_Table.cpp.

202 {
203  if( count < 1 || first < 0 || first+count > rowCount()) return;
204  WAIT_CURSOR;
205  beginMacro(QObject::tr("%1: remove %2 row(s)").arg(name()).arg(count));
206  int end = d_table_private.columnCount();
207  for(int col=0; col<end; col++)
208  d_table_private.column(col)->removeRows(first, count);
210  endMacro();
211  RESET_CURSOR;
212 }

References AbstractAspect::beginMacro(), future::Table::Private::column(), future::Table::Private::columnCount(), d_table_private, AbstractAspect::endMacro(), AbstractAspect::exec(), AbstractAspect::name(), Column::removeRows(), RESET_CURSOR, rowCount(), future::Table::Private::rowCount(), and WAIT_CURSOR.

Referenced by removeSelectedRows().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeSelectedColumns

void Table::removeSelectedColumns ( )
slot

Definition at line 726 of file future_Table.cpp.

727 {
728  if (!d_view) return;
729  WAIT_CURSOR;
730  beginMacro(QObject::tr("%1: remove selected column(s)").arg(name()));
731 
732  QList< Column* > list = d_view->selectedColumns();
733  foreach(Column* ptr, list)
734  removeColumn(ptr);
735 
736  endMacro();
737  RESET_CURSOR;
738 }

References AbstractAspect::beginMacro(), d_view, AbstractAspect::endMacro(), AbstractAspect::name(), removeColumn(), RESET_CURSOR, and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeSelectedRows

void Table::removeSelectedRows ( )
slot

Definition at line 921 of file future_Table.cpp.

922 {
923  if (!d_view) return;
924 
925  WAIT_CURSOR;
926  beginMacro(QObject::tr("%1: remove selected rows(s)").arg(name()));
927  foreach(Interval<int> i, d_view->selectedRows().intervals())
928  removeRows(i.start(), i.size());
929  endMacro();
930  RESET_CURSOR;
931 }

References AbstractAspect::beginMacro(), d_view, AbstractAspect::endMacro(), AbstractAspect::name(), removeRows(), RESET_CURSOR, Interval< T >::size(), and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reparentChild() [1/2]

void AbstractAspect::reparentChild ( AbstractAspect new_parent,
AbstractAspect child 
)
inherited

Move a child to another aspect and transfer ownership.

Definition at line 151 of file AbstractAspect.cpp.

152 {
153  Q_ASSERT(new_parent != NULL);
154  reparentChild(new_parent, child, new_parent->childCount());
155 }

References AbstractAspect::child(), AbstractAspect::childCount(), and AbstractAspect::reparentChild().

Here is the call graph for this function:

◆ reparentChild() [2/2]

void AbstractAspect::reparentChild ( AbstractAspect new_parent,
AbstractAspect child,
int  d_new_index 
)
inherited

Move a child to another aspect and transfer ownership.

Definition at line 157 of file AbstractAspect.cpp.

158 {
159  Q_ASSERT(indexOfChild(child) != -1);
160  Q_ASSERT(new_index > 0 && new_index <= new_parent->childCount());
161  Q_ASSERT(new_parent != NULL);
162  QString new_name = new_parent->d_aspect_private->uniqueNameFor(child->name());
163  beginMacro(tr("%1: move %2 to %3.").arg(name()).arg(child->name()).arg(new_parent->name()));
164  if (new_name != child->name()) {
165  info(tr("Renaming \"%1\" to \"%2\" in order to avoid name collision.").arg(child->name()).arg(new_name));
166  child->setName(new_name);
167  }
169  exec(new AspectChildReparentCmd(d_aspect_private, new_parent->d_aspect_private, child, new_index));
170  new_parent->completeAspectInsertion(child, new_index);
171  endMacro();
172 }

References AbstractAspect::beginMacro(), AbstractAspect::child(), AbstractAspect::childCount(), AbstractAspect::completeAspectInsertion(), AbstractAspect::d_aspect_private, AbstractAspect::endMacro(), AbstractAspect::exec(), AbstractAspect::indexOfChild(), AbstractAspect::info(), AbstractAspect::name(), AbstractAspect::prepareAspectRemoval(), AbstractAspect::setName(), and AbstractAspect::Private::uniqueNameFor().

Referenced by AbstractAspect::reparentChild().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rowCount()

int Table::rowCount ( ) const

Return the total number of rows in the table.

Definition at line 253 of file future_Table.cpp.

254 {
255  return d_table_private.rowCount();
256 }

References d_table_private, and future::Table::Private::rowCount().

Referenced by addRows(), appendRows(), dimensionsDialog(), export_to_TeX(), goToCell(), handleDataChange(), handleRowsAboutToBeInserted(), handleRowsInserted(), insertRows(), normalizeSelection(), pasteIntoSelection(), removeRows(), and save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rowsAboutToBeInserted

void future::Table::rowsAboutToBeInserted ( int  before,
int  count 
)
signal

Referenced by connectColumn().

Here is the caller graph for this function:

◆ rowsAboutToBeRemoved

void future::Table::rowsAboutToBeRemoved ( int  first,
int  count 
)
signal

Referenced by connectColumn().

Here is the caller graph for this function:

◆ rowsInserted

void future::Table::rowsInserted ( int  first,
int  count 
)
signal

Referenced by connectColumn().

Here is the caller graph for this function:

◆ rowsRemoved

void future::Table::rowsRemoved ( int  first,
int  count 
)
signal

Referenced by connectColumn().

Here is the caller graph for this function:

◆ save()

void Table::save ( QXmlStreamWriter *  writer) const
virtual

Save as XML.

Reimplemented from AbstractAspect.

Definition at line 2288 of file future_Table.cpp.

2289 {
2290  int cols = columnCount();
2291  int rows = rowCount();
2292  writer->writeStartElement("table");
2293  writeBasicAttributes(writer);
2294  writer->writeAttribute("columns", QString::number(cols));
2295  writer->writeAttribute("rows", QString::number(rows));
2296  writeCommentElement(writer);
2297 
2298  for (int col=0; col<cols; col++)
2299  column(col)->save(writer);
2300  for (int col=0; col<cols; col++)
2301  {
2302  writer->writeStartElement("column_width");
2303  writer->writeAttribute("column", QString::number(col));
2304  writer->writeCharacters(QString::number(columnWidth(col)));
2305  writer->writeEndElement();
2306  }
2307  writer->writeEndElement(); // "table"
2308 }

References column(), columnCount(), columnWidth(), rowCount(), Column::save(), AbstractAspect::writeBasicAttributes(), and AbstractAspect::writeCommentElement().

Here is the call graph for this function:

◆ scriptingChangeEvent()

void scripted::scriptingChangeEvent ( ScriptingChangeEvent sce)
inherited

Definition at line 119 of file Script.cpp.

120 {
121  scriptEnv->decref();
122  sce->scriptingEnv()->incref();
123  scriptEnv = sce->scriptingEnv();
124 }

References ScriptingEnv::decref(), ScriptingEnv::incref(), scripted::scriptEnv, and ScriptingChangeEvent::scriptingEnv().

Referenced by ScriptEdit::customEvent(), ApplicationWindow::customEvent(), Matrix::customEvent(), and Table::customEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectAll

void Table::selectAll ( )
slot

Definition at line 2166 of file future_Table.cpp.

2167 {
2168  if (!d_view) return;
2169  d_view->selectAll();
2170 }

References d_view.

Referenced by connectActions().

Here is the caller graph for this function:

◆ setCaptionSpec

void AbstractAspect::setCaptionSpec ( const QString &  value)
slotinherited

Set the specification string used for constructing the caption().

The caption is constructed by substituting some magic tokens in the specification:

Additionally, you can use the construct C{<text>}. <text> is only shown in the caption if comment() is not empty (name and creation time should never be empty).

The default caption specification is "%n%C{ - }%c".

Definition at line 276 of file AbstractAspect.cpp.

277 {
278  if (value == d_aspect_private->captionSpec()) return;
280 }

References AbstractAspect::Private::captionSpec(), AbstractAspect::d_aspect_private, and AbstractAspect::exec().

Referenced by copy(), AbstractAspect::readBasicAttributes(), and Matrix::setCaptionPolicy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setColumnCount()

void Table::setColumnCount ( int  new_size)

Set the number of columns.

Definition at line 268 of file future_Table.cpp.

269 {
270  int old_size = columnCount();
271  if ( old_size == new_size || new_size < 0 )
272  return;
273 
274  WAIT_CURSOR;
275  if (new_size < old_size)
276  removeColumns(new_size, old_size-new_size);
277  else
278  {
279  QList<Column*> cols;
280  for(int i=0; i<new_size-old_size; i++)
281  {
282  Column * new_col = new Column(QString::number(i+1), SciDAVis::Numeric);
284  cols << new_col;
285  }
286  appendColumns(cols);
287  }
288  RESET_CURSOR;
289 }

References appendColumns(), columnCount(), SciDAVis::Numeric, removeColumns(), RESET_CURSOR, Column::setPlotDesignation(), WAIT_CURSOR, and SciDAVis::Y.

Referenced by addColumn(), addColumns(), dimensionsDialog(), and load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setColumnWidth()

void Table::setColumnWidth ( int  col,
int  width 
)

This method should only be called by the view.

This method does not change the view, it only changes the values that are saved when the table is saved. The view has to take care of reading and applying these values

Definition at line 2419 of file future_Table.cpp.

2420 {
2421  d_table_private.setColumnWidth(col, width);
2422 }

References d_table_private, and future::Table::Private::setColumnWidth().

Referenced by copy(), and readColumnWidthElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setComment

void AbstractAspect::setComment ( const QString &  value)
slotinherited

Definition at line 265 of file AbstractAspect.cpp.

266 {
267  if (value == d_aspect_private->comment()) return;
269 }

References AbstractAspect::Private::comment(), AbstractAspect::d_aspect_private, and AbstractAspect::exec().

Referenced by copy(), ImportOPJ::importSpreadsheet(), future::Folder::load(), future::Matrix::load(), load(), Column::load(), AbstractAspect::readCommentElement(), Table::setColComment(), Table::setColComments(), and Matrix::setWindowLabel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCreationTime()

void AbstractAspect::setCreationTime ( const QDateTime &  time)
protectedinherited

Set the creation time.

The creation time will automatically be set when the aspect object is created. This function is usually only needed when the aspect is loaded from a file.

Definition at line 282 of file AbstractAspect.cpp.

283 {
284  if (time == d_aspect_private->creationTime()) return;
286 }

References AbstractAspect::Private::creationTime(), AbstractAspect::d_aspect_private, and AbstractAspect::exec().

Referenced by AbstractAspect::importV0x0001XXCreationTime(), and AbstractAspect::readBasicAttributes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDefaultColumnWidth()

static void future::Table::setDefaultColumnWidth ( int  width)
inlinestatic

Definition at line 233 of file future_Table.h.

233 { default_column_width = width; }

References default_column_width.

◆ setDefaultCommentVisibility()

static void future::Table::setDefaultCommentVisibility ( bool  visible)
inlinestatic

Set default for comment visibility for table views.

Definition at line 211 of file future_Table.h.

211 { d_default_comment_visibility = visible; }

References d_default_comment_visibility.

◆ setFormulaForSelection

void Table::setFormulaForSelection ( )
slot

Definition at line 562 of file future_Table.cpp.

563 {
564  if (!d_view) return;
565  d_view->showControlFormulaTab();
566 }

References d_view.

Referenced by connectActions().

Here is the caller graph for this function:

◆ setGlobal()

void AbstractAspect::setGlobal ( const QString &  key,
const QVariant &  value 
)
staticinherited

Update a global setting.

Definition at line 370 of file AbstractAspect.cpp.

371 {
372  Private::g_settings->setValue(QString(staticMetaObject.className()) + "/" + key, value);
373 }

References AbstractAspect::Private::g_settings.

Referenced by ProjectConfigPage::apply(), and future::Matrix::importImageDialog().

Here is the caller graph for this function:

◆ setGlobalDefault()

void AbstractAspect::setGlobalDefault ( const QString &  key,
const QVariant &  value 
)
staticinherited

Set default value for a global setting.

Definition at line 375 of file AbstractAspect.cpp.

376 {
377  Private::g_defaults[QString(staticMetaObject.className()) + "/" + key] = value;
378 }

References AbstractAspect::Private::g_defaults.

◆ setName

void AbstractAspect::setName ( const QString &  value)
slotinherited

Definition at line 234 of file AbstractAspect.cpp.

235 {
236  if (value.isEmpty()) {
237  setObjectName("1");
238  return;
239  }
240  if (value == d_aspect_private->name()) return;
241  // Until we get around to completely sanitizing the project file format, we have to remove
242  // characters that can easily break file save/restore.
243  // FIXME: once the project file format is fully XML-based (i.e. able to escape special characters),
244  // this can be removed
245  QString sanitized_value = value;
246  sanitized_value.remove(QChar('\n'));
247  sanitized_value.remove(QChar('\r'));
248  sanitized_value.remove(QChar('\t'));
249  if (sanitized_value != value)
250  info(tr("Tabs and line breaks in object names are currently not supported. They have been removed."));
251  if (d_aspect_private->parent()) {
252  QString new_name = d_aspect_private->parent()->uniqueNameFor(sanitized_value);
253  if (new_name != sanitized_value)
254  info(tr("Intended name \"%1\" diverted to \"%2\" in order to avoid name collision.").arg(sanitized_value).arg(new_name));
255  exec(new AspectNameChangeCmd(d_aspect_private, new_name));
256  } else
257  exec(new AspectNameChangeCmd(d_aspect_private, sanitized_value));
258 }

References AbstractAspect::d_aspect_private, AbstractAspect::exec(), AbstractAspect::info(), AbstractAspect::Private::name(), AbstractAspect::Private::parent(), and AbstractAspect::uniqueNameFor().

Referenced by AbstractAspect::addChild(), Table::importASCII(), ApplicationWindow::importASCII(), ImportOPJ::importSpreadsheet(), Table::importV0x0001XXHeader(), AbstractAspect::insertChild(), Column::Private::Private(), AbstractAspect::readBasicAttributes(), AbstractAspect::reparentChild(), Column::Private::replaceModeData(), Table::setColName(), Column::Private::setColumnMode(), Table::setHeader(), and Matrix::setName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlotMenu()

void Table::setPlotMenu ( QMenu *  menu)

Set a plot menu.

The table takes ownership of the menu.

Definition at line 1896 of file future_Table.cpp.

1897 {
1898  d_plot_menu = menu;
1899 }

References d_plot_menu.

◆ setRowCount()

void Table::setRowCount ( int  new_size)

Set the number of rows of the table.

Definition at line 228 of file future_Table.cpp.

229 {
230  if( (new_size < 0) || (new_size == d_table_private.rowCount()) ) return;
231  WAIT_CURSOR;
232  beginMacro(QObject::tr("%1: set the number of rows to %2").arg(name()).arg(new_size));
233  if (new_size < d_table_private.rowCount())
234  {
235  int end = d_table_private.columnCount();
236  for(int col=0; col<end; col++)
237  {
238  Column *col_ptr = d_table_private.column(col);
239  if (col_ptr->rowCount() > new_size)
240  col_ptr->removeRows(new_size, col_ptr->rowCount() - new_size);
241  }
242  }
244  endMacro();
245  RESET_CURSOR;
246 }

References AbstractAspect::beginMacro(), future::Table::Private::column(), future::Table::Private::columnCount(), d_table_private, AbstractAspect::endMacro(), AbstractAspect::exec(), AbstractAspect::name(), Column::removeRows(), RESET_CURSOR, future::Table::Private::rowCount(), Column::rowCount(), and WAIT_CURSOR.

Referenced by dimensionsDialog(), handleDataChange(), handleRowsAboutToBeInserted(), future::Table::Private::insertColumns(), insertRows(), load(), future::Table::Private::replaceColumns(), and Table().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSelectedColumnsAsNone

void Table::setSelectedColumnsAsNone ( )
slot

Definition at line 801 of file future_Table.cpp.

802 {
804 }

References SciDAVis::noDesignation, and setSelectionAs().

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSelectedColumnsAsX

void Table::setSelectedColumnsAsX ( )
slot

Definition at line 776 of file future_Table.cpp.

777 {
779 }

References setSelectionAs(), and SciDAVis::X.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSelectedColumnsAsXError

void Table::setSelectedColumnsAsXError ( )
slot

Definition at line 796 of file future_Table.cpp.

797 {
799 }

References setSelectionAs(), and SciDAVis::xErr.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSelectedColumnsAsY

void Table::setSelectedColumnsAsY ( )
slot

Definition at line 781 of file future_Table.cpp.

782 {
784 }

References setSelectionAs(), and SciDAVis::Y.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSelectedColumnsAsYError

void Table::setSelectedColumnsAsYError ( )
slot

Definition at line 791 of file future_Table.cpp.

792 {
794 }

References setSelectionAs(), and SciDAVis::yErr.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSelectedColumnsAsZ

void Table::setSelectedColumnsAsZ ( )
slot

Definition at line 786 of file future_Table.cpp.

787 {
789 }

References setSelectionAs(), and SciDAVis::Z.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSelectionAs()

void Table::setSelectionAs ( SciDAVis::PlotDesignation  pd)

Definition at line 762 of file future_Table.cpp.

763 {
764  if (!d_view) return;
765  WAIT_CURSOR;
766  beginMacro(QObject::tr("%1: set plot designation(s)").arg(name()));
767 
768  QList< Column* > list = d_view->selectedColumns();
769  foreach(Column* ptr, list)
770  ptr->setPlotDesignation(pd);
771 
772  endMacro();
773  RESET_CURSOR;
774 }

References AbstractAspect::beginMacro(), d_view, AbstractAspect::endMacro(), AbstractAspect::name(), RESET_CURSOR, Column::setPlotDesignation(), and WAIT_CURSOR.

Referenced by setSelectedColumnsAsNone(), setSelectedColumnsAsX(), setSelectedColumnsAsXError(), setSelectedColumnsAsY(), setSelectedColumnsAsYError(), and setSelectedColumnsAsZ().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setView()

void Table::setView ( TableView view)

set's the view attribute. Ownership not passed to this

Definition at line 149 of file future_Table.cpp.

150 {
151  d_view = view;
153  if (d_view)
154  d_view->showComments(d_default_comment_visibility);
155 }

References addActionsToView(), d_default_comment_visibility, d_view, and view().

Referenced by view().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showTableViewColumnContextMenu

void Table::showTableViewColumnContextMenu ( const QPoint &  pos)
slot

Show a context menu for the selected columns.

Parameters
posglobal position of the event

Definition at line 1495 of file future_Table.cpp.

1496 {
1497  if (!d_view) return;
1498  QMenu context_menu;
1499 
1500 // TODO: Does undo/redo really be belong into a context menu?
1501 // context_menu.addAction(undoAction(&context_menu));
1502 // context_menu.addAction(redoAction(&context_menu));
1503 
1504  if(d_plot_menu)
1505  {
1506  context_menu.addMenu(d_plot_menu);
1507  context_menu.addSeparator();
1508  }
1509 
1510  createColumnMenu(&context_menu);
1511  context_menu.addSeparator();
1512 
1513  context_menu.exec(pos);
1514 }

References createColumnMenu(), d_plot_menu, and d_view.

Here is the call graph for this function:

◆ showTableViewContextMenu

void Table::showTableViewContextMenu ( const QPoint &  pos)
slot

Show a context menu for the selected cells.

Parameters
posglobal position of the event

Definition at line 1472 of file future_Table.cpp.

1473 {
1474  if (!d_view) return;
1475  QMenu context_menu;
1476 
1477 // TODO: Does undo/redo really be belong into a context menu?
1478 // context_menu.addAction(undoAction(&context_menu));
1479 // context_menu.addAction(redoAction(&context_menu));
1480 
1481  if(d_plot_menu)
1482  {
1483  context_menu.addMenu(d_plot_menu);
1484  context_menu.addSeparator();
1485  }
1486 
1487  createSelectionMenu(&context_menu);
1488  context_menu.addSeparator();
1489  createTableMenu(&context_menu);
1490  context_menu.addSeparator();
1491 
1492  context_menu.exec(pos);
1493 }

References createSelectionMenu(), createTableMenu(), d_plot_menu, and d_view.

Here is the call graph for this function:

◆ showTableViewRowContextMenu

void Table::showTableViewRowContextMenu ( const QPoint &  pos)
slot

Show a context menu for the selected rows.

Parameters
posglobal position of the event

Definition at line 1516 of file future_Table.cpp.

1517 {
1518  if (!d_view) return;
1519  QMenu context_menu;
1520 
1521 // TODO: Does undo/redo really be belong into a context menu?
1522 // context_menu.addAction(undoAction(&context_menu));
1523 // context_menu.addAction(redoAction(&context_menu));
1524 
1525  createRowMenu(&context_menu);
1526 
1527  context_menu.exec(pos);
1528 }

References createRowMenu(), and d_view.

Here is the call graph for this function:

◆ showTeXTableExportDialog

void Table::showTeXTableExportDialog ( )
slot

Open export to TeX dialog.

Definition at line 1530 of file future_Table.cpp.

1531 {
1532  TeXTableExportDialog export_Dialog;
1533 
1534  export_Dialog.setFileMode(QFileDialog::AnyFile);
1535  export_Dialog.setNameFilter("*.tex");
1536 
1537  //Set the default file name by the name of the table
1538  export_Dialog.selectFile( name() );
1539 
1540  export_Dialog.exec();
1541 
1542  if (export_Dialog.result() == QDialog::Accepted)
1543  {
1544  // Get file name
1545  QString fileName = export_Dialog.selectedFiles().first();
1546 
1547  //Add file extention
1548  fileName += export_Dialog.selectedNameFilter().remove( 0, 1 );
1549 
1550  //Get TeX table settings
1551  TeXTableSettings tex_settings = export_Dialog.tex_TableSettings();
1552 
1553  //Export to TeX table
1554  export_to_TeX( fileName, tex_settings );
1555  }
1556 
1557 }

References export_to_TeX(), AbstractAspect::name(), and TeXTableExportDialog::tex_TableSettings().

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sortColumns

void Table::sortColumns ( Column leading,
QList< Column * >  cols,
bool  ascending 
)
slot

Sort the given list of column.

Definition at line 1913 of file future_Table.cpp.

1914 {
1915  if(cols.isEmpty()) return;
1916 
1917  // the normal QPair comparison does not work properly with descending sorting
1918  // thefore we use our own compare functions
1919  class CompareFunctions{
1920  public:
1921  static bool doubleLess(const QPair<double, int>& a, const QPair<double, int>& b)
1922  {
1923  return a.first < b.first;
1924  }
1925  static bool doubleGreater(const QPair<double, int>& a, const QPair<double, int>& b)
1926  {
1927  return a.first > b.first;
1928  }
1929  static bool QStringLess(const QPair<QString, int>& a, const QPair<QString, int>& b)
1930  {
1931  return a < b;
1932  }
1933  static bool QStringGreater(const QPair<QString, int>& a, const QPair<QString, int>& b)
1934  {
1935  return a > b;
1936  }
1937  static bool QDateTimeLess(const QPair<QDateTime, int>& a, const QPair<QDateTime, int>& b)
1938  {
1939  return a < b;
1940  }
1941  static bool QDateTimeGreater(const QPair<QDateTime, int>& a, const QPair<QDateTime, int>& b)
1942  {
1943  return a > b;
1944  }
1945  };
1946 
1947  WAIT_CURSOR;
1948  beginMacro(tr("%1: sort column(s)").arg(name()));
1949 
1950  if(leading == 0) // sort separately
1951  {
1952  for(int i=0; i<cols.size(); i++)
1953  {
1954  Column* col = cols.at(i);
1955 
1956  if(col->dataType() == SciDAVis::TypeDouble)
1957  {
1958  int rows = col->rowCount();
1959  QList< QPair<double, int> > map;
1960 
1961  for(int j=0; j<rows; j++)
1962  map.append(QPair<double, int>(col->valueAt(j), j));
1963 
1964  if(ascending)
1965  qStableSort(map.begin(), map.end(), CompareFunctions::doubleLess);
1966  else
1967  qStableSort(map.begin(), map.end(), CompareFunctions::doubleGreater);
1968 
1969  QListIterator< QPair<double, int> > it(map);
1970  Column *temp_col = new Column("temp", col->columnMode());
1971 
1972  int k=0;
1973  // put the values in the right order into temp_col
1974  while(it.hasNext())
1975  {
1976  temp_col->copy(col, it.peekNext().second, k, 1);
1977  temp_col->setMasked(col->isMasked(it.next().second));
1978  k++;
1979  }
1980  // copy the sorted column
1981  col->copy(temp_col, 0, 0, rows);
1982  delete temp_col;
1983  }
1984  else if(col->dataType() == SciDAVis::TypeQString)
1985  {
1986  int rows = col->rowCount();
1987  QList< QPair<QString, int> > map;
1988 
1989  for(int j=0; j<rows; j++)
1990  map.append(QPair<QString, int>(col->textAt(j), j));
1991 
1992  if(ascending)
1993  qStableSort(map.begin(), map.end(), CompareFunctions::QStringLess);
1994  else
1995  qStableSort(map.begin(), map.end(), CompareFunctions::QStringGreater);
1996 
1997  QListIterator< QPair<QString, int> > it(map);
1998  Column *temp_col = new Column("temp", col->columnMode());
1999 
2000  int k=0;
2001  // put the values in the right order into temp_col
2002  while(it.hasNext())
2003  {
2004  temp_col->copy(col, it.peekNext().second, k, 1);
2005  temp_col->setMasked(col->isMasked(it.next().second));
2006  k++;
2007  }
2008  // copy the sorted column
2009  col->copy(temp_col, 0, 0, rows);
2010  delete temp_col;
2011  }
2012  else if(col->dataType() == SciDAVis::TypeQDateTime)
2013  {
2014  int rows = col->rowCount();
2015  QList< QPair<QDateTime, int> > map;
2016 
2017  for(int j=0; j<rows; j++)
2018  map.append(QPair<QDateTime, int>(col->dateTimeAt(j), j));
2019 
2020  if(ascending)
2021  qStableSort(map.begin(), map.end(), CompareFunctions::QDateTimeLess);
2022  else
2023  qStableSort(map.begin(), map.end(), CompareFunctions::QDateTimeGreater);
2024 
2025  QListIterator< QPair<QDateTime, int> > it(map);
2026  Column *temp_col = new Column("temp", col->columnMode());
2027 
2028  int k=0;
2029  // put the values in the right order into temp_col
2030  while(it.hasNext())
2031  {
2032  temp_col->copy(col, it.peekNext().second, k, 1);
2033  temp_col->setMasked(col->isMasked(it.next().second));
2034  k++;
2035  }
2036  // copy the sorted column
2037  col->copy(temp_col, 0, 0, rows);
2038  delete temp_col;
2039  }
2040  }
2041 
2042  }
2043  else // sort with leading column
2044  {
2045  if(leading->dataType() == SciDAVis::TypeDouble)
2046  {
2047  QList< QPair<double, int> > map;
2048  int rows = leading->rowCount();
2049 
2050  for(int i=0; i<rows; i++)
2051  map.append(QPair<double, int>(leading->valueAt(i), i));
2052 
2053  if(ascending)
2054  qStableSort(map.begin(), map.end(), CompareFunctions::doubleLess);
2055  else
2056  qStableSort(map.begin(), map.end(), CompareFunctions::doubleGreater);
2057  QListIterator< QPair<double, int> > it(map);
2058 
2059  for(int i=0; i<cols.size(); i++)
2060  {
2061  Column *temp_col = new Column("temp", cols.at(i)->columnMode());
2062  it.toFront();
2063  int j=0;
2064  // put the values in the right order into temp_col
2065  while(it.hasNext())
2066  {
2067  temp_col->copy(cols.at(i), it.peekNext().second, j, 1);
2068  temp_col->setMasked(cols.at(i)->isMasked(it.next().second));
2069  j++;
2070  }
2071  // copy the sorted column
2072  cols.at(i)->copy(temp_col, 0, 0, rows);
2073  delete temp_col;
2074  }
2075  }
2076  else if(leading->dataType() == SciDAVis::TypeQString)
2077  {
2078  QList< QPair<QString, int> > map;
2079  int rows = leading->rowCount();
2080 
2081  for(int i=0; i<rows; i++)
2082  map.append(QPair<QString, int>(leading->textAt(i), i));
2083 
2084  if(ascending)
2085  qStableSort(map.begin(), map.end(), CompareFunctions::QStringLess);
2086  else
2087  qStableSort(map.begin(), map.end(), CompareFunctions::QStringGreater);
2088  QListIterator< QPair<QString, int> > it(map);
2089 
2090  for(int i=0; i<cols.size(); i++)
2091  {
2092  Column *temp_col = new Column("temp", cols.at(i)->columnMode());
2093  it.toFront();
2094  int j=0;
2095  // put the values in the right order into temp_col
2096  while(it.hasNext())
2097  {
2098  temp_col->copy(cols.at(i), it.peekNext().second, j, 1);
2099  temp_col->setMasked(cols.at(i)->isMasked(it.next().second));
2100  j++;
2101  }
2102  // copy the sorted column
2103  cols.at(i)->copy(temp_col, 0, 0, rows);
2104  delete temp_col;
2105  }
2106  }
2107  else if(leading->dataType() == SciDAVis::TypeQDateTime)
2108  {
2109  QList< QPair<QDateTime, int> > map;
2110  int rows = leading->rowCount();
2111 
2112  for(int i=0; i<rows; i++)
2113  map.append(QPair<QDateTime, int>(leading->dateTimeAt(i), i));
2114 
2115  if(ascending)
2116  qStableSort(map.begin(), map.end(), CompareFunctions::QDateTimeLess);
2117  else
2118  qStableSort(map.begin(), map.end(), CompareFunctions::QDateTimeGreater);
2119  QListIterator< QPair<QDateTime, int> > it(map);
2120 
2121  for(int i=0; i<cols.size(); i++)
2122  {
2123  Column *temp_col = new Column("temp", cols.at(i)->columnMode());
2124  it.toFront();
2125  int j=0;
2126  // put the values in the right order into temp_col
2127  while(it.hasNext())
2128  {
2129  temp_col->copy(cols.at(i), it.peekNext().second, j, 1);
2130  temp_col->setMasked(cols.at(i)->isMasked(it.next().second));
2131  j++;
2132  }
2133  // copy the sorted column
2134  cols.at(i)->copy(temp_col, 0, 0, rows);
2135  delete temp_col;
2136  }
2137  }
2138  }
2139  endMacro();
2140  RESET_CURSOR;
2141 } // end of sortColumns()

References AbstractAspect::beginMacro(), Column::columnMode(), Column::copy(), Column::dataType(), Column::dateTimeAt(), AbstractAspect::endMacro(), Column::isMasked(), AbstractAspect::name(), RESET_CURSOR, Column::rowCount(), Column::setMasked(), Column::textAt(), SciDAVis::TypeDouble, SciDAVis::TypeQDateTime, SciDAVis::TypeQString, Column::valueAt(), and WAIT_CURSOR.

Referenced by sortDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sortDialog()

void Table::sortDialog ( QList< Column * >  cols)

Open the sort dialog for the given columns.

Definition at line 1901 of file future_Table.cpp.

1902 {
1903  if(cols.isEmpty()) return;
1904 
1905  SortDialog *sortd = new future::SortDialog();
1906  sortd->setAttribute(Qt::WA_DeleteOnClose);
1907  connect(sortd, SIGNAL(sort(Column*,QList<Column*>,bool)), this, SLOT(sortColumns(Column*,QList<Column*>,bool)));
1908  sortd->setColumnsList(cols);
1909  sortd->exec();
1910 }

References future::SortDialog::setColumnsList(), and sortColumns().

Referenced by sortSelectedColumns(), and sortTable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sortSelectedColumns

void Table::sortSelectedColumns ( )
slot

Definition at line 872 of file future_Table.cpp.

873 {
874  if (!d_view) return;
875  QList< Column* > cols = d_view->selectedColumns();
876  sortDialog(cols);
877 }

References d_view, and sortDialog().

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sortTable

void Table::sortTable ( )
slot

Open the sort dialog for all columns.

Definition at line 683 of file future_Table.cpp.

684 {
685  QList<Column*> cols;
686 
687  for(int i=0; i<columnCount(); i++)
688  cols.append(column(i));
689 
690  sortDialog(cols);
691 }

References column(), columnCount(), and sortDialog().

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ statisticsOnSelectedColumns

void Table::statisticsOnSelectedColumns ( )
slot

Definition at line 879 of file future_Table.cpp.

880 {
881 #ifdef LEGACY_CODE_0_2_x
882  // TODO: this is only an ugly hack for 0.2.0
883  emit requestColumnStatistics();
884 #endif
885 }

Referenced by connectActions().

Here is the caller graph for this function:

◆ statisticsOnSelectedRows

void Table::statisticsOnSelectedRows ( )
slot

Definition at line 887 of file future_Table.cpp.

888 {
889 #ifdef LEGACY_CODE_0_2_x
890  // TODO: this is only an ugly hack for 0.2.0
891  emit requestRowStatistics();
892 #endif
893 }

Referenced by connectActions().

Here is the caller graph for this function:

◆ statusInfo

void AbstractAspect::statusInfo ( const QString &  text)
signalinherited

Emit this to give status information to the user.

Referenced by AbstractAspect::info(), and AbstractAspect::Private::insertChild().

Here is the caller graph for this function:

◆ text()

QString Table::text ( int  row,
int  col 
)

Return the text displayed in the given cell.

Definition at line 2153 of file future_Table.cpp.

2154 {
2155  Column * col_ptr = column(col);
2156  if(!col_ptr)
2157  return QString();
2158  if(col_ptr->isInvalid(row))
2159  return QString();
2160 
2161  AbstractSimpleFilter * out_fltr = col_ptr->outputFilter();
2162  out_fltr->input(0, col_ptr);
2163  return out_fltr->output(0)->textAt(row);
2164 }

References column(), AbstractFilter::input(), Column::isInvalid(), AbstractSimpleFilter::output(), Column::outputFilter(), and AbstractColumn::textAt().

Referenced by copySelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ translateActionsStrings()

void Table::translateActionsStrings ( )
private

Definition at line 1427 of file future_Table.cpp.

1428 {
1429  action_cut_selection->setText(tr("Cu&t"));
1430  action_copy_selection->setText(tr("&Copy"));
1431  action_paste_into_selection->setText(tr("Past&e"));
1432 #ifndef LEGACY_CODE_0_2_x
1433  action_mask_selection->setText(tr("&Mask","mask selection"));
1434  action_unmask_selection->setText(tr("&Unmask","unmask selection"));
1435  action_clear_masks->setText(tr("Clear Masks"));
1436 #endif
1437  action_set_formula->setText(tr("Assign &Formula"));
1438  action_clear_selection->setText(tr("Clea&r","clear selection"));
1439  action_recalculate->setText(tr("Recalculate"));
1440  action_fill_row_numbers->setText(tr("Row Numbers"));
1441  action_fill_random->setText(tr("Random Values"));
1442  action_formula_mode->setText(tr("Formula Edit Mode"));
1443  action_select_all->setText(tr("Select All"));
1444  action_add_column->setText(tr("&Add Column"));
1445  action_clear_table->setText(tr("Clear Table"));
1446  action_export_to_TeX->setText(tr("Export to TeX..."));
1447  action_sort_table->setText(tr("&Sort Table"));
1448  action_go_to_cell->setText(tr("&Go to Cell"));
1449  action_dimensions_dialog->setText(tr("&Dimensions", "table size"));
1450  action_insert_columns->setText(tr("&Insert Empty Columns"));
1451  action_remove_columns->setText(tr("Remo&ve Columns"));
1452  action_clear_columns->setText(tr("Clea&r Columns"));
1453  action_add_columns->setText(tr("&Add Columns"));
1454  action_set_as_x->setText(tr("X","plot designation"));
1455  action_set_as_y->setText(tr("Y","plot designation"));
1456  action_set_as_z->setText(tr("Z","plot designation"));
1457  action_set_as_xerr->setText(tr("X Error","plot designation"));
1458  action_set_as_yerr->setText(tr("Y Error","plot designation"));
1459  action_set_as_none->setText(tr("None","plot designation"));
1460  action_normalize_columns->setText(tr("&Normalize Columns"));
1461  action_normalize_selection->setText(tr("&Normalize Selection"));
1462  action_sort_columns->setText(tr("&Sort Columns"));
1463  action_statistics_columns->setText(tr("Column Statisti&cs"));
1464  action_type_format->setText(tr("Change &Type && Format"));
1465  action_edit_description->setText(tr("Edit Column &Description"));
1466  action_insert_rows->setText(tr("&Insert Empty Rows"));
1467  action_remove_rows->setText(tr("Remo&ve Rows"));
1468  action_clear_rows->setText(tr("Clea&r Rows"));
1469  action_add_rows->setText(tr("&Add Rows"));
1470  action_statistics_rows->setText(tr("Row Statisti&cs"));
1471 }

References action_add_column, action_add_columns, action_add_rows, action_clear_columns, action_clear_masks, action_clear_rows, action_clear_selection, action_clear_table, action_copy_selection, action_cut_selection, action_dimensions_dialog, action_edit_description, action_export_to_TeX, action_fill_random, action_fill_row_numbers, action_formula_mode, action_go_to_cell, action_insert_columns, action_insert_rows, action_mask_selection, action_normalize_columns, action_normalize_selection, action_paste_into_selection, action_recalculate, action_remove_columns, action_remove_rows, action_select_all, action_set_as_none, action_set_as_x, action_set_as_xerr, action_set_as_y, action_set_as_yerr, action_set_as_z, action_set_formula, action_sort_columns, action_sort_table, action_statistics_columns, action_statistics_rows, action_type_format, and action_unmask_selection.

Referenced by fillProjectMenu().

Here is the caller graph for this function:

◆ undoStack()

virtual QUndoStack* AbstractAspect::undoStack ( ) const
inlinevirtualinherited

Return the undo stack of the Project, or 0 if this Aspect is not part of a Project.

It's also possible to construct undo-enabled Aspect trees without Project. The only requirement is that the root Aspect reimplements undoStack() to get the undo stack from somewhere (the default implementation just delegates to parentAspect()).

Reimplemented in Project.

Definition at line 182 of file AbstractAspect.h.

182 { return parentAspect() ? parentAspect()->undoStack() : 0; }

References AbstractAspect::parentAspect(), and AbstractAspect::undoStack().

Referenced by AbstractAspect::beginMacro(), AbstractAspect::endMacro(), AbstractAspect::exec(), and AbstractAspect::undoStack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uniqueNameFor

QString AbstractAspect::uniqueNameFor ( const QString &  current_name) const
slotinherited

Make the specified name unique among my children by incrementing a trailing number.

Definition at line 337 of file AbstractAspect.cpp.

338 {
339  return d_aspect_private->uniqueNameFor(current_name);
340 }

References AbstractAspect::d_aspect_private, and AbstractAspect::Private::uniqueNameFor().

Referenced by AbstractAspect::setName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unmaskSelection

void Table::unmaskSelection ( )
slot

Definition at line 541 of file future_Table.cpp.

542 {
543  if (!d_view) return;
544  int first = d_view->firstSelectedRow();
545  int last = d_view->lastSelectedRow();
546  if( first < 0 ) return;
547 
548  WAIT_CURSOR;
549  beginMacro(tr("%1: unmask selected cell(s)").arg(name()));
550  QList<Column*> list = d_view->selectedColumns();
551  foreach(Column * col_ptr, list)
552  {
553  int col = columnIndex(col_ptr);
554  for(int row=first; row<=last; row++)
555  if(d_view->isCellSelected(row, col)) col_ptr->setMasked(row, false);
556  }
557  endMacro();
558  RESET_CURSOR;
559 }

References AbstractAspect::beginMacro(), columnIndex(), d_view, AbstractAspect::endMacro(), AbstractAspect::name(), RESET_CURSOR, Column::setMasked(), and WAIT_CURSOR.

Referenced by connectActions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ view()

QWidget * Table::view ( )
virtual

Construct a primary view on me.

This method may be called multiple times during the life time of an Aspect, or it might not get called at all. Aspects must not depend on the existence of a view for their operation.

Implements AbstractPart.

Definition at line 157 of file future_Table.cpp.

158 {
159 #ifndef LEGACY_CODE_0_2_x
160  if (!d_view)
161  setView(new TableView(this));
162 #else
163  Q_ASSERT(d_view != NULL);
164 #endif
165  return d_view;
166 }

References d_view, and setView().

Referenced by ApplicationWindow::removeDependentTableStatistics(), and setView().

Here is the call graph for this function: