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)  

Matrix Class Reference

Matrix worksheet class. More...

#include <Matrix.h>

Inheritance diagram for Matrix:
[legend]
Collaboration diagram for Matrix:
[legend]

Public Types

enum  CaptionPolicy { Name = 0, Label = 1, Both = 2 }
 Possible window captions. More...
 
enum  Status { Hidden = -1, Normal = 0, Minimized = 1, Maximized = 2 }
 

Public Slots

void exportPDF (const QString &fileName)
 
void print ()
 Print the Matrix. More...
 
void print (const QString &fileName)
 Print the Matrix to fileName. More...
 
void handleChange ()
 
void setColumnsWidth (int width)
 Set the width of all columns (obsolete, only for OPJ import) More...
 
void setDimensions (int rows, int cols)
 Set the Matrix size. More...
 
void transpose ()
 Transpose the matrix. More...
 
void invert ()
 Invert the matrix. More...
 
double determinant ()
 Calculate the determinant of the matrix. More...
 
bool recalculate ()
 Calculate matrix values using the formula for all selected cells. More...
 
QString text (int row, int col)
 Return the content of the cell as a string. More...
 
void setText (int row, int col, const QString &new_text)
 Set the content of the cell as a string. More...
 
double cell (int row, int col)
 Return the value of the cell as a double. More...
 
void setCell (int row, int col, double value)
 Set the value of the cell. More...
 
void setCells (const QVector< qreal > &)
 Set the value of all cells. More...
 
QChar textFormat ()
 Return the text format code ('e', 'f', ...) More...
 

Signals

void showContextMenu ()
 Show the context menu. More...
 
void closedWindow (MyWidget *)
 Emitted when the window was closed. More...
 
void hiddenWindow (MyWidget *)
 Emitted when the window was hidden. More...
 
void modifiedWindow (MyWidget *)
 
void resizedWindow (MyWidget *)
 
void statusChanged (MyWidget *)
 Emitted when the window status changed. More...
 
void showTitleBarMenu ()
 Emitted when the title bar recieves a QContextMenuEvent. More...
 

Public Member Functions

virtual QString name ()
 Return the window name. More...
 
virtual void setName (const QString &s)
 Set the window name. More...
 
virtual QString windowLabel ()
 Return the window label. More...
 
virtual void setWindowLabel (const QString &s)
 Set the window label. More...
 
void setCaptionPolicy (CaptionPolicy policy)
 Set the caption policy. More...
 
virtual void setBirthDate (const QString &s)
 Set the creation date. More...
 
 Matrix (ScriptingEnv *env, int r, int c, const QString &label, QWidget *parent=0, const char *name=0, Qt::WindowFlags f=0)
 Constructor. More...
 
 ~Matrix ()
 
int numRows ()
 Return the number of rows. More...
 
void setNumRows (int rows)
 
int numCols ()
 Return the number of columns. More...
 
void setNumCols (int cols)
 
void customEvent (QEvent *e)
 Custom event handler. More...
 
void closeEvent (QCloseEvent *)
 
void updateDecimalSeparators ()
 
virtual QWidget * view ()
 
int precision ()
 Return the number precision digits. More...
 
void setNumericPrecision (int prec)
 Set the number of significant digits. More...
 
void setTextFormat (const QChar &format, int precision)
 Set the number format for the cells. More...
 
void setNumericFormat (const QChar &f, int prec)
 Set the number format for the cells. More...
 
QString formula ()
 Return the matrix formula. More...
 
void setFormula (const QString &s)
 Set the matrix forumla. More...
 
QString saveAsTemplate (const QString &info)
 Format the matrix format in a string to save it in a template file. More...
 
QString saveToString (const QString &info)
 Return a string to save the matrix in a project file (<matrix> section) More...
 
QString saveText ()
 Return a string conaining the data of the matrix (<data> section) More...
 
void cutSelection ()
 Standard cut operation. More...
 
void copySelection ()
 Standard copy operation. More...
 
void clearSelection ()
 Clear cells. More...
 
void pasteSelection ()
 Standard paste operation. More...
 
void insertRow ()
 Insert a row before the current cell. More...
 
bool rowsSelected ()
 Return whether any rows are fully selected. More...
 
void deleteSelectedRows ()
 Delete the selected rows. More...
 
int numSelectedRows ()
 Return the number of selected rows. More...
 
void insertColumn ()
 Insert a column before the current cell. More...
 
bool columnsSelected ()
 Return whether any columns are fully selected. More...
 
void deleteSelectedColumns ()
 Delte the selected columns. More...
 
int numSelectedColumns ()
 Return the number of selected columns. More...
 
void saveCellsToMemory ()
 Temporally save the cell values to memory. More...
 
void forgetSavedCells ()
 
double xStart ()
 Return the X value corresponding to column 1. More...
 
double xEnd ()
 Return the X value corresponding to the last column. More...
 
double yStart ()
 Return the Y value corresponding to row 1. More...
 
double yEnd ()
 Return the Y value corresponding to the last row. More...
 
QwtDoubleRect boundingRect ()
 Returns the bounding rect of the matrix coordinates. More...
 
void setCoordinates (double xs, double xe, double ys, double ye)
 Set the X and Y coordinate intervals. More...
 
void range (double *min, double *max)
 Min and max values of the matrix. More...
 
void copy (Matrix *m)
 
virtual QString birthDate ()
 Return the creation date. More...
 
bool isControlTabBarVisible ()
 
virtual CaptionPolicy captionPolicy ()
 Return the caption policy. More...
 
QString aspect ()
 Return the window status as a string. More...
 
Status status ()
 Return the window status flag (hidden, normal, minimized or maximized) More...
 
void setStatus (Status s)
 Set the window status flag (hidden, normal, minimized or maximized) More...
 
virtual void restore (const QStringList &)
 Not implemented yet. More...
 
virtual void setHidden ()
 Notifies that a window was hidden by a direct user action. More...
 
void askOnCloseEvent (bool ask)
 Toggle the "ask on close" flag. More...
 
void contextMenuEvent (QContextMenuEvent *e)
 Customizes title bar's context menu) More...
 
Folderfolder ()
 Returns the pointer to the parent folder of the window. More...
 
void setFolder (Folder *f)
 Initializes the pointer to the parent folder of the window. More...
 
void notifyChanges ()
 Notifies the main application that the window has been modified. More...
 
void setNormal ()
 
void setMinimized ()
 
void setMaximized ()
 
void scriptingChangeEvent (ScriptingChangeEvent *)
 

Static Public Member Functions

static double ** allocateMatrixData (int rows, int columns)
 Allocate memory for a matrix buffer. More...
 
static void freeMatrixData (double **data, int rows)
 Free memory used for a matrix buffer. More...
 
static MatrixfromImage (const QImage &image, ScriptingEnv *env)
 

Public Attributes

future::Matrixd_future_matrix
 

Protected Slots

void applyFormula ()
 
void addFunction ()
 
void addCell ()
 
void updateFunctionDoc ()
 
void handleAspectDescriptionChange (const AbstractAspect *aspect)
 
void updateCaption ()
 Set caption according to current CaptionPolicy, name and label. More...
 

Protected Attributes

FolderparentFolder
 Pointer to the parent folder of the window. More...
 
QString w_label
 The window label. More...
 
QString birthdate
 The creation date. More...
 
Status w_status
 The window status. More...
 
CaptionPolicy caption_policy
 The caption policy. More...
 
bool askOnClose
 Toggle on/off: Ask the user "delete, hide, or cancel?" on a close event. More...
 
ScriptingEnvscriptEnv
 

Private Member Functions

void init (int rows, int cols)
 Initialize the matrix. More...
 
 Matrix (future::Matrix *future_matrix, ScriptingEnv *env, int r, int c, const QString &label, QWidget *parent=0, const char *name=0, Qt::WindowFlags f=0)
 

Private Attributes

double ** dMatrix
 Stores the matrix data only before the user opens the matrix dialog in order to avoid data loses during number format changes. More...
 

selection related functions

int selectedColumnCount (bool full=false)
 Return how many columns are selected. More...
 
bool isColumnSelected (int col, bool full=false)
 Returns true if column 'col' is selected; otherwise false. More...
 
int selectedRowCount (bool full=false)
 Return how many rows are (at least partly) selected. More...
 
bool isRowSelected (int row, bool full=false)
 Returns true if row 'row' is selected; otherwise false. More...
 
int firstSelectedColumn (bool full=false)
 Return the index of the first selected column. More...
 
int lastSelectedColumn (bool full=false)
 Return the index of the last selected column. More...
 
int firstSelectedRow (bool full=false)
 Return the index of the first selected row. More...
 
int lastSelectedRow (bool full=false)
 Return the index of the last selected row. More...
 
bool isCellSelected (int row, int col)
 Return whether a cell is selected. More...
 
void setCellSelected (int row, int col)
 Select a cell. More...
 
void setCellsSelected (int first_row, int first_col, int last_row, int last_col)
 Select a range of cells. More...
 
void getCurrentCell (int *row, int *col)
 Determine the current cell (-1 if no cell is designated as the current) More...
 
void setRowHeight (int row, int height)
 
void setColumnWidth (int col, int width)
 
int rowHeight (int row) const
 
int columnWidth (int col) const
 
void rereadSectionSizes ()
 
void goToCell (int row, int col)
 
void selectAll ()
 
void toggleControlTabBar ()
 
void showControlCoordinatesTab ()
 
void showControlFormatTab ()
 
void showControlFormulaTab ()
 
void applyCoordinates ()
 
void updateCoordinatesTab ()
 
void updateFormulaTab ()
 
void updateFormatTab ()
 
void applyFormat ()
 
void handleHorizontalSectionResized (int logicalIndex, int oldSize, int newSize)
 
void handleVerticalSectionResized (int logicalIndex, int oldSize, int newSize)
 
void controlTabBarStatusChanged (bool visible)
 
void advanceCell ()
 Advance current cell after [Return] or [Enter] was pressed. More...
 
void updateTypeInfo ()
 
MatrixModeld_model
 Pointer to the current underlying model. More...
 
Ui::MatrixControlTabs ui
 
MatrixViewWidgetd_view_widget
 The matrix view (first part of the UI) More...
 
QWidget * d_control_tabs
 Widget that contains the control tabs UI from ui. More...
 
QToolButton * d_hide_button
 Button to toogle the visibility of #d_tool_box. More...
 
QHBoxLayout * d_main_layout
 
QPointer< future::Matrixd_matrix
 
virtual void changeEvent (QEvent *event)
 
void retranslateStrings ()
 
bool eventFilter (QObject *watched, QEvent *event)
 
void init ()
 Initialization. More...
 

Detailed Description

Matrix worksheet class.

Definition at line 51 of file Matrix.h.

Member Enumeration Documentation

◆ CaptionPolicy

enum MyWidget::CaptionPolicy
inherited

Possible window captions.

Enumerator
Name 

caption determined by the window name

Label 

caption detemined by the window label

Both 

caption = "name - label"

Definition at line 68 of file MyWidget.h.

68  {
69  Name = 0,
70  Label = 1,
71  Both = 2
72  };

◆ Status

enum MyWidget::Status
inherited
Enumerator
Hidden 
Normal 
Minimized 
Maximized 

Definition at line 73 of file MyWidget.h.

73 {Hidden = -1, Normal = 0, Minimized = 1, Maximized = 2};

Constructor & Destructor Documentation

◆ Matrix() [1/2]

Matrix::Matrix ( ScriptingEnv env,
int  r,
int  c,
const QString &  label,
QWidget *  parent = 0,
const char *  name = 0,
Qt::WindowFlags  f = 0 
)

Constructor.

Parameters
envscripting interpreter
rinitial number of rows
cinitial number of columns
labelwindow label
parentparent object
name
namewindow name
fwindow flags

File : Matrix.cpp Project : SciDAVis

Description : Matrix worksheet class

Copyright : (C) 2006-2009 Tilman Benkert (thzs*gmx.net) Copyright : (C) 2006-2009 Knut Franke (knut.franke*gmx.de) Copyright : (C) 2006-2007 Ion Vasilief (ion_vasilief*yahoo.fr) (replace * with @ in the email addresses)

  • 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 63 of file Matrix.cpp.

64  : MatrixView(label, parent, name, f), scripted(env)
65 {
66  d_future_matrix = new future::Matrix(0, r, c, label);
67  init(r, c);
68 }

References d_future_matrix, and MatrixView::init().

Referenced by fromImage().

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

◆ ~Matrix()

Matrix::~Matrix ( )

Definition at line 125 of file Matrix.cpp.

126 {
127 }

◆ Matrix() [2/2]

Matrix::Matrix ( future::Matrix future_matrix,
ScriptingEnv env,
int  r,
int  c,
const QString &  label,
QWidget *  parent = 0,
const char *  name = 0,
Qt::WindowFlags  f = 0 
)
private

Definition at line 70 of file Matrix.cpp.

71  : MatrixView(label, parent, name, f), scripted(env)
72 {
73  d_future_matrix = future_matrix;
74  init(r, c);
75 }

References d_future_matrix, and MatrixView::init().

Here is the call graph for this function:

Member Function Documentation

◆ addCell

void Matrix::addCell ( )
protectedslot

Definition at line 750 of file Matrix.cpp.

751 {
752  ui.formula_box->insertPlainText(ui.add_cell_combobox->currentText());
753 }

References MatrixView::ui.

Referenced by init().

Here is the caller graph for this function:

◆ addFunction

void Matrix::addFunction ( )
protectedslot

Definition at line 745 of file Matrix.cpp.

746 {
747  static_cast<ScriptEdit *>(ui.formula_box)->insertFunction(ui.add_function_combobox->currentText());
748 }

References MatrixView::ui.

Referenced by init().

Here is the caller graph for this function:

◆ advanceCell

void MatrixView::advanceCell ( )
protectedslotinherited

Advance current cell after [Return] or [Enter] was pressed.

Definition at line 223 of file MatrixView.cpp.

224 {
225  if (d_matrix)
226  {
227  QModelIndex idx = d_view_widget->currentIndex();
228  if(idx.row()+1 < d_matrix->rowCount())
229  d_view_widget->setCurrentIndex(idx.sibling(idx.row()+1, idx.column()));
230  }
231 }

References MatrixView::d_matrix, and MatrixView::d_view_widget.

