Linux multi-monitor fullscreen support
[ryzomcore.git] / nel / tools / misc / log_analyser / ViewDialog.h
blob357c5f8eadf149f3972920f7e92200eaf2a58a2e
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include <vector>
18 #include <string>
20 #if !defined(AFX_VIEWDIALOG_H__FDD49815_5955_4204_8D1C_2839AE39DDB3__INCLUDED_)
21 #define AFX_VIEWDIALOG_H__FDD49815_5955_4204_8D1C_2839AE39DDB3__INCLUDED_
23 #if _MSC_VER > 1000
24 #pragma once
25 #endif // _MSC_VER > 1000
26 // ViewDialog.h : header file
30 class CViewDialog;
35 class CListCtrlEx : public CListCtrl
37 public:
38 void initIt();
39 void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
40 void RepaintSelectedItems();
41 //void OnKillFocus(CWnd* pNewWnd);
42 //void OnSetFocus(CWnd* pOldWnd);
44 void setViewDialog( CViewDialog *pt ) { _ViewDialog = pt; }
46 protected:
48 //{{AFX_MSG(CListCtrlEx)
49 afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
50 //}}AFX_MSG
51 DECLARE_MESSAGE_MAP()
53 private:
55 CViewDialog *_ViewDialog;
58 /////////////////////////////////////////////////////////////////////////////
59 // CViewDialog dialog
61 class CViewDialog : public CDialog
63 // Construction
64 public:
65 CViewDialog(CWnd* pParent = NULL); // standard constructor
67 // Dialog Data
68 //{{AFX_DATA(CViewDialog)
69 enum { IDD = IDD_View };
70 CListCtrlEx m_ListCtrl;
71 CString m_Caption;
72 //}}AFX_DATA
74 /// Load, using the current filters
75 void reload();
77 /// Load trace
78 void reloadTrace();
80 /// Set the filters (and backup the previous ones for bookmark translation)
81 void setFilters( const std::vector<CString>& posFilter, const std::vector<CString>& negFilter );
83 /// Returns true if the string must be logged, according to the current filters
84 bool passFilter( const char *text, const std::vector<CString>& posFilter, const std::vector<CString>& negFilter ) const;
86 /// Resize
87 void resizeView( int nbViews, int top, int left );
89 /// Clear
90 void clear();
92 /// Return the nb of lines
93 int getNbLines() const;
95 /// Return the nb of visible lines
96 int getNbVisibleLines() const;
98 /// Set redraw state
99 void setRedraw( bool redraw ) { m_ListCtrl.SetRedraw( redraw ); }
101 /// Fill from getNbLines() to maxNbLines with blank lines
102 void fillGaps( int maxNbLines );
104 /// Load a log file or series
105 void loadFileOrSeries( const std::vector<int>& bookmarksAbsoluteLines );
107 /// Add one line
108 void addLine( const CString& line ) { Buffer.push_back( line ); }
110 /// Add several lines
111 void addText( const CString& lines );
113 /// Commit the lines previously added
114 void commitAddedLines();
116 /// Scroll
117 void scrollTo( int index );
119 /// Select
120 void select( int index );
122 /// Get selected index
123 int getSelectionIndex() { return m_ListCtrl.GetSelectionMark(); }
125 /// Return the index of the top of the listbox
126 int getScrollIndex() const;
128 /// Add the current scroll index to the bookmark list, or delete it if already inside the list
129 void addBookmark();
131 /// Scroll the listbox to the next found stored bookmkark (downwards from the current scroll index)
132 void recallNextBookmark();
134 /// Display string
135 void displayString();
137 /// Return the textcolor
138 COLORREF getTextColorForLine( int index, bool selected );
140 /// Return the background color
141 COLORREF getBkColorForLine( int index, bool selected );
144 std::string corruptedLinesString( const std::vector<unsigned int>& corruptedLines );
146 /// Reload with old filter to get bookmarks absolute line numbers (not called if there's no bookmark)
147 void getBookmarksAbsoluteLines( std::vector<int>& bookmarksAbsoluteLines );
149 //{{AFX_MSG(CViewDialog)
150 afx_msg void OnButtonFind();
151 //}}AFX_MSG
153 int Index;
154 CString Seriesname;
155 std::vector<CString> Filenames;
156 std::vector<CString> PosFilter, NegFilter, PreviousPosFilter, PreviousNegFilter;
157 CString LogSessionStartDate;
158 bool SessionDatePassed;
159 std::vector<CString> Buffer;
160 int BeginFindIndex;
161 CFindReplaceDialog *FindDialog;
162 CString FindStr;
163 bool FindMatchCase, FindDownwards;
164 float WidthR; // ratio to the app's client window
165 std::vector<int> Bookmarks;
166 int CurrentBookmark;
168 // Overrides
169 // ClassWizard generated virtual function overrides
170 //{{AFX_VIRTUAL(CViewDialog)
171 protected:
172 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
173 //}}AFX_VIRTUAL
175 // Implementation
176 protected:
178 afx_msg LRESULT OnFindReplace(WPARAM wParam, LPARAM lParam);
180 // Generated message map functions
181 //{{AFX_MSG(CViewDialog)
182 afx_msg void OnButtonFilter();
183 virtual BOOL OnInitDialog();
184 afx_msg void OnGetdispinfoList1(NMHDR* pNMHDR, LRESULT* pResult);
185 afx_msg void OnItemchangedList1(NMHDR* pNMHDR, LRESULT* pResult);
186 afx_msg void OnSetfocusList1(NMHDR* pNMHDR, LRESULT* pResult);
187 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
188 //}}AFX_MSG
189 DECLARE_MESSAGE_MAP()
192 //{{AFX_INSERT_LOCATION}}
193 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
195 #endif // !defined(AFX_VIEWDIALOG_H__FDD49815_5955_4204_8D1C_2839AE39DDB3__INCLUDED_)