wxMaxima
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
MatrixViewer Class Reference

A window that shows a matrix the worksheet only shows part of (GH #2344) More...

#include <MatrixViewer.h>

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

Public Member Functions

 MatrixViewer (wxWindow *parent, const MatrCell &matrix, Configuration *config)
 Opens a viewer showing this matrix.
 
Worksheet * GetWorksheet () const
 The worksheet the viewer shows the matrix in.
 

Static Public Member Functions

static void ConfigureForViewer (Configuration &config)
 Makes a copy of the worksheet's configuration suitable for the viewer.
 
static std::unique_ptr< GroupCell > CopyForViewer (const MatrCell &matrix, Configuration *config)
 A group cell whose output is a copy of this matrix.
 
static MatrCell * PartiallyShownMatrixAt (const GroupCell *group, wxPoint point)
 The matrix a double-click at this point should open a viewer for.
 

Detailed Description

A window that shows a matrix the worksheet only shows part of (GH #2344)

A matrix too large for the window is elided or scrolls (see MatrCell). Double-clicking one opens this viewer, which shows a copy of the whole matrix – every row and every column – in a worksheet of its own that scrolls as far as the matrix needs.

The viewer is independent of the matrix it was opened from: it takes a copy (through the matrix's XML, so the copy's cells belong to the viewer's own Configuration), so re-evaluating or deleting the original doesn't affect it, and several viewers can be open at once. It is read-only: its worksheet doesn't react to clicks or keys, so nothing can be typed into it or evaluated there.

The viewer's Configuration is a copy of the worksheet's, so the matrix looks the same as in the worksheet (fonts, colours, zoom), except that ConfigureForViewer() makes it show every matrix in full, whatever wx_matrix()'s oversized option asked for, and hides the input and the output label.

Constructor & Destructor Documentation

◆ MatrixViewer()

MatrixViewer::MatrixViewer ( wxWindow *  parent,
const MatrCell &  matrix,
Configuration *  config 
)

Opens a viewer showing this matrix.

Parameters
parentThe window the viewer belongs to; it closes with it.
matrixThe matrix to show. Only copied: the viewer keeps no reference to it.
configThe worksheet's configuration, which the viewer's own is copied from.

Member Function Documentation

◆ ConfigureForViewer()

void MatrixViewer::ConfigureForViewer ( Configuration &  config)
static

Makes a copy of the worksheet's configuration suitable for the viewer.

Shows every matrix in full – the configuration doesn't let a matrix ask for anything else, so a nested matrix or one made by wx_matrix(..., oversized=elide) is shown in full, too – and hides the code cell's (empty) input and the output label. Makes the configuration temporary, so none of that is written to the config file when it is destroyed.

Call it only once the viewer's worksheet exists: the worksheet's constructor reads the config file into the configuration, undoing anything set before.

◆ CopyForViewer()

std::unique_ptr< GroupCell > MatrixViewer::CopyForViewer ( const MatrCell &  matrix,
Configuration *  config 
)
static

A group cell whose output is a copy of this matrix.

The copy is made through the matrix's XML, parsed with config, so every cell of it belongs to config – which a Cell::Copy() would not ensure. The output label is empty: the viewer shows only the matrix.

◆ PartiallyShownMatrixAt()

MatrCell * MatrixViewer::PartiallyShownMatrixAt ( const GroupCell *  group,
wxPoint  point 
)
static

The matrix a double-click at this point should open a viewer for.

Parameters
groupThe group cell that was double-clicked.
pointThe point that was clicked, in worksheet (unscrolled) coordinates.

Returns the outermost matrix at that point that the worksheet only shows part of (MatrCell::IsShownPartially()), or nullptr if there is none: a matrix that fits the window has nothing more to show.


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