1 ///////////////////////////////////////////////////////////////////////////////
2 // Name:        MadFindInFilesDialog.h
3 // Description: find or replace in files dialog
4 // Author:      madedit@gmail.com
5 // Licence:     GPL
6 ///////////////////////////////////////////////////////////////////////////////
7 
8 #ifndef _MADFINDINFILESDIALOG_H_
9 #define _MADFINDINFILESDIALOG_H_
10 
11 #ifdef __BORLANDC__
12 	#pragma hdrstop
13 #endif
14 
15 #ifndef WX_PRECOMP
16 	#include <wx/wx.h>
17 	#include <wx/dialog.h>
18 #else
19 	#include <wx/wxprec.h>
20 #endif
21 
22 //Do not add custom headers
23 //wxDev-C++ designer will remove them
24 ////Header Include Start
25 #include <wx/stattext.h>
26 #include <wx/combobox.h>
27 #include <wx/radiobut.h>
28 #include <wx/statline.h>
29 #include <wx/button.h>
30 #include <wx/checkbox.h>
31 #include <wx/sizer.h>
32 ////Header Include End
33 
34 #include <wx/docview.h>
35 #include <wx/fileconf.h>
36 
37 //Compatibility for 2.4 code
38 #ifndef wxCLOSE_BOX
39 	#define wxCLOSE_BOX 0x1000
40 #endif
41 #ifndef wxFIXED_MINSIZE
42 	#define wxFIXED_MINSIZE 0
43 #endif
44 
45 ////Dialog Style Start
46 #undef MadFindInFilesDialog_STYLE
47 #define MadFindInFilesDialog_STYLE wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
48 ////Dialog Style End
49 
50 class MadEdit;
51 
52 class MadFindInFilesDialog : public wxDialog
53 {
54 	private:
55 		DECLARE_EVENT_TABLE();
56 
57 	public:
58 		MadFindInFilesDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Find/Replace in Files"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = MadFindInFilesDialog_STYLE);
59 		virtual ~MadFindInFilesDialog();
60 
61 	public:
62 		//Do not add custom control declarations
63 		//wxDev-C++ will remove them. Add custom code after the block.
64 		////GUI Control Declaration Start
65 		wxCheckBox *WxCheckBoxSubDir;
66 		wxComboBox *WxComboBoxEncoding;
67 		wxStaticText *WxStaticText3;
68 		wxStaticText *WxStaticText7;
69 		wxStaticText *WxStaticText6;
70 		wxComboBox *WxComboBoxExclude;
71 		wxStaticText *WxStaticText4;
72 		wxStaticText *WxStaticText5;
73 		wxStaticText *WxStaticText2;
74 		wxComboBox *WxComboBoxFilter;
75 		wxStaticText *WxStaticText1;
76 		wxButton *WxButtonActiveDir;
77 		wxButton *WxButtonDir;
78 		wxComboBox *WxComboBoxDir;
79 		wxRadioButton *WxRadioButtonDir;
80 		wxFlexGridSizer *WxFlexGridSizer1;
81 		wxRadioButton *WxRadioButtonOpenedFiles;
82 		wxBoxSizer *WxBoxSizer3;
83 		wxStaticLine *WxStaticLine1;
84 		wxButton *WxButtonClose;
85 		wxCheckBox *WxCheckBoxEnableReplace;
86 		wxButton *WxButtonReplace;
87 		wxButton *WxButtonFind;
88 		wxBoxSizer *WxBoxSizer5;
89 		wxCheckBox *WxCheckBoxListFirstOnly;
90 		wxCheckBox *WxCheckBoxFindHex;
91 		wxCheckBox *WxCheckBoxRegex;
92 		wxCheckBox *WxCheckBoxWholeWord;
93 		wxCheckBox *WxCheckBoxCaseSensitive;
94 		wxBoxSizer *WxBoxSizer8;
95 		wxBoxSizer *WxBoxSizer7;
96 		wxBoxSizer *WxBoxSizer6;
97 		wxBoxSizer *WxBoxSizer4;
98 		wxBoxSizer *WxBoxSizer2;
99 		wxBoxSizer *WxBoxSizer1;
100 		////GUI Control Declaration End
101 
102 	public:
103 		//Note: if you receive any error with these enum IDs, then you need to
104 		//change your old form code that are based on the #define control IDs.
105 		//#defines may replace a numeric value for the enum names.
106 		//Try copy and pasting the below block in your old form header files.
107 		enum
108 		{
109 			////GUI Enum Control ID Start
110 			ID_WXCHECKBOXSUBDIR = 1038,
111 			ID_WXCOMBOBOXENCODING = 1042,
112 			ID_WXSTATICTEXT3 = 1041,
113 			ID_WXSTATICTEXT7 = 1049,
114 			ID_WXSTATICTEXT6 = 1048,
115 			ID_WXCOMBOBOXEXCLUDE = 1050,
116 			ID_WXSTATICTEXT4 = 1046,
117 			ID_WXSTATICTEXT5 = 1047,
118 			ID_WXSTATICTEXT2 = 1040,
119 			ID_WXCOMBOBOXFILTER = 1037,
120 			ID_WXSTATICTEXT1 = 1036,
121 			ID_WXBUTTONACTIVEDIR = 1045,
122 			ID_WXBUTTONDIR = 1035,
123 			ID_WXCOMBOBOXDIR = 1034,
124 			ID_WXRADIOBUTTONDIR = 1033,
125 			ID_WXRADIOBUTTONOPENEDFILES = 1031,
126 			ID_WXSTATICLINE1 = 1029,
127 			ID_WXCHECKBOXENABLEREPLACE = 1044,
128 			ID_WXBUTTONREPLACE = 1023,
129 			ID_WXBUTTONFIND = 1022,
130 			ID_WXCHECKBOXLISTFIRSTONLY = 1043,
131 			ID_WXCHECKBOXFINDHEX = 1018,
132 			ID_WXCHECKBOXREGEX = 1017,
133 			ID_WXCHECKBOXWHOLEWORD = 1016,
134 			ID_WXCHECKBOXCASESENSITIVE = 1015,
135 			////GUI Enum Control ID End
136 			ID_MADEDIT1 = 1400,
137 			ID_MADEDIT2 = 1401,
138 			ID_WXBITMAPBUTTONRECENTFINDTEXT=1402,
139 			ID_WXBITMAPBUTTONRECENTREPLACETEXT=1403,
140 			ID_RECENTFINDTEXT1=1501,    // must be the same with MadSearchDialog
141 			ID_RECENTFINDTEXT20=1520,
142 			ID_RECENTREPLACETEXT1=ID_RECENTFINDTEXT20+1,
143 			ID_RECENTREPLACETEXT20=ID_RECENTREPLACETEXT1+19,
144 
145 			ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
146 		}; //End of Enum
147 
148 	public:
149 		MadEdit *m_FindText, *m_ReplaceText;
150 		wxBitmapButton *WxBitmapButtonRecentFindText, *WxBitmapButtonRecentReplaceText;
151 		wxFileHistory *m_RecentFindDir;
152 		wxFileHistory *m_RecentFindFilter, *m_RecentFindExclude;
153 		void UpdateCheckBoxByCBHex(bool check);
154 		void WxBitmapButtonRecentFindTextClick(wxCommandEvent& event);
155 		void WxBitmapButtonRecentReplaceTextClick(wxCommandEvent& event);
156 		void OnRecentFindText(wxCommandEvent& event);
157 		void OnRecentReplaceText(wxCommandEvent& event);
158 		void FindReplaceInFiles(bool bReplace);//false: find; true: replace
159 	public:
160 		void MadFindInFilesDialogClose(wxCloseEvent& event);
161 		void CreateGUIControls(void);
162 		void WxCheckBoxFindHexClick(wxCommandEvent& event);
163 		void WxButtonFindClick(wxCommandEvent& event);
164 		void WxButtonReplaceClick(wxCommandEvent& event);
165 		void WxButtonDirClick(wxCommandEvent& event);
166 		void MadFindInFilesDialogActivate(wxActivateEvent& event);
167 		void WxCheckBoxEnableReplaceClick(wxCommandEvent& event);
168 		void WxButtonActiveDirClick(wxCommandEvent& event);
169 };
170 
171 extern MadFindInFilesDialog *g_FindInFilesDialog;
172 
173 #endif
174