Referenced by MatrixView::init().

Here is the caller graph for this function:

◆ allocateMatrixData()

double ** Matrix::allocateMatrixData ( int  rows,
int  columns 
)
static

Allocate memory for a matrix buffer.

Definition at line 696 of file Matrix.cpp.

697 {
698  double** data = new double* [rows];
699  for ( int i = 0; i < rows; ++i)
700  data[i] = new double [columns];
701 
702  return data;
703 }

Referenced by Graph3D::addData(), Graph3D::addMatrixData(), saveCellsToMemory(), Graph3D::updateDataXY(), Graph3D::updateMatrixData(), Graph3D::updateScales(), and Graph3D::updateScalesFromMatrix().

Here is the caller graph for this function:

◆ applyCoordinates

void MatrixView::applyCoordinates ( )
slotinherited

Definition at line 433 of file MatrixView.cpp.

434 {
435  if (d_matrix)
436  d_matrix->setCoordinates(ui.first_col_spinbox->value(), ui.last_col_spinbox->value(),
437  ui.first_row_spinbox->value(), ui.last_row_spinbox->value());
438 }

References MatrixView::d_matrix, and MatrixView::ui.

Referenced by MatrixView::init().

Here is the caller graph for this function:

◆ applyFormat

void MatrixView::applyFormat ( )
slotinherited

Definition at line 472 of file MatrixView.cpp.

473 {
474  if (d_matrix)
475  {
476  int digits = ui.digits_box->value();
477  int format_index = ui.format_box->currentIndex();
478  if (format_index >= 0)
479  {
480  char format = ui.format_box->itemData(format_index).toChar().toLatin1();
481  d_matrix->setNumericFormat(format);
482  }
483  d_matrix->setDisplayedDigits(digits);
484  }
485 }

References MatrixView::d_matrix, and MatrixView::ui.

Referenced by MatrixView::init().

Here is the caller graph for this function:

◆ applyFormula

void Matrix::applyFormula ( )
protectedslot

Definition at line 733 of file Matrix.cpp.

734 {
735  QApplication::setOverrideCursor(Qt::WaitCursor);
736  d_future_matrix->beginMacro(tr("%1: apply formula to selection").arg(name()));
737 
738  setFormula(ui.formula_box->toPlainText());
739  recalculate();
740 
742  QApplication::restoreOverrideCursor();
743 }

References AbstractAspect::beginMacro(), d_future_matrix, AbstractAspect::endMacro(), name(), recalculate(), setFormula(), and MatrixView::ui.

Referenced by init().

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

◆ askOnCloseEvent()

void MyWidget::askOnCloseEvent ( bool  ask)
inlineinherited

Toggle the "ask on close" flag.

Definition at line 123 of file MyWidget.h.

123 {askOnClose = ask;};

References MyWidget::askOnClose.

Referenced by ApplicationWindow::connectMultilayerPlot(), ApplicationWindow::connectSurfacePlot(), ApplicationWindow::connectTable(), ApplicationWindow::deleteFitTables(), ApplicationWindow::initMatrix(), and ApplicationWindow::initNote().

Here is the caller graph for this function:

◆ aspect()

QString MyWidget::aspect ( )
inherited

Return the window status as a string.

Definition at line 106 of file MyWidget.cpp.

107 {
108  QString s = tr("Normal");
109  switch (w_status)
110  {
111  case Hidden:
112  return tr("Hidden");
113  break;
114 
115  case Normal:
116  break;
117 
118  case Minimized:
119  return tr("Minimized");
120  break;
121 
122  case Maximized:
123  return tr("Maximized");
124  break;
125  }
126  return s;
127 }

References MyWidget::Hidden, MyWidget::Maximized, MyWidget::Minimized, MyWidget::Normal, and MyWidget::w_status.

Referenced by ApplicationWindow::addListViewItem(), TableView::handleAspectAdded(), Table::handleAspectDescriptionAboutToChange(), handleAspectDescriptionChange(), Table::handleAspectDescriptionChange(), TableView::handleAspectDescriptionChanged(), MultiLayer::print(), and ApplicationWindow::updateWindowStatus().

Here is the caller graph for this function:

◆ birthDate()

virtual QString Matrix::birthDate ( )
inlinevirtual

Return the creation date.

Reimplemented from MyWidget.

Definition at line 288 of file Matrix.h.

288 {return d_future_matrix->creationTime().toString(Qt::LocalDate); };

References AbstractAspect::creationTime(), and d_future_matrix.

Referenced by saveToString().

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

◆ boundingRect()

QwtDoubleRect Matrix::boundingRect ( )
inline

Returns the bounding rect of the matrix coordinates.

Definition at line 272 of file Matrix.h.

272 {return QwtDoubleRect(xStart(), yStart(), xEnd()-xStart(), yEnd()-yStart()).normalized();};

References xEnd(), xStart(), yEnd(), and yStart().

Here is the call graph for this function:

◆ captionPolicy()

virtual CaptionPolicy MyWidget::captionPolicy ( )
inlinevirtualinherited

Return the caption policy.

Definition at line 86 of file MyWidget.h.

86 {return caption_policy;};

References MyWidget::caption_policy.

Referenced by RenameWindowDialog::accept(), ApplicationWindow::clone(), ApplicationWindow::convertMatrixToTable(), ApplicationWindow::convertTableToMatrix(), ApplicationWindow::renameWindow(), Graph3D::saveToString(), MultiLayer::saveToString(), TableStatistics::saveToString(), saveToString(), Note::saveToString(), and RenameWindowDialog::setWidget().

Here is the caller graph for this function:

◆ cell

double Matrix::cell ( int  row,
int  col 
)
slot

Return the value of the cell as a double.

Definition at line 134 of file Matrix.cpp.

135 {
136  if(dMatrix)
137  return dMatrix[row][col];
138  else
139  return d_future_matrix->cell(row, col);
140 }

References future::Matrix::cell(), d_future_matrix, and dMatrix.

Referenced by Graph3D::addMatrixData(), ApplicationWindow::convertMatrixToTable(), determinant(), invert(), MuParserScript::matrixCellFunction(), MatrixData::MatrixData(), range(), saveText(), Graph3D::updateMatrixData(), and Graph3D::updateScalesFromMatrix().

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

◆ changeEvent()

void MatrixView::changeEvent ( QEvent *  event)
protectedvirtualinherited

Reimplemented from MyWidget.

Definition at line 204 of file MatrixView.cpp.

205 {
206  if (event->type() == QEvent::LanguageChange)
208  MyWidget::changeEvent(event);
209 }

References MyWidget::changeEvent(), and MatrixView::retranslateStrings().

Here is the call graph for this function:

◆ clearSelection()

void Matrix::clearSelection ( )

Clear cells.

Definition at line 447 of file Matrix.cpp.

448 {
450 }

References future::Matrix::clearSelectedCells(), and d_future_matrix.

Referenced by cutSelection().

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

◆ closedWindow

void MyWidget::closedWindow ( MyWidget )
signalinherited

Emitted when the window was closed.

Referenced by MyWidget::closeEvent().

Here is the caller graph for this function:

◆ closeEvent()

void Matrix::closeEvent ( QCloseEvent *  e)

Definition at line 532 of file Matrix.cpp.

533 {
534  if (askOnClose)
535  {
536  switch( QMessageBox::information(this,tr("SciDAVis"),
537  tr("Do you want to hide or delete") + "<p><b>'" + objectName() + "'</b> ?",
538  tr("Delete"), tr("Hide"), tr("Cancel"), 0,2))
539  {
540  case 0:
541  e->accept();
543  return;
544 
545  case 1:
546  e->ignore();
547  emit hiddenWindow(this);
548  break;
549 
550  case 2:
551  e->ignore();
552  break;
553  }
554  }
555  else
556  {
557  e->accept();
559  return;
560  }
561 }

References MyWidget::askOnClose, d_future_matrix, MyWidget::hiddenWindow(), and AbstractAspect::remove().

Here is the call graph for this function:

◆ columnsSelected()

bool Matrix::columnsSelected ( )

Return whether any columns are fully selected.

Definition at line 483 of file Matrix.cpp.

484 {
485  for(int i=0; i<numCols(); i++)
486  {
487  if (this->isColumnSelected (i, true))
488  return true;
489  }
490  return false;
491 }

References MatrixView::isColumnSelected(), and numCols().

Referenced by ApplicationWindow::showWindowContextMenu().

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

◆ columnWidth()

int MatrixView::columnWidth ( int  col) const
inherited

Definition at line 537 of file MatrixView.cpp.

538 {
539  QHeaderView * h_header = d_view_widget->horizontalHeader();
540  return h_header->sectionSize(col);
541 }

References MatrixView::d_view_widget.

Referenced by print(), saveAsTemplate(), and saveToString().

Here is the caller graph for this function:

◆ contextMenuEvent()

void MyWidget::contextMenuEvent ( QContextMenuEvent *  e)
inherited

Customizes title bar's context menu)

Definition at line 145 of file MyWidget.cpp.

146 {
147  if (!this->widget()->geometry().contains(e->pos())) {
148  emit showTitleBarMenu();
149  e->accept();
150  }
151 }

References MyWidget::showTitleBarMenu().

◆ controlTabBarStatusChanged

void MatrixView::controlTabBarStatusChanged ( bool  visible)
signalinherited

Referenced by MatrixView::showControlCoordinatesTab(), MatrixView::showControlFormatTab(), MatrixView::showControlFormulaTab(), and MatrixView::toggleControlTabBar().

Here is the caller graph for this function:

◆ copy()

void Matrix::copy ( Matrix m)

Definition at line 718 of file Matrix.cpp.

719 {
720  if (!m)
721  return;
722 
724 }

References future::Matrix::copy(), and d_future_matrix.

Here is the call graph for this function:

◆ copySelection()

void Matrix::copySelection ( )

Standard copy operation.

Definition at line 452 of file Matrix.cpp.

453 {
455 }

References future::Matrix::copySelection(), and d_future_matrix.

Referenced by cutSelection().

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

◆ customEvent()

void Matrix::customEvent ( QEvent *  e)

Custom event handler.

Currently handles SCRIPTING_CHANGE_EVENT only.

Definition at line 526 of file Matrix.cpp.

527 {
528  if (e->type() == SCRIPTING_CHANGE_EVENT)
530 }

References SCRIPTING_CHANGE_EVENT, and scripted::scriptingChangeEvent().

Here is the call graph for this function:

◆ cutSelection()

void Matrix::cutSelection ( )

Standard cut operation.

Definition at line 457 of file Matrix.cpp.

458 {
459  copySelection();
460  clearSelection();
461 }

References clearSelection(), and copySelection().

Here is the call graph for this function:

◆ deleteSelectedColumns()

void Matrix::deleteSelectedColumns ( )

Delte the selected columns.

Definition at line 493 of file Matrix.cpp.

494 {
496 }

References d_future_matrix, and future::Matrix::removeSelectedColumns().

Here is the call graph for this function:

◆ deleteSelectedRows()

void Matrix::deleteSelectedRows ( )

Delete the selected rows.

Definition at line 473 of file Matrix.cpp.

474 {
476 }

References d_future_matrix, and future::Matrix::removeSelectedRows().

Here is the call graph for this function:

◆ determinant

double Matrix::determinant ( )
slot

Calculate the determinant of the matrix.

Definition at line 303 of file Matrix.cpp.

304 {
305  int rows = numRows();
306  int cols = numCols();
307 
308  if (rows != cols){
309  QMessageBox::critical(0,tr("Error"),
310  tr("Calculation failed, the matrix is not square!"));
311  return GSL_POSINF;
312  }
313 
314  QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
315 
316  gsl_matrix *A = gsl_matrix_alloc(rows, cols);
317  int i;
318  for(i=0; i<rows; i++)
319  for(int j=0; j<cols; j++)
320  gsl_matrix_set(A, i, j, cell(i, j));
321 
322  gsl_permutation * p = gsl_permutation_alloc(rows);
323  gsl_linalg_LU_decomp(A, p, &i);
324 
325  double det = gsl_linalg_LU_det(A, i);
326 
327  gsl_matrix_free(A);
328  gsl_permutation_free(p);
329 
330  QApplication::restoreOverrideCursor();
331  return det;
332 }

References cell(), numCols(), and numRows().

Referenced by ApplicationWindow::matrixDeterminant().

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

◆ eventFilter()

bool MatrixView::eventFilter ( QObject *  watched,
QEvent *  event 
)
protectedinherited

Definition at line 383 of file MatrixView.cpp.

384 {
385  QHeaderView * v_header = d_view_widget->verticalHeader();
386  QHeaderView * h_header = d_view_widget->horizontalHeader();
387 
388  if (d_matrix && event->type() == QEvent::ContextMenu)
389  {
390  QContextMenuEvent *cm_event = static_cast<QContextMenuEvent *>(event);
391  QPoint global_pos = cm_event->globalPos();
392  if (watched == v_header)
393  d_matrix->showMatrixViewRowContextMenu(global_pos);
394  else if (watched == h_header)
395  d_matrix->showMatrixViewColumnContextMenu(global_pos);
396  else if (watched == d_view_widget)
397  d_matrix->showMatrixViewContextMenu(global_pos);
398  else
399  return MyWidget::eventFilter(watched, event);
400  event->accept();
401  return true;
402  }
403  return MyWidget::eventFilter(watched, event);
404 }

References MatrixView::d_matrix, and MatrixView::d_view_widget.

◆ exportPDF

void Matrix::exportPDF ( const QString &  fileName)
slot

Definition at line 563 of file Matrix.cpp.

564 {
565  print(fileName);
566 }

References print().

Here is the call graph for this function:

◆ firstSelectedColumn()

int MatrixView::firstSelectedColumn ( bool  full = false)
inherited

Return the index of the first selected column.

If full is true, this function only looks for fully selected columns.

Definition at line 295 of file MatrixView.cpp.

296 {
297  if (d_matrix)
298  {
299  int cols = d_matrix->columnCount();
300  for (int i=0; i<cols; i++)
301  {
302  if(isColumnSelected(i, full))
303  return i;
304  }
305  }
306  return -1;
307 }

References MatrixView::d_matrix, and MatrixView::isColumnSelected().

Referenced by recalculate().

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

◆ firstSelectedRow()

