1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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/>.
20 #if !defined(AFX_VIEWDIALOG_H__FDD49815_5955_4204_8D1C_2839AE39DDB3__INCLUDED_)
21 #define AFX_VIEWDIALOG_H__FDD49815_5955_4204_8D1C_2839AE39DDB3__INCLUDED_
25 #endif // _MSC_VER > 1000
26 // ViewDialog.h : header file
35 class CListCtrlEx
: public CListCtrl
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
; }
48 //{{AFX_MSG(CListCtrlEx)
49 afx_msg
void OnKeyDown( UINT nChar
, UINT nRepCnt
, UINT nFlags
);
55 CViewDialog
*_ViewDialog
;
58 /////////////////////////////////////////////////////////////////////////////
61 class CViewDialog
: public CDialog
65 CViewDialog(CWnd
* pParent
= NULL
); // standard constructor
68 //{{AFX_DATA(CViewDialog)
69 enum { IDD
= IDD_View
};
70 CListCtrlEx m_ListCtrl
;
74 /// Load, using the current filters
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;
87 void resizeView( int nbViews
, int top
, int left
);
92 /// Return the nb of lines
93 int getNbLines() const;
95 /// Return the nb of visible lines
96 int getNbVisibleLines() const;
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
);
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();
117 void scrollTo( int index
);
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
131 /// Scroll the listbox to the next found stored bookmkark (downwards from the current scroll index)
132 void recallNextBookmark();
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();
155 std::vector
<CString
> Filenames
;
156 std::vector
<CString
> PosFilter
, NegFilter
, PreviousPosFilter
, PreviousNegFilter
;
157 CString LogSessionStartDate
;
158 bool SessionDatePassed
;
159 std::vector
<CString
> Buffer
;
161 CFindReplaceDialog
*FindDialog
;
163 bool FindMatchCase
, FindDownwards
;
164 float WidthR
; // ratio to the app's client window
165 std::vector
<int> Bookmarks
;
169 // ClassWizard generated virtual function overrides
170 //{{AFX_VIRTUAL(CViewDialog)
172 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
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
);
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_)