forked from eranif/codelite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmemcheckoutputview.h
177 lines (155 loc) · 9.01 KB
/
memcheckoutputview.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// Copyright : (C) 2015 Eran Ifrah
// File name : memcheckoutputview.h
//
// -------------------------------------------------------------------------
// A
// _____ _ _ _ _
// / __ \ | | | | (_) |
// | / \/ ___ __| | ___| | _| |_ ___
// | | / _ \ / _ |/ _ \ | | | __/ _ )
// | \__/\ (_) | (_| | __/ |___| | || __/
// \____/\___/ \__,_|\___\_____/_|\__\___|
//
// F i l e
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
/**
* @file
* @author pavel.iqx
* @date 2014
* @copyright GNU General Public License v2
*/
#ifndef _MEMCHECKOUTPUTVIEW_H_
#define _MEMCHECKOUTPUTVIEW_H_
#include <wx/valnum.h>
#include <wx/tipwin.h>
#include "memcheck.h"
#include "memcheckui.h"
#include "imemcheckprocessor.h"
class MemCheckOutputView: public MemCheckOutputViewBase
{
public:
MemCheckOutputView(wxWindow * parent, MemCheckPlugin * plugin, IManager * mgr);
virtual ~ MemCheckOutputView();
protected:
virtual void OnStop(wxCommandEvent& event);
virtual void OnStopUI(wxUpdateUIEvent& event);
virtual void OnListCtrlErrorsMouseLeave(wxMouseEvent& event);
virtual void OnListCtrlErrorsChar(wxKeyEvent& event);
virtual void OnListCtrlErrorsKeyDown(wxKeyEvent& event);
virtual void OnListCtrlErrorsKeyUp(wxKeyEvent& event);
virtual void OnListCtrlErrorsLeftDown(wxMouseEvent& event);
virtual void OnListCtrlErrorsLeftUp(wxMouseEvent& event);
virtual void OnListCtrlErrorsDeselected(wxListEvent& event);
virtual void OnListCtrlErrorsSelected(wxListEvent& event);
virtual void OnListCtrlErrorsActivated(wxListEvent& event);
virtual void OutputViewPageChanged(wxNotebookEvent& event);
virtual void OnSuppFileOpen(wxCommandEvent& event);
virtual void OnErrorsPanelUI(wxUpdateUIEvent& event);
virtual void OnSuppPanelUI(wxUpdateUIEvent& event);
virtual void OnListCtrlErrorsMouseMotion(wxMouseEvent& event);
virtual void OnListCtrlErrorsResize(wxSizeEvent& event);
virtual void OnPageSelect(wxCommandEvent& event);
virtual void OnClearFilter(wxCommandEvent& event);
virtual void OnPageFirst(wxCommandEvent& event);
virtual void OnPageLast(wxCommandEvent& event);
virtual void OnPageNext(wxCommandEvent& event);
virtual void OnPagePrev(wxCommandEvent& event);
virtual void OnSearchNonworkspace(wxCommandEvent& event);
virtual void OnOpenPlain(wxCommandEvent& event);
virtual void OnFilterErrors(wxCommandEvent& event);
virtual void OnSuppFileSelected(wxCommandEvent& event);
virtual void OnSuppressAll(wxCommandEvent& event);
virtual void OnSuppressSelected(wxCommandEvent& event);
virtual void OnSelectionChanged(wxDataViewEvent& event);
virtual void OnContextMenu(wxDataViewEvent& event);
virtual void OnValueChanged(wxDataViewEvent& event);
virtual void OnMemCheckUI(wxUpdateUIEvent& event);
virtual void OnActivated(wxDataViewEvent& event);
virtual void OnJumpToNext(wxCommandEvent& event);
virtual void OnJumpToPrev(wxCommandEvent& event);
virtual void OnExpandAll(wxCommandEvent& event);
//common things for both notebooks
MemCheckPlugin * m_plugin;
IManager *m_mgr;
wxString m_workspacePath;
enum {
SUPPRESS_CLICKED = 1 << 1, ///< on tree view page supress one error
SUPPRESS_CHECKED = 1 << 2, ///< on tree view page supress all checked
SUPPRESS_ALL = 1 << 3, ///< on supp page supress all
SUPPRESS_SELECTED = 1 << 4, ///< on supp page supress selected
};
bool itemsInvalidView; ///< on supp page have been some items suppressed => view page is invalid
bool itemsInvalidSupp; ///< on tree view page have been some items suppressed => supp page is invalid
void ResetItemsView(); ///< make tree view page valid = count items and save it to "m_totalErrorsView"
void ResetItemsSupp(); ///< make supp page valid = count items and save it to "m_totalErrorsSupp"
/**
* @brief Perform all kinds of suppressions from both pages
* @param mode SUPPRESS_CLICKED | SUPPRESS_CHECKED | SUPPRESS_ALL | SUPPRESS_SELECTED
* @param dvItem is set only if mode is SUPPRESS_CLICKED
*
* By suppressing an item(error) is meant add suppression patern for that error into supp file
*/
void SuppressErrors(unsigned int mode, wxDataViewItem* dvItem = NULL);
/////////////////////////////////////////////////////////////////////////////////////////////////
//tree view page
wxIntegerValidator<size_t> pageValidator; ///< validator for wxTextCtrl which changes page on page view
bool m_currentPageIsEmptyView;
wxDataViewItem m_currentItem;
bool m_onValueChangedLocked; ///< if user (un)checks an item, all items in its tree must be (un)checked. This action is trigered by OnValueChanged callback. Problem is that if an item is checked is also invoked that callback. So this lock brakes the infinite loop.
int m_markedErrorsCount;
size_t m_totalErrorsView;
size_t m_currentPage;
size_t m_pageMax;
wxDataViewItem GetTopParent(wxDataViewItem item); ///< get top level item for an item
wxDataViewItem GetLeaf(const wxDataViewItem &item, bool first); ///< get deepes item for an item(error), first == true means firts from top, first==false means last.
wxDataViewItem GetAdjacentItem(const wxDataViewItem &item, bool forward); ///< for an item(error or location) get adjecent item. this is used for next/prev functionality. Forward == true means item below, forward == false means item above.
void ExpandAll(const wxDataViewItem & item); ///< wxDVC doesn't implenet ExpandAll, so this is it
void SetCurrentItem(const wxDataViewItem &item); ///< marks current item with little green right arrow
void MarkTree(const wxDataViewItem &item, bool checked); ///< (un)checks all items (whole one tree) that belong to an error
unsigned int GetColumnByName(const wxString & name); ///< Finds index of an wxDVC column by its caption
void JumpToLocation(const wxDataViewItem &item); ///< Opens file specifieed in particular ErrorLocation in editor
void ShowPageView(size_t page); ///< Item could be more than is good for wxDVC. So paging is implementetd. This method fills wxDVC with portion of errors.
void AddTree(const wxDataViewItem & parentItem, MemCheckError & error); ///< Adds one error and all its location into wxDVC as tree
void OnJumpToLocation(wxCommandEvent & event); ///< Callback from wxDVC popupmenu
void OnUnmarkAllErrors(wxCommandEvent & event); ///< Callback from wxDVC popupmenu
void OnSuppressError(wxCommandEvent & event); ///< Callback from wxDVC popupmenu
void OnSuppressMarkedErrors(wxCommandEvent & event); ///< Callback from wxDVC popupmenu
void OnRowToClip(wxCommandEvent& event); ///< Callback from wxDVC popupmenu. Puts row as string into clipboard.
void OnErrorToClip(wxCommandEvent& event); ///< Callback from wxDVC popupmenu. Puts whole error as string into clipboard.
void OnMarkedErrorsToClip(wxCommandEvent& event); ///< Callback from wxDVC popupmenu. Puts checked error as string into clipboard.
//supp page
enum {
FILTER_CLEAR = 1 << 1, ///< on supp page, clear the filter => show all errors
FILTER_STRING = 1 << 2, ///< on supp page, filter by string or reg exp
FILTER_WORKSPACE = 1 << 3, ///< on supp page, filter errors which have at least on file from current workspace in its stack trace.
};
wxMenu* m_searchMenu; ///< wxSearchCtrl popupmenu
size_t m_totalErrorsSupp; ///< Total items in wxListCtrl.
std::vector<MemCheckError *> m_filterResults; ///< Contetn of wxListCtrl.
long m_lastToolTipItem; ///< On hover over wxListCtrl tooltip is shown. It is refreshed only if user hovers another item, not if moves by one pixel.
void ApplyFilterSupp(unsigned int mode); ///< Performs filtering errors. Searches in whole ErrorList structure. Mode is FILTER_CLEAR | FILTER_STRING | FILTER_WORKSPACE.
void UpdateStatusSupp(); ///< Shows number of error total / filtered /selected
void ListCtrlErrorsShowTip(long item); ///< Sets proper tooltip for wxListCtrl. Item is index in m_filterResults.
public:
/**
* @brief Load ErrorList into wxDVC and wxListCtrl on tree view and supp page.
*
* MemCheck plugin calls this method after test ends and after processor parses logfile into ErrorList.
*/
void LoadErrors();
/**
* @brief clear the content
*/
void Clear();
};
#endif // _MEMCHECKOUTPUTVIEW_H_