int MatrixView::firstSelectedRow ( bool  full = false)
inherited

Return the index of the first selected row.

If full is true, this function only looks for fully selected rows.

Definition at line 320 of file MatrixView.cpp.

321 {
322  if (d_matrix)
323  {
324  int rows = d_matrix->rowCount();
325  for (int i=0; i<rows; i++)
326  {
327  if(isRowSelected(i, full))
328  return i;
329  }
330  }
331  return -1;
332 }

References MatrixView::d_matrix, and MatrixView::isRowSelected().

Referenced by recalculate().

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

◆ folder()

Folder* MyWidget::folder ( )
inlineinherited

Returns the pointer to the parent folder of the window.

Definition at line 128 of file MyWidget.h.

128 {return parentFolder;};

References MyWidget::parentFolder.

Referenced by ApplicationWindow::closeWindow(), MuParserScript::resolveColumnPath(), ApplicationWindow::restoreWindowGeometry(), MuParserScript::tableColumn__Function(), and ApplicationWindow::windowGeometryInfo().

Here is the caller graph for this function:

◆ forgetSavedCells()

void Matrix::forgetSavedCells ( )

\ brief Free memory of saved cells

See also
setNumericFormat(), saveCellsToMemory(), dMatrix

Definition at line 390 of file Matrix.cpp.

391 {
393  dMatrix = 0;
394 }

References dMatrix, freeMatrixData(), and numRows().

Referenced by ImportOPJ::importTables(), and recalculate().

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

◆ formula()

QString Matrix::formula ( )

Return the matrix formula.

Definition at line 250 of file Matrix.cpp.

251 {
252  return d_future_matrix->formula();
253 }

References d_future_matrix, and future::Matrix::formula().

Referenced by recalculate(), saveAsTemplate(), and saveToString().

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

◆ freeMatrixData()

void Matrix::freeMatrixData ( double **  data,
int  rows 
)
static

Free memory used for a matrix buffer.

Definition at line 705 of file Matrix.cpp.

706 {
707  for ( int i = 0; i < rows; i++)
708  delete [] data[i];
709 
710  delete [] data;
711 }

Referenced by Graph3D::addData(), Graph3D::addMatrixData(), forgetSavedCells(), Graph3D::updateDataXY(), Graph3D::updateMatrixData(), Graph3D::updateScales(), and Graph3D::updateScalesFromMatrix().

Here is the caller graph for this function:

◆ fromImage()

Matrix * Matrix::fromImage ( const QImage &  image,
ScriptingEnv env 
)
static

Definition at line 726 of file Matrix.cpp.

727 {
729  if (!fm) return NULL;
730  return new Matrix(fm, env, image.height(), image.width(), tr("Matrix %1").arg(1));
731 }

References future::Matrix::fromImage(), and Matrix().

Referenced by ApplicationWindow::importImage().

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

◆ getCurrentCell()

void MatrixView::getCurrentCell ( int *  row,
int *  col 
)
inherited

Determine the current cell (-1 if no cell is designated as the current)

Definition at line 368 of file MatrixView.cpp.

369 {
370  QModelIndex index = d_view_widget->selectionModel()->currentIndex();
371  if(index.isValid())
372  {
373  *row = index.row();
374  *col = index.column();
375  }
376  else
377  {
378  *row = -1;
379  *col = -1;
380  }
381 }

References MatrixView::d_view_widget.

◆ goToCell

void MatrixView::goToCell ( int  row,
int  col 
)
slotinherited

Definition at line 233 of file MatrixView.cpp.

234 {
235  QModelIndex index = d_model->index(row, col);
236  d_view_widget->scrollTo(index);
237  d_view_widget->setCurrentIndex(index);
238 }

References MatrixView::d_model, MatrixView::d_view_widget, and MatrixModel::index().

Here is the call graph for this function:

◆ handleAspectDescriptionChange

void Matrix::handleAspectDescriptionChange ( const AbstractAspect aspect)
protectedslot

Definition at line 760 of file Matrix.cpp.

761 {
762  if (aspect != d_future_matrix) return;
763  setObjectName(d_future_matrix->name());
764  updateCaption();
765 }

References MyWidget::aspect(), d_future_matrix, AbstractAspect::name(), and MyWidget::updateCaption().

Referenced by init().

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

◆ handleChange

void Matrix::handleChange ( )
slot

Definition at line 129 of file Matrix.cpp.

130 {
131  emit modifiedWindow(this);
132 }

References MyWidget::modifiedWindow().

Referenced by init().

Here is the caller graph for this function:

◆ handleHorizontalSectionResized

void MatrixView::handleHorizontalSectionResized ( int  logicalIndex,
int  oldSize,
int  newSize 
)
slotinherited

Definition at line 487 of file MatrixView.cpp.

488 {
489  static bool inside = false;
490  d_matrix->setColumnWidth(logicalIndex, newSize);
491  if (inside) return;
492  inside = true;
493 
494  QHeaderView * h_header = d_view_widget->horizontalHeader();
495  int cols = d_matrix->columnCount();
496  for (int i=0; i<cols; i++)
497  if(isColumnSelected(i, true))
498  h_header->resizeSection(i, newSize);
499 
500  inside = false;
501 }

References MatrixView::d_matrix, MatrixView::d_view_widget, and MatrixView::isColumnSelected().

Referenced by MatrixView::rereadSectionSizes().

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

◆ handleVerticalSectionResized

void MatrixView::handleVerticalSectionResized ( int  logicalIndex,
int  oldSize,
int  newSize 
)
slotinherited

Definition at line 503 of file MatrixView.cpp.

504 {
505  static bool inside = false;
506  d_matrix->setRowHeight(logicalIndex, newSize);
507  if (inside) return;
508  inside = true;
509 
510  QHeaderView * v_header = d_view_widget->verticalHeader();
511  int rows = d_matrix->rowCount();
512  for (int i=0; i<rows; i++)
513  if(isRowSelected(i, true))
514  v_header->resizeSection(i, newSize);
515 
516  inside = false;
517 }

References MatrixView::d_matrix, MatrixView::d_view_widget, and MatrixView::isRowSelected().

Referenced by MatrixView::rereadSectionSizes().

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

◆ hiddenWindow

void MyWidget::hiddenWindow ( MyWidget )
signalinherited

Emitted when the window was hidden.

Referenced by closeEvent(), MyWidget::closeEvent(), and Table::closeEvent().

Here is the caller graph for this function:

◆ init() [1/2]

void MatrixView::init ( )
protectedinherited

Initialization.

Definition at line 84 of file MatrixView.cpp.

85 {
86  QWidget* d_main_widget = new QWidget();
87  d_main_layout = new QHBoxLayout();
88  d_main_widget->setLayout(d_main_layout);
89  d_main_layout->setSpacing(0);
90  d_main_layout->setContentsMargins(0, 0, 0, 0);
91 
92  d_view_widget = new MatrixViewWidget(this);
93  d_view_widget->setModel(d_model);
94  connect(d_view_widget, SIGNAL(advanceCell()), this, SLOT(advanceCell()));
95  d_main_layout->addWidget(d_view_widget);
96 
97  d_hide_button = new QToolButton();
98  d_hide_button->setArrowType(Qt::RightArrow);
99  d_hide_button->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding));
100  d_hide_button->setCheckable(false);
101  d_main_layout->addWidget(d_hide_button);
102  connect(d_hide_button, SIGNAL(pressed()), this, SLOT(toggleControlTabBar()));
103  d_control_tabs = new QWidget();
104  ui.setupUi(d_control_tabs);
105 #if 0 // this seems not to work
106  ui.first_row_spinbox->setMaximum(std::numeric_limits<double>::max());
107  ui.first_row_spinbox->setMinimum(std::numeric_limits<double>::min());
108  ui.first_col_spinbox->setMaximum(std::numeric_limits<double>::max());
109  ui.first_col_spinbox->setMinimum(std::numeric_limits<double>::min());
110  ui.last_row_spinbox->setMaximum(std::numeric_limits<double>::max());
111  ui.last_row_spinbox->setMinimum(std::numeric_limits<double>::min());
112  ui.last_col_spinbox->setMaximum(std::numeric_limits<double>::max());
113  ui.last_col_spinbox->setMinimum(std::numeric_limits<double>::min());
114 #endif
115 
118  updateFormatTab();
119  d_main_layout->addWidget(d_control_tabs);
120 
121  d_view_widget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
122  d_main_layout->setStretchFactor(d_view_widget, 1);
123 
124  setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
125 
126  d_view_widget->setFocusPolicy(Qt::StrongFocus);
127  setFocusPolicy(Qt::StrongFocus);
128  setFocus();
129 #if QT_VERSION >= 0x040300
130  d_view_widget->setCornerButtonEnabled(true);
131 #endif
132 
133  d_view_widget->setSelectionMode(QAbstractItemView::ExtendedSelection);
134 
135  QHeaderView * h_header = d_view_widget->horizontalHeader();
136  QHeaderView * v_header = d_view_widget->verticalHeader();
137 #if QT_VERSION >= 0x050000
138  v_header->setSectionResizeMode(QHeaderView::Interactive);
139  h_header->setSectionResizeMode(QHeaderView::Interactive);
140  v_header->setSectionsMovable(false);
141  h_header->setSectionsMovable(false);
142 #else
143  v_header->setResizeMode(QHeaderView::Interactive);
144  h_header->setResizeMode(QHeaderView::Interactive);
145  v_header->setMovable(false);
146  h_header->setMovable(false);
147 #endif
148  v_header->setDefaultSectionSize(future::Matrix::defaultRowHeight());
149  h_header->setDefaultSectionSize(future::Matrix::defaultColumnWidth());
150 
151  v_header->installEventFilter(this);
152  h_header->installEventFilter(this);
153  d_view_widget->installEventFilter(this);
154 
155  this->setWidget(d_main_widget);
157 
158 #ifndef LEGACY_CODE_0_2_x
159  // keyboard shortcuts
160  QShortcut * sel_all = new QShortcut(QKeySequence(tr("Ctrl+A", "Matrix: select all")), d_view_widget);
161  connect(sel_all, SIGNAL(activated()), d_view_widget, SLOT(selectAll()));
162 #endif
163 
164  connect(ui.button_set_coordinates, SIGNAL(pressed()),
165  this, SLOT(applyCoordinates()));
166 #ifndef LEGACY_CODE_0_2_x
167  connect(ui.button_set_formula, SIGNAL(pressed()),
168  this, SLOT(applyFormula()));
169 #endif
170  connect(ui.button_set_format, SIGNAL(pressed()),
171  this, SLOT(applyFormat()));
172  connect(ui.format_box, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTypeInfo()));
173  connect(ui.digits_box, SIGNAL(valueChanged(int)), this, SLOT(updateTypeInfo()));
174 
175  connect(d_matrix, SIGNAL(coordinatesChanged()), this, SLOT(updateCoordinatesTab()));
176  connect(d_matrix, SIGNAL(formulaChanged()), this, SLOT(updateFormulaTab()));
177  connect(d_matrix, SIGNAL(formatChanged()), this, SLOT(updateFormatTab()));
178 
180 }

References MatrixView::advanceCell(), MatrixView::applyCoordinates(), MatrixView::applyFormat(), MatrixView::applyFormula(), MatrixView::d_control_tabs, MatrixView::d_hide_button, MatrixView::d_main_layout, MatrixView::d_matrix, MatrixView::d_model, MatrixView::d_view_widget, future::Matrix::defaultColumnWidth(), future::Matrix::defaultRowHeight(), MatrixView::rereadSectionSizes(), MatrixView::retranslateStrings(), MatrixView::selectAll(), MatrixView::toggleControlTabBar(), MatrixView::ui, MatrixView::updateCoordinatesTab(), MatrixView::updateFormatTab(), MatrixView::updateFormulaTab(), and MatrixView::updateTypeInfo().

Referenced by Matrix(), and MatrixView::MatrixView().

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

◆ init() [2/2]

void Matrix::init ( int  rows,
int  cols 
)
private

Initialize the matrix.

Definition at line 77 of file Matrix.cpp.

78 {
79  MatrixView::setMatrix(d_future_matrix);
80  d_future_matrix->setView(this);
83  d_future_matrix->setCoordinates(1.0, 10.0, 1.0, 10.0);
84  dMatrix = 0;
85 
86  birthdate = d_future_matrix->creationTime().toString(Qt::LocalDate);
87 
88  // this is not very nice but works for the moment
89  ui.gridLayout2->removeWidget(ui.formula_box);
90  delete ui.formula_box;
91  ui.formula_box = new ScriptEdit(scriptEnv, ui.formula_tab);
92  ui.formula_box->setObjectName(QString::fromUtf8("formula_box"));
93  ui.formula_box->setMinimumSize(QSize(60, 10));
94  ui.formula_box->setAcceptRichText(false);
95  ui.formula_box->setLineWrapMode(QTextEdit::WidgetWidth);
96  ui.gridLayout2->addWidget(ui.formula_box, 1, 0, 1, 3);
97 
98  ui.add_cell_combobox->addItem("cell(i, j)");
99  ui.add_function_combobox->addItems(scriptEnv->mathFunctions());
101 
102  connect(ui.add_function_combobox, SIGNAL(currentIndexChanged(int)),
103  this, SLOT(updateFunctionDoc()));
104  connect(ui.button_set_formula, SIGNAL(pressed()),
105  this, SLOT(applyFormula()));
106  connect(ui.add_function_button, SIGNAL(pressed()),
107  this, SLOT(addFunction()));
108  connect(ui.add_cell_button, SIGNAL(pressed()),
109  this, SLOT(addCell()));
110 
111  connect(d_future_matrix, SIGNAL(columnsInserted(int, int)), this, SLOT(handleChange()));
112  connect(d_future_matrix, SIGNAL(columnsRemoved(int, int)), this, SLOT(handleChange()));
113  connect(d_future_matrix, SIGNAL(rowsInserted(int, int)), this, SLOT(handleChange()));
114  connect(d_future_matrix, SIGNAL(rowsRemoved(int, int)), this, SLOT(handleChange()));
115  connect(d_future_matrix, SIGNAL(dataChanged(int, int, int, int)), this, SLOT(handleChange()));
116  connect(d_future_matrix, SIGNAL(coordinatesChanged()), this, SLOT(handleChange()));
117  connect(d_future_matrix, SIGNAL(formulaChanged()), this, SLOT(handleChange()));
118  connect(d_future_matrix, SIGNAL(formatChanged()), this, SLOT(handleChange()));
119  connect(d_future_matrix, SIGNAL(recalculate()), this, SLOT(recalculate()));
120 
121  connect(d_future_matrix, SIGNAL(aspectDescriptionChanged(const AbstractAspect*)),
122  this, SLOT(handleAspectDescriptionChange(const AbstractAspect *)));
123 }

