wxMaxima
Loading...
Searching...
No Matches
History.h
Go to the documentation of this file.
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2009-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4// (C) 2014-2015 Gunter Königsmann <wxMaxima@physikbuch.de>
5// (C) 2020 Kuba Ober <kuba@bertec.com>
6//
7// This program is free software; you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation; either version 2 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21//
22// SPDX-License-Identifier: GPL-2.0+
23
30#ifndef HISTORY_H
31#define HISTORY_H
32
33#include "precomp.h"
34#include "RegexCtrl.h"
35#include <wx/wx.h>
36#include <wx/regex.h>
37#include <vector>
38#include <wx/arrstr.h>
39enum
40{
41 history_ctrl_id = 1,
42 history_regex_id,
43 export_all,
44 export_session,
45 export_visible,
46 export_selected,
47 toggle_ShowCurrentSessionOnly,
48 clear_selection,
49 clear_history
50};
51
55class History final : public wxPanel
56{
57public:
58 History(wxWindow *parent, int id, Configuration *cfg);
59
61 ~History();
62
64 void AddToHistory(const wxString &cmd);
65
67 void OnRegExEvent(wxCommandEvent &ev);
68
70 void RebuildDisplay();
71
78 wxString GetCommand(bool next);
79
81 void MaximaSessionStart();
82
84 bool UpdateDeferred();
86 void SetSavePlace(const wxString &saveplace);
87
88private:
90 void OnMouseRightDown(wxMouseEvent &event);
92 void OnMenu(wxCommandEvent &event);
93
94 void UnselectAll() const;
95 void SetCurrent(long current);
96
97 wxString m_saveplace;
99 size_t m_sessionCommands = 0;
100 wxListBox *m_history;
101 RegexCtrl *m_regex;
102 std::vector<wxString> m_commands;
104 wxArrayString m_deferredCommands;
106 long m_current = 0;
107 wxString m_regex_Old;
109 bool m_showCurrentSessionOnly = true;
111 static wxString m_showCurrentSessionOnlyKey;
112};
113
114#endif // HISTORY_H
The configuration storage for the current worksheet.
Definition: Configuration.h:85
This class generates a pane containing the last commands that were issued.
Definition: History.h:56
bool UpdateDeferred()
Actually update the history sidebar. Called when no other work is to be done.
Definition: History.cpp:141
wxString GetCommand(bool next)
Get the currently selected command and advance the selection.
Definition: History.cpp:301
void RebuildDisplay()
Apply all filters and refresh the display.
Definition: History.cpp:275
void SetSavePlace(const wxString &saveplace)
Where to save the history?
Definition: History.cpp:238
void MaximaSessionStart()
Is called when a new maxima session starts.
Definition: History.cpp:133
~History()
The destructor.
Definition: History.cpp:245
void AddToHistory(const wxString &cmd)
Add a file to the recently opened files list.
Definition: History.cpp:264
void OnRegExEvent(wxCommandEvent &ev)
Called if the filter text or method changes.
Definition: History.cpp:296
A BTextCtrl that allows to input a regex.
Definition: RegexCtrl.h:36