wxMaxima
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>
39 enum
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 
55 class History final : public wxPanel
56 {
57 public:
58  History(wxWindow *parent, int id);
59 
60  ~History();
61 
63  void AddToHistory(const wxString &cmd);
64 
65  void OnRegExEvent(wxCommandEvent &ev);
66 
67  void RebuildDisplay();
68 
69  wxString GetCommand(bool next);
70 
71  void MaximaSessionStart();
72 
74  bool UpdateDeferred();
75 
76 private:
78  void OnMouseRightDown(wxMouseEvent &event);
79  void OnMenu(wxCommandEvent &event);
80 
81  void UnselectAll() const;
82  void SetCurrent(long);
83 
84  int m_sessionCommands = 0;
85  wxListBox *m_history;
86  RegexCtrl *m_regex;
87  std::vector<wxString> m_commands;
89  wxArrayString m_deferredCommands;
91  long m_current = 0;
92  wxString m_regex_Old;
94  bool m_showCurrentSessionOnly = true;
96  static wxString m_showCurrentSessionOnlyKey;
97 };
98 
99 #endif // HISTORY_H
History::UpdateDeferred
bool UpdateDeferred()
Actually update the history sidebar. Called when no other work is to be done.
Definition: History.cpp:101
History::AddToHistory
void AddToHistory(const wxString &cmd)
Add a file to the recently opened files list.
Definition: History.cpp:221
History
Definition: History.h:55
RegexCtrl
Definition: RegexCtrl.h:34