References addCell(), addFunction(), applyFormula(), MyWidget::birthdate, AbstractAspect::creationTime(), d_future_matrix, dMatrix, handleAspectDescriptionChange(), handleChange(), ScriptingEnv::mathFunctions(), recalculate(), scripted::scriptEnv, future::Matrix::setCoordinates(), future::Matrix::setDisplayedDigits(), future::Matrix::setNumericFormat(), MatrixView::ui, and updateFunctionDoc().

Here is the call graph for this function:

◆ insertColumn()

void Matrix::insertColumn ( )

Insert a column before the current cell.

Definition at line 478 of file Matrix.cpp.

479 {
481 }

References d_future_matrix, and future::Matrix::insertEmptyColumns().

Here is the call graph for this function:

◆ insertRow()

void Matrix::insertRow ( )

Insert a row before the current cell.

Definition at line 516 of file Matrix.cpp.

517 {
519 }

References d_future_matrix, and future::Matrix::insertEmptyRows().

Here is the call graph for this function:

◆ invert

void Matrix::invert ( )
slot

Invert the matrix.

Definition at line 334 of file Matrix.cpp.

335 {
336  int rows = numRows();
337  int cols = numCols();
338 
339  if (rows != cols){
340  QMessageBox::critical(0,tr("Error"),
341  tr("Inversion failed, the matrix is not square!"));
342  return;
343  }
344 
345  QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
346 
347  gsl_matrix *A = gsl_matrix_alloc(rows, cols);
348  int i;
349  for(i=0; i<rows; i++){
350  for(int j=0; j<cols; j++)
351  gsl_matrix_set(A, i, j, cell(i, j));
352  }
353 
354  gsl_permutation * p = gsl_permutation_alloc(cols);
355  gsl_linalg_LU_decomp(A, p, &i);
356 
357  gsl_matrix *inverse = gsl_matrix_alloc(rows, cols);
358  gsl_linalg_LU_invert(A, p, inverse);
359 
360  gsl_matrix_free(A);
361  gsl_permutation_free(p);
362 
363  this->blockSignals(true);
364  for(i=0; i<rows; i++){
365  for(int j=0; j<cols; j++)
366  setCell(i, j, gsl_matrix_get(inverse, i, j));
367  }
368  this->blockSignals(false);
369 
370  gsl_matrix_free(inverse);
371  QApplication::restoreOverrideCursor();
372  emit modifiedWindow(this);
373 }

References cell(), MyWidget::modifiedWindow(), numCols(), numRows(), and setCell().

Referenced by ApplicationWindow::invertMatrix().

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

◆ isCellSelected()

bool MatrixView::isCellSelected ( int  row,
int  col 
)
inherited

Return whether a cell is selected.

Definition at line 345 of file MatrixView.cpp.

346 {
347 
348  if(d_matrix &&
349  (row < 0 || col < 0 ||
350  row >= d_matrix->rowCount() || col >= d_matrix->columnCount()))
351  return false;
352 
353  return d_view_widget->selectionModel()->isSelected(d_model->index(row, col));
354 }

References MatrixView::d_matrix, MatrixView::d_model, MatrixView::d_view_widget, and MatrixModel::index().

Referenced by recalculate().

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

◆ isColumnSelected()

bool MatrixView::isColumnSelected ( int  col,
bool  full = false 
)
inherited

Returns true if column 'col' is selected; otherwise false.

If full is true, this function only returns true if the whole column is selected.

Definition at line 267 of file MatrixView.cpp.

268 {
269  if(full)
270  return d_view_widget->selectionModel()->isColumnSelected(col, QModelIndex());
271  else
272  return d_view_widget->selectionModel()->columnIntersectsSelection(col, QModelIndex());
273 }

References MatrixView::d_view_widget.

Referenced by columnsSelected(), MatrixView::firstSelectedColumn(), MatrixView::handleHorizontalSectionResized(), MatrixView::lastSelectedColumn(), numSelectedColumns(), and MatrixView::selectedColumnCount().

Here is the caller graph for this function:

◆ isControlTabBarVisible()

bool MatrixView::isControlTabBarVisible ( )
inlineinherited

Definition at line 96 of file MatrixView.h.

96 { return d_control_tabs->isVisible(); }

References MatrixView::d_control_tabs.

◆ isRowSelected()

bool MatrixView::isRowSelected ( int  row,
bool  full = false 
)
inherited

Returns true if row 'row' is selected; otherwise false.

If full is true, this function only returns true if the whole row is selected.

Definition at line 287 of file MatrixView.cpp.

288 {
289  if(full)
290  return d_view_widget->selectionModel()->isRowSelected(row, QModelIndex());
291  else
292  return d_view_widget->selectionModel()->rowIntersectsSelection(row, QModelIndex());
293 }

References MatrixView::d_view_widget.

Referenced by MatrixView::firstSelectedRow(), MatrixView::handleVerticalSectionResized(), MatrixView::lastSelectedRow(), numSelectedRows(), rowsSelected(), and MatrixView::selectedRowCount().

Here is the caller graph for this function:

◆ lastSelectedColumn()

int MatrixView::lastSelectedColumn ( bool  full = false)
inherited

Return the index of the last selected column.

If full is true, this function only looks for fully selected columns.

Definition at line 309 of file MatrixView.cpp.

310 {
311  if (d_matrix)
312  {
313  int cols = d_matrix->columnCount();
314  for(int i=cols-1; i>=0; i--)
315  if(isColumnSelected(i, full)) return i;
316  }
317  return -2;
318 }

References MatrixView::d_matrix, and MatrixView::isColumnSelected().

Referenced by recalculate().

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

◆ lastSelectedRow()

int MatrixView::lastSelectedRow ( bool  full = false)
inherited

Return the index of the last selected row.

If full is true, this function only looks for fully selected rows.

Definition at line 334 of file MatrixView.cpp.

335 {
336  if (d_matrix)
337  {
338  int rows = d_matrix->rowCount();
339  for(int i=rows-1; i>=0; i--)
340  if(isRowSelected(i, full)) return i;
341  }
342  return -2;
343 }

References MatrixView::d_matrix, and MatrixView::isRowSelected().

Referenced by recalculate().

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

◆ modifiedWindow

void MyWidget::modifiedWindow ( MyWidget )
signalinherited

Referenced by handleChange(), Table::handleChange(), invert(), Note::modifiedNote(), MyWidget::notifyChanges(), recalculate(), and setNumericFormat().

Here is the caller graph for this function:

◆ name()

virtual QString Matrix::name ( )
inlinevirtual

Return the window name.

Reimplemented from MyWidget.

Definition at line 59 of file Matrix.h.

59 { return d_future_matrix->name();}

References d_future_matrix, and AbstractAspect::name().

Referenced by Graph3D::addMatrixData(), applyFormula(), ApplicationWindow::change3DMatrix(), ApplicationWindow::matrix(), ApplicationWindow::matrixDeterminant(), ApplicationWindow::newMatrix(), ApplicationWindow::openMatrix(), recalculate(), Spectrogram::saveToString(), saveToString(), setText(), and ApplicationWindow::showWindowMenuImpl().

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

◆ notifyChanges()

void MyWidget::notifyChanges ( )
inlineinherited

Notifies the main application that the window has been modified.

Definition at line 134 of file MyWidget.h.

134 {emit modifiedWindow(this);};

References MyWidget::modifiedWindow().

Referenced by ApplicationWindow::importASCII(), PlotDialog::pickBorderColor(), and PlotDialog::updateBorder().

Here is the caller graph for this function:

◆ numCols()

int Matrix::numCols ( )

Return the number of columns.

Definition at line 293 of file Matrix.cpp.

294 {
295  return d_future_matrix->columnCount();
296 }

References future::Matrix::columnCount(), and d_future_matrix.

Referenced by Graph3D::addMatrixData(), columnsSelected(), ApplicationWindow::convertMatrixToTable(), determinant(), invert(), MuParserScript::matrixCellFunction(), MatrixData::MatrixData(), numSelectedColumns(), print(), range(), recalculate(), saveAsTemplate(), saveCellsToMemory(), saveToString(), Graph3D::updateMatrixData(), and Graph3D::updateScalesFromMatrix().

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

◆ numRows()

int Matrix::numRows ( )

Return the number of rows.

Definition at line 283 of file Matrix.cpp.

284 {
285  return d_future_matrix->rowCount();
286 }

References d_future_matrix, and future::Matrix::rowCount().

Referenced by Graph3D::addMatrixData(), ApplicationWindow::convertMatrixToTable(), determinant(), forgetSavedCells(), invert(), MuParserScript::matrixCellFunction(), MatrixData::MatrixData(), numSelectedRows(), print(), range(), recalculate(), rowsSelected(), saveAsTemplate(), saveCellsToMemory(), saveToString(), Graph3D::updateMatrixData(), and Graph3D::updateScalesFromMatrix().

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

◆ numSelectedColumns()

int Matrix::numSelectedColumns ( )

Return the number of selected columns.

Definition at line 507 of file Matrix.cpp.

508 {
509  int c=0;
510  for(int i=0; i<numCols(); i++)
511  if (this->isColumnSelected(i, true))
512  c++;
513  return c;
514 }

References MatrixView::isColumnSelected(), and numCols().

Here is the call graph for this function:

◆ numSelectedRows()

int Matrix::numSelectedRows ( )

Return the number of selected rows.

Definition at line 498 of file Matrix.cpp.

499 {
500  int r=0;
501  for(int i=0; i<numRows(); i++)
502  if (this->isRowSelected(i, true))
503  r++;
504  return r;
505 }

References MatrixView::isRowSelected(), and numRows().

Here is the call graph for this function:

◆ pasteSelection()

void Matrix::pasteSelection ( )

Standard paste operation.

Definition at line 521 of file Matrix.cpp.

522 {
524 }

References d_future_matrix, and future::Matrix::pasteIntoSelection().

Here is the call graph for this function:

◆ precision()

int Matrix::precision ( )
inline

Return the number precision digits.

See arguments of setNumericFormat().

See also
setNumericFormat(), setTextFormat()

Definition at line 175 of file Matrix.h.

175 {return d_future_matrix->displayedDigits();};

References d_future_matrix, and future::Matrix::displayedDigits().

Referenced by setTextFormat().

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

◆ print [1/2]

void Matrix::print ( )
slot

Print the Matrix.

Definition at line 568 of file Matrix.cpp.

569 {
570  print(QString());
571 }

Referenced by exportPDF(), and recalculate().

Here is the caller graph for this function:

◆ print [2/2]

void Matrix::print ( const QString &  fileName)
slot

Print the Matrix to fileName.

Definition at line 573 of file Matrix.cpp.

574 {
575  QPrinter printer;
576  printer.setColorMode(QPrinter::GrayScale);
577 
578  if (!fileName.isEmpty())
579  {
580  printer.setCreator("SciDAVis");
581  printer.setOutputFormat(QPrinter::PdfFormat);
582  printer.setOutputFileName(fileName);
583  }
584  else
585  {
586  QPrintDialog printDialog(&printer);
587  if (printDialog.exec() != QDialog::Accepted)
588  return;
589  }
590 
591  printer.setFullPage( true );
592  QPainter p;
593  if ( !p.begin(&printer) )
594  return; // paint on printer
595  int dpiy = printer.logicalDpiY();
596  const int margin = (int) ( (1/2.54)*dpiy ); // 1 cm margins
597 
598  QHeaderView *vHeader = d_view_widget->verticalHeader();
599 
600  int rows = numRows();
601  int cols = numCols();
602  int height = margin;
603  int i, vertHeaderWidth = vHeader->width();
604  int right = margin + vertHeaderWidth;
605 
606  // print header
607  p.setFont(QFont());
608  QString header_label = d_view_widget->model()->headerData(0, Qt::Horizontal).toString();
609  QRect br = p.boundingRect(br, Qt::AlignCenter, header_label);
610  p.drawLine(right, height, right, height+br.height());
611  QRect tr(br);
612 
613  for(i=0;i<cols;i++)
614  {
615  int w = columnWidth(i);
616  tr.setTopLeft(QPoint(right,height));
617  tr.setWidth(w);
618  tr.setHeight(br.height());
619  header_label = d_view_widget->model()->headerData(i, Qt::Horizontal).toString();
620  p.drawText(tr, Qt::AlignCenter, header_label);
621  right += w;
622  p.drawLine(right, height, right, height+tr.height());
623 
624  if (right >= printer.width()-2*margin )
625  break;
626  }
627 
628  p.drawLine(margin + vertHeaderWidth, height, right-1, height);//first horizontal line
629  height += tr.height();
630  p.drawLine(margin, height, right-1, height);
631 
632  // print table values
633  for(i=0;i<rows;i++)
634  {
635  right = margin;
636  QString cell_text = d_view_widget->model()->headerData(i, Qt::Vertical).toString()+"\t";
637  tr = p.boundingRect(tr, Qt::AlignCenter, cell_text);
638  p.drawLine(right, height, right, height+tr.height());
639 
640  br.setTopLeft(QPoint(right,height));
641  br.setWidth(vertHeaderWidth);
642  br.setHeight(tr.height());
643  p.drawText(br,Qt::AlignCenter,cell_text);
644  right += vertHeaderWidth;
645  p.drawLine(right, height, right, height+tr.height());
646 
647  for(int j=0;j<cols;j++)
648  {
649  int w = columnWidth (j);
650  cell_text = text(i,j)+"\t";
651  tr = p.boundingRect(tr,Qt::AlignCenter,cell_text);
652  br.setTopLeft(QPoint(right,height));
653  br.setWidth(w);
654  br.setHeight(tr.height());
655  p.drawText(br, Qt::AlignCenter, cell_text);
656  right += w;
657  p.drawLine(right, height, right, height+tr.height());
658 
659  if (right >= printer.width()-2*margin )
660  break;
661  }
662  height += br.height();
663  p.drawLine(margin, height, right-1, height);
664 
665  if (height >= printer.height()-margin )
666  {
667  printer.newPage();
668  height = margin;
669  p.drawLine(margin, height, right, height);
670  }
671  }
672 }

