-
Notifications
You must be signed in to change notification settings - Fork 0
/
quregexmm.h
116 lines (97 loc) · 3.03 KB
/
quregexmm.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
/*
Quantum Quinn (Christopher Bess)
<cbess@quantumquinn.com>
Copyright (C) 2006, 2007 Christopher Bess of Quantum Quinn
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _QUREGEXMM_H_
#define _QUREGEXMM_H_
/**
* @short Application Main Window
* @author Quantum Quinn <cbess@QuantumQuinn.com>
* @version 0.7
*/
class QuRegexStorageDia;
class wxSpinCtrl;
class wxSpinEvent;
class wxPCRE;
class wxRegEx;
const int PCRE_DEFAULT = 0;
class QuRegExmmapp : public wxApp
{
public:
virtual bool OnInit();
};
class QuRegExmmFrame : public wxFrame
{
public:
QuRegExmmFrame();
void InitializeFrame();
void SetRegex( wxString str );
inline bool UsePCRELib() const
{ return mUsePCRELib; }
private:
void CreateControls();
void CreateMenuBar();
void NextHighlightStyle(); // moves to the next highlighted match color
// UI vars
wxTextCtrl *txtRegex;
wxTextCtrl *txtSource;
wxCheckBox *chkMatch;
wxCheckBox *chkIgnoreCase;
wxCheckBox *chkMultiline;
wxSpinCtrl *udSubexpression;
wxTextCtrl *txtSubexpression;
wxSplitterWindow *splMain;
QuRegexStorageDia * regexDia;
// regular expression lib vars
wxPCRE *mPCRE;
wxRegEx *mRegEx;
// vars
bool mUsePCRELib;
wxTextAttr mTextAttr;
wxTextAttr mDefaultTextAttr;
wxColour mYellowColour;
wxColour mBrownColour;
wxColour mGoldColour; // not used on win32
int mCurrentHighlightColorIndex;
// match methods
void FindMatch();
bool wxPCRE_Match( const wxString& pattern, wxString& source, int flags, size_t * count, int * subCount );
bool wxRegEx_Match( const wxString& pattern, wxString& source, int flags, size_t * count, int * subCount );
// event handlers
void OnQuit( wxCommandEvent& event );
void OnAbout( wxCommandEvent& event );
void OnBtMatchClick( wxCommandEvent & evt );
void txtRegex_OnTextChange( wxCommandEvent & evt );
void OnRegexStorage( wxCommandEvent & evt );
void txtRegex_KeyDown( wxKeyEvent & evt );
void OnSubexpressionChanged( wxSpinEvent& evt );
void OnLoadSession( wxCommandEvent& evt );
void OnSaveSession( wxCommandEvent& evt );
void OnRegexLibSelect( wxCommandEvent& evt );
private:
DECLARE_EVENT_TABLE()
};
enum
{
Menu_File_About = wxID_ABOUT,
Menu_File_Quit = wxID_EXIT,
Menu_File_AppName = 100,
Menu_File_RegexStorage,
Menu_Session_SaveSession,
Menu_Session_LoadSession,
Menu_Regex_wxPCRE,
Menu_Regex_wxRegEx
};
#endif // _QUREGEXMM_H_