audacia/src/HistoryWindow.h
v.audacity 62689e9e70 Sped up HistoryWindow updating by eliminating duplicate clearing and refilling the wxListCtrl. In the worst case, where the window had not yet been created, it would clear and refill the same content in the list 3 times. Otherwise it would always do it 2 times.
The only call to Show for HistoryWindow is in AudacityProject::OnHistory, and it always calls HistoryWindow::UpdateDisplay. All HistoryWindow::UpdateDisplay does is check IsShown() and if so, call HistoryWindow::DoUpdate. 

Removed the call to HistoryWindow::DoUpdate in the constructor because AudacityProject::OnHistory will get that done. 

Removed HistoryWindow::OnShow. No reason to implement it outside the normal wxDialog::Show() mechanism, and all it did was call HistoryWindow::UpdateDisplay (and then AudacityProject::OnHistory would do that again).

Didn't see any other reasons it has been slow, as it's just getting the state names and sizes from the stack, not actually examining anything about the states. It probably doesn't really need to clear the list and repopulate it every time, but let's see if this gives sufficient improvement before adding a lot of mechanisms for tracking exactly what needs to change.
2010-07-30 21:47:25 +00:00

69 lines
1.5 KiB
C++

/**********************************************************************
Audacity: A Digital Audio Editor
HistoryWindow.h
Joshua Haberman
**********************************************************************/
#ifndef __AUDACITY_HISTORY_WINDOW__
#define __AUDACITY_HISTORY_WINDOW__
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/event.h>
#include <wx/frame.h>
#include <wx/listctrl.h>
#include <wx/spinctrl.h>
#include <wx/textctrl.h>
class AudacityProject;
class ShuttleGui;
class UndoManager;
class HistoryWindow :public wxDialog {
public:
HistoryWindow(AudacityProject * parent, UndoManager *manager);
~HistoryWindow();
void UpdateDisplay();
private:
void DoUpdate();
void UpdateLevels();
void OnSize(wxSizeEvent & event);
void OnCloseWindow(wxCloseEvent & WXUNUSED(event));
void OnChar(wxKeyEvent & event);
void OnItemSelected(wxListEvent & event);
void OnDiscard(wxCommandEvent & event);
AudacityProject *mProject;
UndoManager *mManager;
wxListCtrl *mList;
wxTextCtrl *mAvail;
wxSpinCtrl *mLevels;
wxButton *mDiscard;
int mSelected;
public:
DECLARE_EVENT_TABLE()
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 0123f234-637e-4e23-ad09-a8007bc9281a