References MatrixView::columnWidth(), MatrixView::d_view_widget, numCols(), numRows(), and text().

Here is the call graph for this function:

◆ range()

void Matrix::range ( double *  min,
double *  max 
)

Min and max values of the matrix.

Definition at line 674 of file Matrix.cpp.

675 {
676  double d_min = cell(0, 0);
677  double d_max = d_min;
678 
679  for(int i=0; i<numRows(); i++)
680  {
681  for(int j=0; j<numCols(); j++)
682  {
683  double aux = cell(i, j);
684  if (aux <= d_min)
685  d_min = aux;
686 
687  if (aux >= d_max)
688  d_max = aux;
689  }
690  }
691 
692  *min = d_min;
693  *max = d_max;
694 }

References cell(), numCols(), and numRows().

Here is the call graph for this function:

◆ recalculate

bool Matrix::recalculate ( )
slot

Calculate matrix values using the formula for all selected cells.

Definition at line 396 of file Matrix.cpp.

397 {
398  QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
399  Script *script = scriptEnv->newScript(formula(), this, QString("<%1>").arg(name()));
400  connect(script, SIGNAL(error(const QString&,const QString&,int)), scriptEnv, SIGNAL(error(const QString&,const QString&,int)));
401  connect(script, SIGNAL(print(const QString&)), scriptEnv, SIGNAL(print(const QString&)));
402  if (!script->compile())
403  {
404  QApplication::restoreOverrideCursor();
405  return false;
406  }
407 
408  this->blockSignals(true);
409 
410  int startRow = firstSelectedRow(false);
411  int endRow = lastSelectedRow(false);
412  int startCol = firstSelectedColumn(false);
413  int endCol = lastSelectedColumn(false);
414 
415  QVariant ret;
417  double dx = fabs(xEnd()-xStart())/(double)(numRows()-1);
418  double dy = fabs(yEnd()-yStart())/(double)(numCols()-1);
419  for(int row = startRow; row <= endRow; row++)
420  for(int col = startCol; col <= endCol; col++)
421  {
422  if (!isCellSelected(row, col)) continue;
423  script->setInt(row+1, "i");
424  script->setInt(row+1, "row");
425  script->setDouble(yStart()+row*dy, "y");
426  script->setInt(col+1, "j");
427  script->setInt(col+1, "col");
428  script->setDouble(xStart()+col*dx, "x");
429  ret = script->eval();
430  if (!ret.isValid()) {
432  blockSignals(false);
433  emit modifiedWindow(this);
434  QApplication::restoreOverrideCursor();
435  return false;
436  }
437  setCell(row, col, ret.toDouble());
438  }
440 
441  blockSignals(false);
442  emit modifiedWindow(this);
443  QApplication::restoreOverrideCursor();
444  return true;
445 }

References Script::compile(), Script::eval(), MatrixView::firstSelectedColumn(), MatrixView::firstSelectedRow(), forgetSavedCells(), formula(), MatrixView::isCellSelected(), MatrixView::lastSelectedColumn(), MatrixView::lastSelectedRow(), MyWidget::modifiedWindow(), name(), ScriptingEnv::newScript(), numCols(), numRows(), print(), saveCellsToMemory(), scripted::scriptEnv, setCell(), Script::setDouble(), Script::setInt(), xEnd(), xStart(), yEnd(), and yStart().

Referenced by applyFormula(), and init().

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

◆ rereadSectionSizes

void MatrixView::rereadSectionSizes ( )
slotinherited

Definition at line 182 of file MatrixView.cpp.

183 {
184  QHeaderView * h_header = d_view_widget->horizontalHeader();
185  QHeaderView * v_header = d_view_widget->verticalHeader();
186 
187  disconnect(v_header, SIGNAL(sectionResized(int, int, int)), this, SLOT(handleVerticalSectionResized(int, int, int)));
188  disconnect(h_header, SIGNAL(sectionResized(int, int, int)), this, SLOT(handleHorizontalSectionResized(int, int, int)));
189 
190  if (d_matrix)
191  {
192  int cols = d_matrix->columnCount();
193  for (int i=0; i<cols; i++)
194  h_header->resizeSection(i, d_matrix->columnWidth(i));
195  int rows = d_matrix->rowCount();
196  for (int i=0; i<rows; i++)
197  v_header->resizeSection(i, d_matrix->rowHeight(i));
198  }
199 
200  connect(v_header, SIGNAL(sectionResized(int, int, int)), this, SLOT(handleVerticalSectionResized(int, int, int)));
201  connect(h_header, SIGNAL(sectionResized(int, int, int)), this, SLOT(handleHorizontalSectionResized(int, int, int)));
202 }

References MatrixView::d_matrix, MatrixView::d_view_widget, MatrixView::handleHorizontalSectionResized(), and MatrixView::handleVerticalSectionResized().

Referenced by MatrixView::init().

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

◆ resizedWindow

void MyWidget::resizedWindow ( MyWidget )
signalinherited

Referenced by Graph3D::resizeEvent(), and MultiLayer::resizeLayers().

Here is the caller graph for this function:

◆ restore()

virtual void MyWidget::restore ( const QStringList &  )
inlinevirtualinherited

Not implemented yet.

Definition at line 105 of file MyWidget.h.

105 {};

Referenced by ApplicationWindow::openTemplate().

Here is the caller graph for this function:

◆ retranslateStrings()

void MatrixView::retranslateStrings ( )
protectedinherited

Definition at line 211 of file MatrixView.cpp.

212 {
213  d_hide_button->setToolTip(tr("Show/hide control tabs"));
214  ui.retranslateUi(d_control_tabs);
215  ui.format_box->clear();
216  ui.format_box->addItem(tr("Decimal"), QVariant('f'));
217  ui.format_box->addItem(tr("Scientific (e)"), QVariant('e'));
218  ui.format_box->addItem(tr("Scientific (E)"), QVariant('E'));
219  ui.format_box->addItem(tr("Automatic (e)"), QVariant('g'));
220  ui.format_box->addItem(tr("Automatic (E)"), QVariant('G'));
221 }

References MatrixView::d_control_tabs, MatrixView::d_hide_button, and MatrixView::ui.

Referenced by MatrixView::changeEvent(), and MatrixView::init().

Here is the caller graph for this function:

◆ rowHeight()

int MatrixView::rowHeight ( int  row) const
inherited

Definition at line 531 of file MatrixView.cpp.

532 {
533  QHeaderView * v_header = d_view_widget->verticalHeader();
534  return v_header->sectionSize(row);
535 }

References MatrixView::d_view_widget.

◆ rowsSelected()

bool Matrix::rowsSelected ( )

Return whether any rows are fully selected.

Definition at line 463 of file Matrix.cpp.

464 {
465  for(int i=0; i<numRows(); i++)
466  {
467  if (this->isRowSelected (i, true))
468  return true;
469  }
470  return false;
471 }

References MatrixView::isRowSelected(), and numRows().

Referenced by ApplicationWindow::showWindowContextMenu().

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

◆ saveAsTemplate()

QString Matrix::saveAsTemplate ( const QString &  info)
virtual

Format the matrix format in a string to save it in a template file.

Reimplemented from MyWidget.

Definition at line 215 of file Matrix.cpp.

216 {
217  QString s= "<matrix>\t";
218  s+= QString::number(numRows())+"\t";
219  s+= QString::number(numCols())+"\n";
220  s+= info;
221  s+= "ColWidth\t" + QString::number(columnWidth(0))+"\n";
222  s+= "<formula>\n" + formula() + "\n</formula>\n";
223  s+= "TextFormat\t" + QString(d_future_matrix->numericFormat()) + "\t" + QString::number(d_future_matrix->displayedDigits()) + "\n";
224  s+= "Coordinates\t" + QString::number(xStart(),'g',15) + "\t" +QString::number(xEnd(),'g',15) + "\t";
225  s+= QString::number(yStart(),'g',15) + "\t" + QString::number(yEnd(),'g',15) + "\n";
226  s +="</matrix>\n";
227  return s;
228 }

References MatrixView::columnWidth(), d_future_matrix, future::Matrix::displayedDigits(), formula(), numCols(), future::Matrix::numericFormat(), numRows(), xEnd(), xStart(), yEnd(), and yStart().

Here is the call graph for this function:

◆ saveCellsToMemory()

void Matrix::saveCellsToMemory ( )

Temporally save the cell values to memory.

See also
setNumericFormat(), forgetSavedCells(), dMatrix

Definition at line 380 of file Matrix.cpp.

381 {
382  int rows = numRows();
383  int cols = numCols();
384  dMatrix = allocateMatrixData(rows, cols);
385  for (int i=0; i<rows; i++)
386  for (int j=0; j<cols; j++)
387  dMatrix[i][j] = d_future_matrix->cell(i, j);
388 }

References allocateMatrixData(), future::Matrix::cell(), d_future_matrix, dMatrix, numCols(), and numRows().

Referenced by ImportOPJ::importTables(), and recalculate().

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

◆ saveText()

QString Matrix::saveText ( )

Return a string conaining the data of the matrix (<data> section)

Definition at line 230 of file Matrix.cpp.

231 {
232  QString out_text = "<data>\n";
233  int cols = d_future_matrix->columnCount();
234  for(int i=0; i<d_future_matrix->rowCount(); i++)
235  {
236  out_text += QString::number(i)+"\t";
237  for (int j=0; j<cols-1; j++)
238  out_text += QString::number(cell(i,j), 'e', 16)+"\t";
239 
240  out_text += QString::number(cell(i,cols-1), 'e', 16)+"\n";
241  }
242  return out_text + "</data>\n";
243 }

References cell(), future::Matrix::columnCount(), d_future_matrix, and future::Matrix::rowCount().

Referenced by saveToString().

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

◆ saveToString()

QString Matrix::saveToString ( const QString &  info)
virtual

Return a string to save the matrix in a project file (<matrix> section)

Reimplemented from MyWidget.

Definition at line 184 of file Matrix.cpp.

185 {
186  QString s = "<matrix>\n";
187  QString xml;
188  QXmlStreamWriter writer(&xml);
189  d_future_matrix->save(&writer);
190  s += QString::number(xml.length()) + "\n"; // this is need in case there are newlines in the XML
191  s += xml + "\n";
192  s += geometry + "\n";
193  s +="</matrix>\n";
194  return s;
195 
196 #if 0
197  QString s = "<matrix>\n";
198  s += QString(name()) + "\t";
199  s += QString::number(numRows())+"\t";
200  s += QString::number(numCols())+"\t";
201  s += birthDate() + "\n";
202  s += info;
203  s += "ColWidth\t" + QString::number(columnWidth(0))+"\n";
204  s += "<formula>\n" + formula() + "\n</formula>\n";
205  s += "TextFormat\t" + QString(d_future_matrix->numericFormat()) + "\t" + QString::number(d_future_matrix->displayedDigits()) + "\n";
206  s += "WindowLabel\t" + windowLabel() + "\t" + QString::number(captionPolicy()) + "\n";
207  s += "Coordinates\t" + QString::number(xStart(),'g',15) + "\t" +QString::number(xEnd(),'g',15) + "\t";
208  s += QString::number(yStart(),'g',15) + "\t" + QString::number(yEnd(),'g',15) + "\n";
209  s += saveText();
210  s +="</matrix>\n";
211  return s;
212 #endif
213 }

References birthDate(), MyWidget::captionPolicy(), MatrixView::columnWidth(), d_future_matrix, future::Matrix::displayedDigits(), formula(), name(), numCols(), future::Matrix::numericFormat(), numRows(), future::Matrix::save(), saveText(), windowLabel(), xEnd(), xStart(), yEnd(), and yStart().

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(), customEvent(), and Table::customEvent().

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

◆ selectAll

void MatrixView::selectAll ( )
slotinherited

Definition at line 240 of file MatrixView.cpp.

241 {
243 }

References MatrixView::d_view_widget, and MatrixViewWidget::selectAll().

Referenced by MatrixView::init().

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

◆ selectedColumnCount()

int MatrixView::selectedColumnCount ( bool  full = false)
inherited

Return how many columns are selected.

If full is true, this function only returns the number of fully selected columns.

Definition at line 255 of file MatrixView.cpp.

256 {
257  int count = 0;
258  if (d_matrix)
259  {
260  int cols = d_matrix->columnCount();
261  for (int i=0; i<cols; i++)
262  if(isColumnSelected(i, full)) count++;
263  }
264  return count;
265 }

References MatrixView::d_matrix, and MatrixView::isColumnSelected().

Here is the call graph for this function:

◆ selectedRowCount()

int MatrixView::selectedRowCount ( bool  full = false)
inherited

Return how many rows are (at least partly) selected.

If full is true, this function only returns the number of fully selected rows.

Definition at line 275 of file MatrixView.cpp.

276 {
277  int count = 0;
278  if (d_matrix)
279  {
280  int rows = d_matrix->rowCount();
281  for (int i=0; i<rows; i++)
282  if(isRowSelected(i, full)) count++;
283  }
284  return count;
285 }

References MatrixView::d_matrix, and MatrixView::isRowSelected().

Here is the call graph for this function:

◆ setBirthDate()

virtual void Matrix::setBirthDate ( const QString &  s)
inlinevirtual

Set the creation date.

Reimplemented from MyWidget.

Definition at line 84 of file Matrix.h.

85  {
86  birthdate = s;
88  }

References MyWidget::birthdate, d_future_matrix, and AbstractAspect::importV0x0001XXCreationTime().

Referenced by ApplicationWindow::openMatrix().

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

◆ setCaptionPolicy()

void Matrix::setCaptionPolicy ( CaptionPolicy  policy)
inlinevirtual

Set the caption policy.

Reimplemented from MyWidget.

Definition at line 67 of file Matrix.h.

68  {
69  caption_policy = policy; updateCaption();
70  switch (policy)
71  {
72  case Name:
74  break;
75  case Label:
77  break;
78  case Both:
79  d_future_matrix->setCaptionSpec("%n%C{ - }%c");
80  break;
81  }
82  }

