wxMaxima
Loading...
Searching...
No Matches
MatrixViewer.h
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2026 Gunter Königsmann <wxMaxima@physikbuch.de>
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation; either version 2 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15//
16// You should have received a copy of the GNU General Public License
17// along with this program; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19//
20// SPDX-License-Identifier: GPL-2.0+
21
22#ifndef MATRIXVIEWER_H
23#define MATRIXVIEWER_H
24
25#include "precomp.h"
26#include <wx/wx.h>
27#include <memory>
28
29class Cell;
30class Configuration;
31class GroupCell;
32class MatrCell;
33class Worksheet;
34
55class MatrixViewer : public wxFrame
56{
57public:
66 MatrixViewer(wxWindow *parent, const MatrCell &matrix, Configuration *config);
67 ~MatrixViewer() override;
68
70 Worksheet *GetWorksheet() const { return m_worksheet; }
71
85 static void ConfigureForViewer(Configuration &config);
86
93 static std::unique_ptr<GroupCell> CopyForViewer(const MatrCell &matrix,
94 Configuration *config);
95
106 static MatrCell *PartiallyShownMatrixAt(const GroupCell *group, wxPoint point);
107
108private:
110 static MatrCell *PartiallyShownMatrixIn(Cell *list, wxPoint point);
112 void OnIdle(wxIdleEvent &event);
114 void OnCharHook(wxKeyEvent &event);
116 void FitToMatrix();
117
123 std::unique_ptr<Configuration> m_configuration;
125 Worksheet *m_worksheet = nullptr;
126};
127
128#endif // MATRIXVIEWER_H
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:148
The configuration storage for the current worksheet.
Definition: Configuration.h:100
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:88
A Cell that displays a matrix.
Definition: MatrCell.h:92
A window that shows a matrix the worksheet only shows part of (GH #2344)
Definition: MatrixViewer.h:56
static std::unique_ptr< GroupCell > CopyForViewer(const MatrCell &matrix, Configuration *config)
A group cell whose output is a copy of this matrix.
Definition: MatrixViewer.cpp:87
Worksheet * GetWorksheet() const
The worksheet the viewer shows the matrix in.
Definition: MatrixViewer.h:70
static MatrCell * PartiallyShownMatrixAt(const GroupCell *group, wxPoint point)
The matrix a double-click at this point should open a viewer for.
Definition: MatrixViewer.cpp:102
static void ConfigureForViewer(Configuration &config)
Makes a copy of the worksheet's configuration suitable for the viewer.
Definition: MatrixViewer.cpp:77
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:118