1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3  * http://www.gnu.org/licenses/gpl-3.0.html
4  */
5 
6 #ifndef FRAME_H
7 #define FRAME_H
8 
9 #include "nativeparser_test.h"
10 
11 
12 //(*Headers(CCTestFrame)
13 #include "wx/wxscintilla.h"
14 #include <wx/button.h>
15 #include <wx/checkbox.h>
16 #include <wx/filedlg.h>
17 #include <wx/frame.h>
18 #include <wx/menu.h>
19 #include <wx/notebook.h>
20 #include <wx/panel.h>
21 #include <wx/sizer.h>
22 #include <wx/stattext.h>
23 #include <wx/statusbr.h>
24 #include <wx/textctrl.h>
25 //*)
26 
27 #include <wx/fdrepdlg.h>
28 
29 class wxProgressDialog;
30 
31 class CCTestFrame : public wxFrame
32 {
33 public:
34     CCTestFrame(const wxString& main_file);
35     virtual ~CCTestFrame();
36 
37     void AppendToLog(const wxString& log);
38 
39     // copy the include search paths and macro replacement rules to the Parser
40     // and run the cctest in each file. (currently the file has cc_*.cpp or ccc_*.cpp)
41     void Start();
42 
43 protected:
44     //(*Identifiers(CCTestFrame)
45     static const long ID_CHK_HIDE;
46     static const long wxID_TEST_SINGLE;
47     static const long wxID_PARSE;
48     static const long wxID_PRINT_TREE;
49     static const long wxID_SAVE_TEST_RESULT;
50     static const long wxID_TOKEN;
51     //*)
52 
53 private:
54     // initialize the wxScintilla control
55     void InitControl();
56     // load the source file content to wxScintilla control
57     void LoadToControl();
58     void SetMarkerStyle(int marker, int markerType, wxColor fore, wxColor back);
59 
60     //(*Handlers(CCTestFrame)
61     void OnMenuQuitSelected(wxCommandEvent& event);
62     void OnMenuSaveSelected(wxCommandEvent& event);
63     void OnMenuOpenSelected(wxCommandEvent& event);
64     void OnMenuFindSelected(wxCommandEvent& event);
65     void OnMenuReparseSelected(wxCommandEvent& event);
66     void OnMenuTokenSelected(wxCommandEvent& event);
67     void OnMenuAboutSelected(wxCommandEvent& event);
68     void OnParse(wxCommandEvent& event);
69     void OnPrintTree(wxCommandEvent& event);
70     void OnTestSingle(wxCommandEvent& event);
71     void OnSaveTestResultClick(wxCommandEvent& event);
72     //*)
73 
74     void OnMarginClick(wxScintillaEvent& event);
75     void OnFindDialog(wxFindDialogEvent& event);
76     void OnCCLogger(wxCommandEvent& event);
77     void OnCCAddToken(wxCommandEvent& event);
78 
79 
80     //(*Declarations(CCTestFrame)
81     wxButton* btnParse;
82     wxButton* btnPrintTree;
83     wxButton* btnSaveTestResult;
84     wxButton* btnTestSingle;
85     wxCheckBox* m_DoHideCtrl;
86     wxCheckBox* m_DoTreeCtrl;
87     wxFileDialog* m_OpenFile;
88     wxFileDialog* m_SaveFile;
89     wxNotebook* m_ParserCtrl;
90     wxPanel* panCompletionTest;
91     wxScintilla* m_Control;
92     wxStatusBar* m_StatuBar;
93     wxTextCtrl* m_CompletionTestCtrl;
94     wxTextCtrl* m_IncludeCtrl;
95     wxTextCtrl* m_LogCtrl;
96     wxTextCtrl* m_TreeCtrl;
97     //*)
98 
99     wxProgressDialog*    m_ProgDlg;
100     // the source file going to parse
101     wxString             m_MainFile;
102     wxString             m_CurrentFile;
103     size_t               m_LogCount;
104 
105     wxFindReplaceData    m_FRData;
106     wxFindReplaceDialog* m_FRDlg;
107     int                  m_LastIndex;
108 
109     /** main testing class, derived from NativeParserBase class */
110     NativeParserTest m_NativeParser;
111 
112     DECLARE_EVENT_TABLE()
113 };
114 
115 #endif
116