References MyWidget::Both, MyWidget::caption_policy, d_future_matrix, MyWidget::Label, MyWidget::Name, AbstractAspect::setCaptionSpec(), and MyWidget::updateCaption().

Referenced by ApplicationWindow::convertTableToMatrix(), and ApplicationWindow::openMatrix().

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

◆ setCell

void Matrix::setCell ( int  row,
int  col,
double  value 
)
slot

Set the value of the cell.

Definition at line 142 of file Matrix.cpp.

143 {
144  d_future_matrix->setCell(row, col, value);
145 }

References d_future_matrix, and future::Matrix::setCell().

Referenced by invert(), ApplicationWindow::openMatrix(), recalculate(), and setText().

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

◆ setCells

void Matrix::setCells ( const QVector< qreal > &  data)
slot

Set the value of all cells.

Definition at line 147 of file Matrix.cpp.

148 {
150 }

References d_future_matrix, and future::Matrix::setCells().

Referenced by ImportOPJ::importTables().

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

◆ setCellSelected()

void MatrixView::setCellSelected ( int  row,
int  col 
)
inherited

Select a cell.

Definition at line 356 of file MatrixView.cpp.

357 {
358  d_view_widget->selectionModel()->select(d_model->index(row, col), QItemSelectionModel::Select);
359 }

References MatrixView::d_model, MatrixView::d_view_widget, and MatrixModel::index().

Here is the call graph for this function:

◆ setCellsSelected()

void MatrixView::setCellsSelected ( int  first_row,
int  first_col,
int  last_row,
int  last_col 
)
inherited

Select a range of cells.

Definition at line 361 of file MatrixView.cpp.

362 {
363  QModelIndex top_left = d_model->index(first_row, first_col);
364  QModelIndex bottom_right = d_model->index(last_row, last_col);
365  d_view_widget->selectionModel()->select(QItemSelection(top_left, bottom_right), QItemSelectionModel::SelectCurrent);
366 }

References MatrixView::d_model, MatrixView::d_view_widget, and MatrixModel::index().

Here is the call graph for this function:

◆ setColumnsWidth

void Matrix::setColumnsWidth ( int  width)
slot

Set the width of all columns (obsolete, only for OPJ import)

Don't uses this. Use view()->setColumnWidth(column, width) instead.

Definition at line 272 of file Matrix.cpp.

273 {
274  for(int i=0; i<d_future_matrix->columnCount(); i++)
275  setColumnWidth(i, width);
276 }

References future::Matrix::columnCount(), d_future_matrix, and MatrixView::setColumnWidth().

Referenced by ImportOPJ::importTables(), and ApplicationWindow::openMatrix().

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

◆ setColumnWidth()

void MatrixView::setColumnWidth ( int  col,
int  width 
)
inherited

Definition at line 525 of file MatrixView.cpp.

526 {
527  QHeaderView * h_header = d_view_widget->horizontalHeader();
528  h_header->resizeSection(col, width);
529 }

References MatrixView::d_view_widget.

Referenced by setColumnsWidth().

Here is the caller graph for this function:

◆ setCoordinates()

void Matrix::setCoordinates ( double  xs,
double  xe,
double  ys,
double  ye 
)

Set the X and Y coordinate intervals.

Definition at line 179 of file Matrix.cpp.

180 {
181  d_future_matrix->setCoordinates(xs, xe, ys, ye);
182 }

References d_future_matrix, and future::Matrix::setCoordinates().

Referenced by ApplicationWindow::openMatrix().

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

◆ setDimensions

void Matrix::setDimensions ( int  rows,
int  cols 
)
slot

Set the Matrix size.

Definition at line 278 of file Matrix.cpp.

279 {
280  d_future_matrix->setDimensions(rows, cols);
281 }

References d_future_matrix, and future::Matrix::setDimensions().

Here is the call graph for this function:

◆ setFolder()

void MyWidget::setFolder ( Folder f)
inlineinherited

Initializes the pointer to the parent folder of the window.

Definition at line 131 of file MyWidget.h.

131 {parentFolder = f;};

References MyWidget::parentFolder.

Referenced by Folder::addWindow(), ApplicationWindow::initBareMultilayerPlot(), ApplicationWindow::initMatrix(), ApplicationWindow::initNote(), ApplicationWindow::initPlot3D(), ApplicationWindow::initTable(), and Folder::removeWindow().

Here is the caller graph for this function:

◆ setFormula()

void Matrix::setFormula ( const QString &  s)

Set the matrix forumla.

Definition at line 245 of file Matrix.cpp.

246 {
248 }

References d_future_matrix, and future::Matrix::setFormula().

Referenced by applyFormula(), ImportOPJ::importTables(), and ApplicationWindow::openMatrix().

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

◆ setHidden()

void MyWidget::setHidden ( )
virtualinherited

Notifies that a window was hidden by a direct user action.

Definition at line 162 of file MyWidget.cpp.

163 {
164  w_status = Hidden;
165  emit statusChanged (this);
166  hide();
167 }

References MyWidget::Hidden, MyWidget::statusChanged(), and MyWidget::w_status.

Referenced by ApplicationWindow::hideWindow(), and ApplicationWindow::openTemplate().

Here is the caller graph for this function:

◆ setMaximized()

void MyWidget::setMaximized ( )
inherited

Definition at line 183 of file MyWidget.cpp.

184 {
185  showMaximized();
187  emit statusChanged (this);
188 }

References MyWidget::Maximized, MyWidget::statusChanged(), and MyWidget::w_status.

Referenced by ApplicationWindow::folderItemDoubleClicked(), ApplicationWindow::maximizeWindow(), and ApplicationWindow::openTemplate().

Here is the caller graph for this function:

◆ setMinimized()

void MyWidget::setMinimized ( )
inherited

Definition at line 176 of file MyWidget.cpp.

177 {
178  showMinimized();
180  emit statusChanged (this);
181 }

References MyWidget::Minimized, MyWidget::statusChanged(), and MyWidget::w_status.

Referenced by ApplicationWindow::minimizeWindow(), and ApplicationWindow::openTemplate().

Here is the caller graph for this function:

◆ setName()

virtual void Matrix::setName ( const QString &  s)
inlinevirtual

Set the window name.

Reimplemented from MyWidget.

Definition at line 61 of file Matrix.h.

61 { d_future_matrix->setName(s); }

References d_future_matrix, and AbstractAspect::setName().

Referenced by ApplicationWindow::convertTableToMatrix(), ApplicationWindow::importImage(), and ApplicationWindow::newMatrix().

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

◆ setNormal()

void MyWidget::setNormal ( )
inherited

Definition at line 169 of file MyWidget.cpp.

170 {
171  showNormal();
172  w_status = Normal;
173  emit statusChanged (this);
174 }

References MyWidget::Normal, MyWidget::statusChanged(), and MyWidget::w_status.

Referenced by ApplicationWindow::activateSubWindow(), ApplicationWindow::folderItemDoubleClicked(), and ApplicationWindow::openTemplate().

Here is the caller graph for this function:

◆ setNumCols()

void Matrix::setNumCols ( int  cols)

Definition at line 298 of file Matrix.cpp.

299 {
301 }

References d_future_matrix, future::Matrix::rowCount(), and future::Matrix::setDimensions().

Here is the call graph for this function:

◆ setNumericFormat()

void Matrix::setNumericFormat ( const QChar &  f,
int  prec 
)

Set the number format for the cells.

You must call saveCellsToMemory() before and forgetSavedCells() after calling this! Format character and precision have the same meaning as for sprintf().

Parameters
fformat character 'e', 'f', 'g'
prec
  • for 'e', 'f': the number of digits after the radix character (point)
  • for 'g': the maximum number of significant digits
See also
saveCellsToMemory(), forgetSavedCells(), dMatrix

Definition at line 255 of file Matrix.cpp.

256 {
258  return;
259 
260  d_future_matrix->setNumericFormat(f.toLatin1());
262 
263  emit modifiedWindow(this);
264 }

References d_future_matrix, future::Matrix::displayedDigits(), MyWidget::modifiedWindow(), future::Matrix::numericFormat(), future::Matrix::setDisplayedDigits(), and future::Matrix::setNumericFormat().

Referenced by ImportOPJ::importTables(), and ApplicationWindow::initMatrix().

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

◆ setNumericPrecision()

void Matrix::setNumericPrecision ( int  prec)
inline

Set the number of significant digits.

See also
precision(), setNumericFormat(), setTextFormat()

Definition at line 181 of file Matrix.h.

References d_future_matrix, and future::Matrix::setDisplayedDigits().

Here is the call graph for this function:

◆ setNumRows()

void Matrix::setNumRows ( int  rows)

Definition at line 288 of file Matrix.cpp.

289 {
291 }

References future::Matrix::columnCount(), d_future_matrix, and future::Matrix::setDimensions().

Here is the call graph for this function:

◆ setRowHeight()

void MatrixView::setRowHeight ( int  row,
int  height 
)
inherited

Definition at line 519 of file MatrixView.cpp.

520 {
521  QHeaderView * v_header = d_view_widget->verticalHeader();
522  v_header->resizeSection(row, height);
523 }

References MatrixView::d_view_widget.

◆ setStatus()

void MyWidget::setStatus ( Status  s)
inherited

Set the window status flag (hidden, normal, minimized or maximized)

Definition at line 153 of file MyWidget.cpp.

154 {
155  if (w_status == s)
156  return;
157 
158  w_status = s;
159  emit statusChanged (this);
160 }

References MyWidget::statusChanged(), and MyWidget::w_status.

Referenced by ApplicationWindow::changeFolder(), ApplicationWindow::restoreWindowGeometry(), and ApplicationWindow::updateWindowStatus().

Here is the caller graph for this function:

◆ setText

void Matrix::setText ( int  row,
int  col,
const QString &  new_text 
)
slot

Set the content of the cell as a string.

Definition at line 157 of file Matrix.cpp.

158 {
159  bool ok = true;
160  QLocale locale;
161  double res = locale.toDouble(new_text, &ok);
162  if (ok)
163  d_future_matrix->setCell(row, col, res);
164  else
165  {
166  Script *script = scriptEnv->newScript(new_text, this, QString("<%1_%2_%3>").arg(name()).arg(row).arg(col));
167  connect(script, SIGNAL(error(const QString&,const QString&,int)), scriptEnv, SIGNAL(error(const QString&,const QString&,int)));
168 
169  script->setInt(row+1, "row");
170  script->setInt(row+1, "i");
171  script->setInt(col+1, "col");
172  script->setInt(col+1, "j");
173 
174  QVariant ret = script->eval();
175  setCell(row, col, ret.toDouble());
176  }
177 }

References d_future_matrix, Script::eval(), name(), ScriptingEnv::newScript(), scripted::scriptEnv, future::Matrix::setCell(), setCell(), and Script::setInt().

Referenced by ApplicationWindow::convertTableToMatrix(), Fit::covarianceMatrix(), and ApplicationWindow::openMatrix().

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

◆ setTextFormat()

void Matrix::setTextFormat ( const QChar &  format,
int  precision 
)

Set the number format for the cells.

This method should only be called before any user interaction was done. Use setTextFormat() if you want to change it from a dialog.

See also
setTextFormat()

Definition at line 266 of file Matrix.cpp.

267 {
268  d_future_matrix->setNumericFormat(format.toLatin1());
270 }

References d_future_matrix, precision(), future::Matrix::setDisplayedDigits(), and future::Matrix::setNumericFormat().

Referenced by ApplicationWindow::openMatrix().

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

◆ setWindowLabel()

virtual void Matrix::setWindowLabel ( const QString &  s)
inlinevirtual

Set the window label.

Reimplemented from MyWidget.

Definition at line 65 of file Matrix.h.

References d_future_matrix, AbstractAspect::setComment(), and MyWidget::updateCaption().

Referenced by ImportOPJ::importTables(), and ApplicationWindow::openMatrix().

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

◆ showContextMenu

void Matrix::showContextMenu ( )
signal

Show the context menu.

◆ showControlCoordinatesTab

void MatrixView::showControlCoordinatesTab ( )
slotinherited

Definition at line 406 of file MatrixView.cpp.

407 {
408  d_control_tabs->setVisible(true);
409  d_hide_button->setArrowType(Qt::RightArrow);
410  ui.tab_widget->setCurrentIndex(0);
411  ui.tab_widget->setFocus();
412  emit controlTabBarStatusChanged(d_control_tabs->isVisible());
413 }

References MatrixView::controlTabBarStatusChanged(), MatrixView::d_control_tabs, MatrixView::d_hide_button, and MatrixView::ui.

◆ showControlFormatTab

void MatrixView::showControlFormatTab ( )
slotinherited

Definition at line 415 of file MatrixView.cpp.

416 {
417  d_control_tabs->setVisible(true);
418  d_hide_button->setArrowType(Qt::RightArrow);
419  ui.tab_widget->setCurrentIndex(1);
420  ui.tab_widget->setFocus();
421  emit controlTabBarStatusChanged(d_control_tabs->isVisible());
422 }

References MatrixView::controlTabBarStatusChanged(), MatrixView::d_control_tabs, MatrixView::d_hide_button, and MatrixView::ui.

◆ showControlFormulaTab

void MatrixView::showControlFormulaTab ( )
slotinherited

Definition at line 424 of file MatrixView.cpp.

425 {
426  d_control_tabs->setVisible(true);
427  d_hide_button->setArrowType(Qt::RightArrow);
428  ui.tab_widget->setCurrentIndex(2);
429  ui.tab_widget->setFocus();
430  emit controlTabBarStatusChanged(d_control_tabs->isVisible());
431 }

References MatrixView::controlTabBarStatusChanged(), MatrixView::d_control_tabs, MatrixView::d_hide_button, and MatrixView::ui.

◆ showTitleBarMenu

void MyWidget::showTitleBarMenu ( )
signalinherited

Emitted when the title bar recieves a QContextMenuEvent.

Referenced by Graph3D::contextMenuEvent(), MyWidget::contextMenuEvent(), and MultiLayer::mousePressEvent().

Here is the caller graph for this function:

◆ status()

Status MyWidget::status ( )
inlineinherited

Return the window status flag (hidden, normal, minimized or maximized)

Definition at line 98 of file MyWidget.h.

98 {return w_status;};

References MyWidget::w_status.

