1 /* 2 * Copyright 2005-2007 Gerald Schmidt. 3 * 4 * This file is part of Xml Copy Editor. 5 * 6 * Xml Copy Editor is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 9 * of the License, or (at your option) any later version. 10 * 11 * Xml Copy Editor is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with Xml Copy Editor; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 #ifndef FINDREPLACEPANEL_H 22 #define FINDREPLACEPANEL_H 23 24 #include <wx/wx.h> 25 #include <iostream> 26 #include <fstream> 27 28 class wxFindReplaceData; 29 30 enum 31 { 32 ID_FINDREPLACE_FIND_NEXT, 33 ID_FINDREPLACE_REPLACE, 34 ID_FINDREPLACE_REPLACE_ALL, 35 ID_FINDREPLACE_MATCH_CASE, 36 ID_FINDREPLACE_REGEX, 37 ID_FINDREPLACE_CLOSE 38 }; 39 40 class FindReplacePanel : public wxPanel 41 { 42 public: 43 FindReplacePanel ( 44 wxWindow *parent, 45 int id, 46 wxFindReplaceData *findDataParameter, 47 bool isReplacePanel = true, 48 bool isRegex = true ); 49 ~FindReplacePanel(); 50 void OnFindNext ( wxCommandEvent& event ); 51 void OnReplace ( wxCommandEvent& event ); 52 void OnReplaceAll ( wxCommandEvent& event ); 53 void OnClose ( wxCommandEvent& event ); 54 void focusOnFind(); 55 bool getIncrementalFind(); 56 bool getRegex(); 57 void refresh(); 58 void setReplaceVisible ( bool b ); 59 void setMatchCase ( bool b ); 60 void setRegex ( bool b ); 61 void flagNotFound ( bool b ); 62 void enableButtons ( bool b ); 63 private: 64 wxTextCtrl *findEdit, *replaceEdit; 65 wxStaticText *label1, *label2, *spacer1, *spacer2; 66 wxButton *findNextButton, *replaceButton, *replaceAllButton; 67 wxCheckBox *matchCaseBox, *regexBox; 68 wxFindReplaceData *findData; 69 wxBoxSizer *sizer; 70 wxWindow *parent; 71 size_t findEditLength; 72 bool matchCaseMemory, regexMemory; 73 bool incrementalFind, isReplaceDialog, notFoundSet, isRegex; 74 75 void OnCharHook ( wxKeyEvent& event ); 76 void OnIdle ( wxIdleEvent& event ); 77 void sendFindEvent ( size_t flags ); 78 79 DECLARE_EVENT_TABLE() 80 }; 81 82 #endif 83