Referenced by ApplicationWindow::changeFolder(), ApplicationWindow::clone(), ApplicationWindow::openTemplate(), ApplicationWindow::showAllFolderWindows(), ApplicationWindow::updateWindowStatus(), and ApplicationWindow::windowGeometryInfo().

Here is the caller graph for this function:

◆ statusChanged

void MyWidget::statusChanged ( MyWidget )
signalinherited

Emitted when the window status changed.

Referenced by MyWidget::changeEvent(), MyWidget::setHidden(), MyWidget::setMaximized(), MyWidget::setMinimized(), MyWidget::setNormal(), and MyWidget::setStatus().

Here is the caller graph for this function:

◆ text

QString Matrix::text ( int  row,
int  col 
)
slot

Return the content of the cell as a string.

Definition at line 152 of file Matrix.cpp.

153 {
154  return d_future_matrix->text(row, col);
155 }

References d_future_matrix, and future::Matrix::text().

Referenced by print().

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

◆ textFormat

QChar Matrix::textFormat ( )
inlineslot

Return the text format code ('e', 'f', ...)

See also
setNumerFormat(), setTextFormat()

Definition at line 168 of file Matrix.h.

168 {return d_future_matrix->numericFormat();};

References d_future_matrix, and future::Matrix::numericFormat().

Here is the call graph for this function:

◆ toggleControlTabBar

void MatrixView::toggleControlTabBar ( )
slotinherited

Definition at line 245 of file MatrixView.cpp.

246 {
247  d_control_tabs->setVisible(!d_control_tabs->isVisible());
248  if(d_control_tabs->isVisible())
249  d_hide_button->setArrowType(Qt::RightArrow);
250  else
251  d_hide_button->setArrowType(Qt::LeftArrow);
252  emit controlTabBarStatusChanged(d_control_tabs->isVisible());
253 }

References MatrixView::controlTabBarStatusChanged(), MatrixView::d_control_tabs, and MatrixView::d_hide_button.

Referenced by MatrixView::init().

Here is the caller graph for this function:

◆ transpose

void Matrix::transpose ( )
slot

Transpose the matrix.

Definition at line 375 of file Matrix.cpp.

376 {
378 }

References d_future_matrix, and future::Matrix::transpose().

Here is the call graph for this function:

◆ updateCaption

void MyWidget::updateCaption ( )
protectedslotinherited

Set caption according to current CaptionPolicy, name and label.

Definition at line 52 of file MyWidget.cpp.

53 {
54  switch (caption_policy)
55  {
56  case Name:
57  setWindowTitle(name());
58  break;
59 
60  case Label:
61  if (!windowLabel().isEmpty())
62  setWindowTitle(windowLabel());
63  else
64  setWindowTitle(name());
65  break;
66 
67  case Both:
68  if (!windowLabel().isEmpty())
69  setWindowTitle(name() + " - " + windowLabel());
70  else
71  setWindowTitle(name());
72  break;
73  }
74 };

References MyWidget::Both, MyWidget::caption_policy, MyWidget::Label, MyWidget::Name, MyWidget::name(), and MyWidget::windowLabel().

Referenced by handleAspectDescriptionChange(), Table::handleAspectDescriptionChange(), setCaptionPolicy(), MyWidget::setCaptionPolicy(), Table::setCaptionPolicy(), MyWidget::setName(), setWindowLabel(), MyWidget::setWindowLabel(), and Table::setWindowLabel().

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

◆ updateCoordinatesTab

void MatrixView::updateCoordinatesTab ( )
slotinherited

Definition at line 440 of file MatrixView.cpp.

441 {
442  ui.first_col_spinbox->setValue(d_matrix->xStart());
443  ui.last_col_spinbox->setValue(d_matrix->xEnd());
444  ui.first_row_spinbox->setValue(d_matrix->yStart());
445  ui.last_row_spinbox->setValue(d_matrix->yEnd());
446 }

References MatrixView::d_matrix, and MatrixView::ui.

Referenced by MatrixView::init().

Here is the caller graph for this function:

◆ updateDecimalSeparators()

void Matrix::updateDecimalSeparators ( )

Definition at line 713 of file Matrix.cpp.

714 {
715  this->update();
716 }

◆ updateFormatTab

void MatrixView::updateFormatTab ( )
slotinherited

Definition at line 462 of file MatrixView.cpp.

463 {
464  if (d_matrix)
465  {
466  ui.digits_box->setValue(d_matrix->displayedDigits());
467  int format_index = ui.format_box->findData(d_matrix->numericFormat());
468  ui.format_box->setCurrentIndex(format_index);
469  }
470 }

References MatrixView::d_matrix, and MatrixView::ui.

Referenced by MatrixView::init().

Here is the caller graph for this function:

◆ updateFormulaTab

void MatrixView::updateFormulaTab ( )
slotinherited

Definition at line 448 of file MatrixView.cpp.

449 {
450  if (d_matrix)
451  ui.formula_box->setPlainText(d_matrix->formula());
452 }

References MatrixView::d_matrix, and MatrixView::ui.

Referenced by MatrixView::init().

Here is the caller graph for this function:

◆ updateFunctionDoc

void Matrix::updateFunctionDoc ( )
protectedslot

Definition at line 755 of file Matrix.cpp.

756 {
757  ui.add_function_combobox->setToolTip(scriptEnv->mathFunctionDoc(ui.add_function_combobox->currentText()));
758 }

References ScriptingEnv::mathFunctionDoc(), scripted::scriptEnv, and MatrixView::ui.

Referenced by init().

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

◆ updateTypeInfo

void MatrixView::updateTypeInfo ( )
protectedslotinherited

Definition at line 543 of file MatrixView.cpp.

544 {
545  int digits = ui.digits_box->value();
546  int format_index = ui.format_box->currentIndex();
547  if (format_index >= 0)
548  {
549  char format = ui.format_box->itemData(format_index).toChar().toLatin1();
550  ui.type_info->setText(tr("Example: %1").arg(QString::number(100.1234567890123456, format, digits)));
551  }
552 }

References MatrixView::ui.

Referenced by MatrixView::init().

Here is the caller graph for this function:

◆ view()

virtual QWidget* Matrix::view ( )
inlinevirtual

Definition at line 123 of file Matrix.h.

123 {return d_future_matrix->view(); }

References d_future_matrix, and future::Matrix::view().

Referenced by ApplicationWindow::handleAspectAboutToBeRemoved(), and ApplicationWindow::handleAspectAdded().

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

◆ windowLabel()

virtual QString Matrix::windowLabel ( )
inlinevirtual

Return the window label.

Reimplemented from MyWidget.

Definition at line 63 of file Matrix.h.

63 { return d_future_matrix->comment(); }

References AbstractAspect::comment(), and d_future_matrix.

Referenced by ApplicationWindow::convertMatrixToTable(), and saveToString().

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

◆ xEnd()

double Matrix::xEnd ( )
inline

Return the X value corresponding to the last column.

Definition at line 265 of file Matrix.h.

265 {return d_future_matrix->xEnd();};

References d_future_matrix, and future::Matrix::xEnd().

Referenced by Graph3D::addMatrixData(), boundingRect(), MatrixData::MatrixData(), Graph::plotSpectrogram(), recalculate(), saveAsTemplate(), saveToString(), Graph3D::updateMatrixData(), and Graph3D::updateScalesFromMatrix().

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

◆ xStart()

double Matrix::xStart ( )
inline

Return the X value corresponding to column 1.

Definition at line 263 of file Matrix.h.

263 {return d_future_matrix->xStart();};

References d_future_matrix, and future::Matrix::xStart().

Referenced by Graph3D::addMatrixData(), boundingRect(), MatrixData::MatrixData(), Graph::plotSpectrogram(), recalculate(), saveAsTemplate(), saveToString(), Graph3D::updateMatrixData(), and Graph3D::updateScalesFromMatrix().

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

◆ yEnd()

double Matrix::yEnd ( )
inline

Return the Y value corresponding to the last row.

Definition at line 269 of file Matrix.h.

269 {return d_future_matrix->yEnd();};

References d_future_matrix, and future::Matrix::yEnd().

Referenced by Graph3D::addMatrixData(), boundingRect(), MatrixData::MatrixData(), Graph::plotSpectrogram(), recalculate(), saveAsTemplate(), saveToString(), Graph3D::updateMatrixData(), and Graph3D::updateScalesFromMatrix().

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

◆ yStart()

double Matrix::yStart ( )
inline

Return the Y value corresponding to row 1.

Definition at line 267 of file Matrix.h.

267 {return d_future_matrix->yStart();};

References d_future_matrix, and future::Matrix::yStart().

Referenced by Graph3D::addMatrixData(), boundingRect(), MatrixData::MatrixData(), Graph::plotSpectrogram(), recalculate(), saveAsTemplate(), saveToString(), Graph3D::updateMatrixData(), and Graph3D::updateScalesFromMatrix().

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

Member Data Documentation

◆ askOnClose

bool MyWidget::askOnClose
protectedinherited

Toggle on/off: Ask the user "delete, hide, or cancel?" on a close event.

Definition at line 175 of file MyWidget.h.

Referenced by MyWidget::askOnCloseEvent(), closeEvent(), MyWidget::closeEvent(), Table::closeEvent(), and MyWidget::MyWidget().

◆ birthdate

QString MyWidget::birthdate
protectedinherited

The creation date.

Definition at line 166 of file MyWidget.h.

Referenced by MyWidget::birthDate(), Table::init(), init(), setBirthDate(), MyWidget::setBirthDate(), and Table::setBirthDate().

◆ caption_policy

CaptionPolicy MyWidget::caption_policy
protectedinherited

◆ d_control_tabs

QWidget* MatrixView::d_control_tabs
protectedinherited

◆ d_future_matrix

◆ d_hide_button

QToolButton* MatrixView::d_hide_button
protectedinherited

◆ d_main_layout

QHBoxLayout* MatrixView::d_main_layout
protectedinherited

Definition at line 208 of file MatrixView.h.

Referenced by MatrixView::init().

◆ d_matrix

◆ d_model

MatrixModel* MatrixView::d_model
protectedinherited

◆ d_view_widget

◆ dMatrix

double** Matrix::dMatrix
private

Stores the matrix data only before the user opens the matrix dialog in order to avoid data loses during number format changes.

Definition at line 306 of file Matrix.h.

Referenced by cell(), forgetSavedCells(), init(), and saveCellsToMemory().

◆ parentFolder

Folder* MyWidget::parentFolder
protectedinherited

Pointer to the parent folder of the window.

Definition at line 159 of file MyWidget.h.

Referenced by MyWidget::folder(), and MyWidget::setFolder().

◆ scriptEnv

◆ ui

◆ w_label

QString MyWidget::w_label
protectedinherited

The window label.

See also
setWindowLabel(), windowLabel(), setCaptionPolicy()

Definition at line 164 of file MyWidget.h.

Referenced by MyWidget::MyWidget(), MyWidget::setWindowLabel(), and MyWidget::windowLabel().

◆ w_status


The documentation for this class was generated from the following files:
MatrixView::selectAll
void selectAll()
Definition: MatrixView.cpp:240
future::Matrix::yEnd
double yEnd() const
Definition: future_Matrix.cpp:1090
Matrix::dMatrix
double ** dMatrix
Stores the matrix data only before the user opens the matrix dialog in order to avoid data loses duri...
Definition: Matrix.h:306
future::Matrix::columnCount
int columnCount() const
Return the total number of columns.
Definition: future_Matrix.cpp:179
Matrix::yStart
double yStart()
Return the Y value corresponding to row 1.
Definition: Matrix.h:267
MyWidget::Label
@ Label
caption detemined by the window label
Definition: MyWidget.h:70
AbstractAspect::importV0x0001XXCreationTime
void importV0x0001XXCreationTime(const QString &str)
Definition: AbstractAspect.h:255
future::Matrix::save
virtual void save(QXmlStreamWriter *) const
Save as XML.
Definition: future_Matrix.cpp:1117
future::Matrix::transpose
void transpose()
Definition: future_Matrix.cpp:1443
future::Matrix::xStart
double xStart() const
Definition: future_Matrix.cpp:1075
Matrix::formula
QString formula()
Return the matrix formula.
Definition: Matrix.cpp:250
ScriptingChangeEvent::scriptingEnv
ScriptingEnv * scriptingEnv() const
Definition: Script.h:136
ScriptingEnv::newScript
virtual Script * newScript(const QString &, QObject *, const QString &)=0
Instantiate the Script subclass matching the ScriptEnv subclass.
MyWidget::caption_policy
CaptionPolicy caption_policy
The caption policy.
Definition: MyWidget.h:173
MyWidget::Maximized
@ Maximized
Definition: MyWidget.h:73
MatrixView::applyFormula
void applyFormula()
Definition: MatrixView.cpp:455
Matrix::xEnd
double xEnd()
Return the X value corresponding to the last column.
Definition: Matrix.h:265
Matrix::applyFormula
void applyFormula()
Definition: Matrix.cpp:733
MatrixView::applyFormat
void applyFormat()
Definition: MatrixView.cpp:472
ScriptEdit
Editor widget with support for evaluating expressions and executing code.
Definition: ScriptEdit.h:50
MyWidget::parentFolder
Folder * parentFolder
Pointer to the parent folder of the window.
Definition: MyWidget.h:159
scripted::scriptEnv
ScriptingEnv * scriptEnv
Definition: Script.h:155
ScriptingEnv::incref
void incref()
Increase the reference count. This should only be called by scripted and Script to avoid memory leaks...
Definition: ScriptingEnv.cpp:60
MatrixView::firstSelectedRow
int firstSelectedRow(bool full=false)
Return the index of the first selected row.
Definition: MatrixView.cpp:320
MatrixView::columnWidth
int columnWidth(int col) const
Definition: MatrixView.cpp:537
MatrixView::setColumnWidth
void setColumnWidth(int col, int width)
Definition: MatrixView.cpp:525
MyWidget::statusChanged
void statusChanged(MyWidget *)
Emitted when the window status changed.
Matrix::recalculate
bool recalculate()
Calculate matrix values using the formula for all selected cells.
Definition: Matrix.cpp:396
Matrix::allocateMatrixData
static double ** allocateMatrixData(int rows, int columns)
Allocate memory for a matrix buffer.
Definition: Matrix.cpp:696
Matrix::birthDate
virtual QString birthDate()
Return the creation date.
Definition: Matrix.h:288
MatrixView::d_model
MatrixModel * d_model
Pointer to the current underlying model.
Definition: MatrixView.h:193
data
Definition: exp_saturation.c:37
MyWidget::Normal
@ Normal
Definition: MyWidget.h:73
MatrixView::lastSelectedColumn
int lastSelectedColumn(bool full=false)
Return the index of the last selected column.
Definition: MatrixView.cpp:309
future::Matrix::setCells
void setCells(const QVector< qreal > &data)
Set the value of all cells.
Definition: future_Matrix.cpp:923
MatrixView::rereadSectionSizes
void rereadSectionSizes()
Definition: MatrixView.cpp:182
AbstractAspect::setComment
void setComment(const QString &value)
Definition: AbstractAspect.cpp:265
MyWidget::Minimized
@ Minimized
Definition: MyWidget.h:73
Script::setDouble
virtual bool setDouble(double, const char *)
Definition: Script.h:95
future::Matrix::setNumericFormat
void setNumericFormat(char format)
Definition: future_Matrix.cpp:1059
Matrix::xStart
double xStart()
Return the X value corresponding to column 1.
Definition: Matrix.h:263
MyWidget::showTitleBarMenu
void showTitleBarMenu()
Emitted when the title bar recieves a QContextMenuEvent.
ScriptingEnv::decref
void decref()
Decrease the reference count. This should only be called by scripted and Script to avoid segfaults.
Definition: ScriptingEnv.cpp:65
MatrixView::d_control_tabs
QWidget * d_control_tabs
Widget that contains the control tabs UI from ui.
Definition: MatrixView.h:205
MyWidget::windowLabel
virtual QString windowLabel()
Return the window label.
Definition: MyWidget.h:76
MatrixView::isRowSelected
bool isRowSelected(int row, bool full=false)
Returns true if row 'row' is selected; otherwise false.
Definition: MatrixView.cpp:287
MatrixView::controlTabBarStatusChanged
void controlTabBarStatusChanged(bool visible)
future::Matrix::displayedDigits
int displayedDigits() const
Definition: future_Matrix.cpp:1112
MyWidget::captionPolicy
virtual CaptionPolicy captionPolicy()
Return the caption policy.
Definition: MyWidget.h:86
AbstractAspect::creationTime
QDateTime creationTime() const
Definition: AbstractAspect.cpp:288
MyWidget::birthdate
QString birthdate
The creation date.
Definition: MyWidget.h:166
MatrixView::toggleControlTabBar
void toggleControlTabBar()
Definition: MatrixView.cpp:245
MatrixView::retranslateStrings
void retranslateStrings()
Definition: MatrixView.cpp:211
Matrix::print
void print()
Print the Matrix.
Definition: Matrix.cpp:568
Matrix::saveCellsToMemory
void saveCellsToMemory()
Temporally save the cell values to memory.
Definition: Matrix.cpp:380
Matrix::setFormula
void setFormula(const QString &s)
Set the matrix forumla.
Definition: Matrix.cpp:245
MyWidget::name
virtual QString name()
Return the window name.
Definition: MyWidget.h:81
SCRIPTING_CHANGE_EVENT
#define SCRIPTING_CHANGE_EVENT
Definition: customevents.h:40
future::Matrix::pasteIntoSelection
void pasteIntoSelection()
Definition: future_Matrix.cpp:253
MatrixViewWidget
Helper class for MatrixView.
Definition: MatrixView.h:63
MatrixView::d_view_widget
MatrixViewWidget * d_view_widget
The matrix view (first part of the UI)
Definition: MatrixView.h:203
MatrixView::d_matrix
QPointer< future::Matrix > d_matrix
Definition: MatrixView.h:209
future::Matrix::defaultColumnWidth
static int defaultColumnWidth()
Definition: future_Matrix.h:206
Matrix::name
virtual QString name()
Return the window name.
Definition: Matrix.h:59
MatrixView::updateFormulaTab
void updateFormulaTab()
Definition: MatrixView.cpp:448
future::Matrix::xEnd
double xEnd() const
Definition: future_Matrix.cpp:1085
MatrixView::d_hide_button
QToolButton * d_hide_button
Button to toogle the visibility of #d_tool_box.
Definition: MatrixView.h:207
scripted::scriptingChangeEvent
void scriptingChangeEvent(ScriptingChangeEvent *)
Definition: Script.cpp:119
MatrixView::isCellSelected
bool isCellSelected(int row, int col)
Return whether a cell is selected.
Definition: MatrixView.cpp:345
future::Matrix
Aspect providing a spreadsheet to manage MxN matrix data.
Definition: future_Matrix.h:60
MyWidget::modifiedWindow
void modifiedWindow(MyWidget *)
AbstractAspect::endMacro
void endMacro()
End the undo stack macro.
Definition: AbstractAspect.cpp:222
AbstractAspect::beginMacro
void beginMacro(const QString &text)
Begin an undo stack macro (series of commands)
Definition: AbstractAspect.cpp:215
Matrix::updateFunctionDoc
void updateFunctionDoc()
Definition: Matrix.cpp:755
future::Matrix::view
virtual QWidget * view()
Construct a primary view on me.
Definition: future_Matrix.cpp:104
MatrixView::applyCoordinates
void applyCoordinates()
Definition: MatrixView.cpp:433
MatrixViewWidget::selectAll
void selectAll()
Definition: MatrixView.cpp:556
MatrixView::isColumnSelected
bool isColumnSelected(int col, bool full=false)
Returns true if column 'col' is selected; otherwise false.
Definition: MatrixView.cpp:267
future::Matrix::setCoordinates
void setCoordinates(double x1, double x2, double y1, double y2)
Definition: future_Matrix.cpp:1052
Matrix::numCols
int numCols()
Return the number of columns.
Definition: Matrix.cpp:293
MatrixView::firstSelectedColumn
int firstSelectedColumn(bool full=false)
Return the index of the first selected column.
Definition: MatrixView.cpp:295
future::Matrix::rowCount
int rowCount() const
Return the total number of rows.
Definition: future_Matrix.cpp:184
Matrix::addFunction
void addFunction()
Definition: Matrix.cpp:745
MatrixView::advanceCell
void advanceCell()
Advance current cell after [Return] or [Enter] was pressed.
Definition: MatrixView.cpp:223
future::Matrix::fromImage
static Matrix * fromImage(const QImage &image)
Definition: future_Matrix.cpp:1498
Matrix::handleAspectDescriptionChange
void handleAspectDescriptionChange(const AbstractAspect *aspect)
Definition: Matrix.cpp:760
Matrix::d_future_matrix
future::Matrix * d_future_matrix
Definition: Matrix.h:56
AbstractAspect::name
QString name() const
Definition: AbstractAspect.cpp:229
future::Matrix::insertEmptyRows
void insertEmptyRows()
Insert rows depending on the selection.
Definition: future_Matrix.cpp:376
future::Matrix::setFormula
void setFormula(const QString &formula)
Definition: future_Matrix.cpp:1100
Matrix::setCell
void setCell(int row, int col, double value)
Set the value of the cell.
Definition: Matrix.cpp:142
future::Matrix::yStart
double yStart() const
Definition: future_Matrix.cpp:1080
MatrixView::ui
Ui::MatrixControlTabs ui
Definition: MatrixView.h:201
Matrix::saveText
QString saveText()
Return a string conaining the data of the matrix (<data> section)
Definition: Matrix.cpp:230
MyWidget::w_status
Status w_status
The window status.
Definition: MyWidget.h:168
MyWidget::Name
@ Name
caption determined by the window name
Definition: MyWidget.h:69
Script
A chunk of scripting code. Abstract.
Definition: Script.h:53
future::Matrix::formula
QString formula() const
Definition: future_Matrix.cpp:1095
FitData::p
size_t p
Definition: fit_gsl.h:44
MatrixView::updateCoordinatesTab
void updateCoordinatesTab()
Definition: MatrixView.cpp:440
MyWidget::Hidden
@ Hidden
Definition: MyWidget.h:73
MatrixView::handleHorizontalSectionResized
void handleHorizontalSectionResized(int logicalIndex, int oldSize, int newSize)
Definition: MatrixView.cpp:487
MatrixView::d_main_layout
QHBoxLayout * d_main_layout
Definition: MatrixView.h:208
Matrix::forgetSavedCells
void forgetSavedCells()
Definition: Matrix.cpp:390
MatrixView::updateTypeInfo
void updateTypeInfo()
Definition: MatrixView.cpp:543
future::Matrix::insertEmptyColumns
void insertEmptyColumns()
Insert columns depending on the selection.
Definition: future_Matrix.cpp:324
AbstractAspect::setCaptionSpec
void setCaptionSpec(const QString &value)
Set the specification string used for constructing the caption().
Definition: AbstractAspect.cpp:276
ScriptingChangeEvent
notify an object that it should update its scripting environment (see class scripted)
Definition: Script.h:133
MatrixView::MatrixView
MatrixView(future::Matrix *matrix)
Constructor.
Definition: MatrixView.cpp:57
MatrixView::handleVerticalSectionResized
void handleVerticalSectionResized(int logicalIndex, int oldSize, int newSize)
Definition: MatrixView.cpp:503
scripted::scripted
scripted(ScriptingEnv *env)
Definition: Script.cpp:108
AbstractAspect::setName
void setName(const QString &value)
Definition: AbstractAspect.cpp:234
AbstractAspect::comment
QString comment() const
Definition: AbstractAspect.cpp:260
Matrix::handleChange
void handleChange()
Definition: Matrix.cpp:129
MyWidget::Both
@ Both
caption = "name - label"
Definition: MyWidget.h:71
Matrix::Matrix
Matrix(ScriptingEnv *env, int r, int c, const QString &label, QWidget *parent=0, const char *name=0, Qt::WindowFlags f=0)
Constructor.
Definition: Matrix.cpp:63
Matrix::copySelection
void copySelection()
Standard copy operation.
Definition: Matrix.cpp:452
future::Matrix::setDisplayedDigits
void setDisplayedDigits(int digits)
Definition: future_Matrix.cpp:1067
MatrixView::lastSelectedRow
int lastSelectedRow(bool full=false)
Return the index of the last selected row.
Definition: MatrixView.cpp:334
ScriptingEnv::mathFunctions
virtual const QStringList mathFunctions() const
Return a list of supported mathematical functions. These should be imported into the global namespace...
Definition: ScriptingEnv.h:72
ScriptingEnv::mathFunctionDoc
virtual const QString mathFunctionDoc(const QString &) const
Return a documentation string for the given mathematical function.
Definition: ScriptingEnv.h:74
Matrix::text
QString text(int row, int col)
Return the content of the cell as a string.
Definition: Matrix.cpp:152
future::Matrix::setCell
void setCell(int row, int col, double value)
Set the value of the cell.
Definition: future_Matrix.cpp:916
AbstractAspect::remove
virtual void remove()
Remove me from my parent's list of children.
Definition: AbstractAspect.h:250
future::Matrix::clearSelectedCells
void clearSelectedCells()
Definition: future_Matrix.cpp:436
Matrix::clearSelection
void clearSelection()
Clear cells.
Definition: Matrix.cpp:447
Script::eval
virtual QVariant eval()
Evaluate the Code, returning QVariant() on an error / exception.
Definition: Script.cpp:96
Matrix::yEnd
double yEnd()
Return the Y value corresponding to the last row.
Definition: Matrix.h:269
future::Matrix::numericFormat
char numericFormat() const
Definition: future_Matrix.cpp:1107
Matrix::addCell
void addCell()
Definition: Matrix.cpp:750
MyWidget::hiddenWindow
void hiddenWindow(MyWidget *)
Emitted when the window was hidden.
Matrix::windowLabel
virtual QString windowLabel()
Return the window label.
Definition: Matrix.h:63
MatrixView::updateFormatTab
void updateFormatTab()
Definition: MatrixView.cpp:462
MyWidget::askOnClose
bool askOnClose
Toggle on/off: Ask the user "delete, hide, or cancel?" on a close event.
Definition: MyWidget.h:175
MatrixView::init
void init()
Initialization.
Definition: MatrixView.cpp:84
future::Matrix::copySelection
void copySelection()
Definition: future_Matrix.cpp:219
Script::setInt
virtual bool setInt(int, const char *)
Definition: Script.h:94
future::Matrix::text
QString text(int row, int col)
Return the text displayed in the given cell.
Definition: future_Matrix.cpp:905
future::Matrix::removeSelectedColumns
void removeSelectedColumns()
Definition: future_Matrix.cpp:349
future::Matrix::removeSelectedRows
void removeSelectedRows()
Definition: future_Matrix.cpp:402
MyWidget::updateCaption
void updateCaption()
Set caption according to current CaptionPolicy, name and label.
Definition: MyWidget.cpp:52
future::Matrix::defaultRowHeight
static int defaultRowHeight()
Definition: future_Matrix.h:207
MyWidget::changeEvent
virtual void changeEvent(QEvent *event)
Definition: MyWidget.cpp:129
Matrix::numRows
int numRows()
Return the number of rows.
Definition: Matrix.cpp:283
future::Matrix::setDimensions
void setDimensions(int rows, int cols)
Set the number of rows and columns.
Definition: future_Matrix.cpp:160
MatrixModel::index
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: MatrixModel.cpp:172
MyWidget::aspect
QString aspect()
Return the window status as a string.
Definition: MyWidget.cpp:106
future::Matrix::cell
double cell(int row, int col) const
Return the value in the given cell.
Definition: future_Matrix.cpp:198
Matrix::precision
int precision()
Return the number precision digits.
Definition: Matrix.h:175
Matrix::freeMatrixData
static void freeMatrixData(double **data, int rows)
Free memory used for a matrix buffer.
Definition: Matrix.cpp:705
Matrix::cell
double cell(int row, int col)
Return the value of the cell as a double.
Definition: Matrix.cpp:134
AbstractAspect
Base class of all persistent objects in a Project.
Definition: AbstractAspect.h:86
future::Matrix::copy
void copy(Matrix *other)
Definition: future_Matrix.cpp:866
Script::compile
virtual bool compile(bool for_eval=true)
Compile the Code. Return true if the implementation doesn't support compilation.
Definition: Script.cpp:90