1 ///////////////////////////////////////////////////////////////////////////////
2 // Name:        MadHighlightingDialog.h
3 // Description:
4 // Author:      madedit@gmail.com
5 // Licence:     GPL
6 ///////////////////////////////////////////////////////////////////////////////
7 
8 #ifndef _MADHIGHLIGHTINGDIALOG_H_
9 #define _MADHIGHLIGHTINGDIALOG_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/panel.h>
26 #include <wx/checkbox.h>
27 #include <wx/listctrl.h>
28 #include <wx/statline.h>
29 #include <wx/button.h>
30 #include <wx/combobox.h>
31 #include <wx/stattext.h>
32 #include <wx/listbox.h>
33 #include <wx/sizer.h>
34 ////Header Include End
35 
36 #include <vector>
37 using std::vector;
38 
39 //Compatibility for 2.4 code
40 #ifndef wxCLOSE_BOX
41 	#define wxCLOSE_BOX 0x1000
42 #endif
43 #ifndef wxFIXED_MINSIZE
44 	#define wxFIXED_MINSIZE 0
45 #endif
46 
47 ////Dialog Style Start
48 #undef MadHighlightingDialog_STYLE
49 #define MadHighlightingDialog_STYLE wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxMAXIMIZE_BOX | wxCLOSE_BOX
50 ////Dialog Style End
51 
52 class MadSyntax;
53 
54 class MadHighlightingDialog : public wxDialog
55 {
56 	private:
57 		DECLARE_EVENT_TABLE();
58 
59 	public:
60 		MadHighlightingDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Syntax Highlighting Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = MadHighlightingDialog_STYLE);
61 		virtual ~MadHighlightingDialog();
62 
63 	public:
64 		//Do not add custom control declarations
65 		//wxDev-C++ will remove them. Add custom code after the block.
66 		////GUI Control Declaration Start
67 		wxButton *WxButtonCancel;
68 		wxButton *WxButtonClose;
69 		wxBoxSizer *WxBoxSizer7;
70 		wxButton *WxButtonBC;
71 		wxListCtrl *WxListCtrlBC;
72 		wxPanel *WxPanelBC;
73 		wxStaticText *WxStaticTextBCName;
74 		wxStaticText *WxStaticText4;
75 		wxBoxSizer *WxBoxSizer12;
76 		wxStaticLine *WxStaticLine2;
77 		wxButton *WxButtonFC;
78 		wxListCtrl *WxListCtrlFC;
79 		wxPanel *WxPanelFC;
80 		wxStaticText *WxStaticTextFCName;
81 		wxStaticText *WxStaticText3;
82 		wxBoxSizer *WxBoxSizer11;
83 		wxBoxSizer *WxBoxSizer10;
84 		wxStaticLine *WxStaticLine3;
85 		wxCheckBox *WxCheckBoxUnderline;
86 		wxCheckBox *WxCheckBoxItalic;
87 		wxCheckBox *WxCheckBoxBold;
88 		wxBoxSizer *WxBoxSizer9;
89 		wxBoxSizer *WxBoxSizer8;
90 		wxListCtrl *WxListCtrlKeyword;
91 		wxBoxSizer *WxBoxSizer5;
92 		wxStaticLine *WxStaticLine1;
93 		wxButton *WxButtonDelete;
94 		wxButton *WxButtonSave;
95 		wxButton *WxButtonLoad;
96 		wxBoxSizer *WxBoxSizer6;
97 		wxStaticText *WxStaticText2;
98 		wxComboBox *WxComboBoxScheme;
99 		wxStaticText *WxStaticText1;
100 		wxBoxSizer *WxBoxSizer4;
101 		wxBoxSizer *WxBoxSizer3;
102 		wxBoxSizer *WxBoxSizer2;
103 		wxListBox *WxListBoxSyntax;
104 		wxBoxSizer *WxBoxSizer1;
105 		////GUI Control Declaration End
106 
107 	public:
108 		//Note: if you receive any error with these enum IDs, then you need to
109 		//change your old form code that are based on the #define control IDs.
110 		//#defines may replace a numeric value for the enum names.
111 		//Try copy and pasting the below block in your old form header files.
112 		enum
113 		{
114 			////GUI Enum Control ID Start
115 			ID_WXBUTTONBC = 1042,
116 			ID_WXLISTCTRLBC = 1041,
117 			ID_WXPANELBC = 1039,
118 			ID_WXSTATICTEXTBCNAME = 1038,
119 			ID_WXSTATICTEXT4 = 1037,
120 			ID_WXSTATICLINE2 = 1032,
121 			ID_WXBUTTONFC = 1036,
122 			ID_WXLISTCTRLFC = 1035,
123 			ID_WXPANELFC = 1034,
124 			ID_WXSTATICTEXTFCNAME = 1033,
125 			ID_WXSTATICTEXT3 = 1031,
126 			ID_WXSTATICLINE3 = 1044,
127 			ID_WXCHECKBOXUNDERLINE = 1030,
128 			ID_WXCHECKBOXITALIC = 1029,
129 			ID_WXCHECKBOXBOLD = 1028,
130 			ID_WXLISTCTRLKEYWORD = 1043,
131 			ID_WXSTATICLINE1 = 1006,
132 			ID_WXBUTTONDELETE = 1016,
133 			ID_WXBUTTONSAVE = 1014,
134 			ID_WXBUTTONLOAD = 1015,
135 			ID_WXSTATICTEXT2 = 1017,
136 			ID_WXCOMBOBOXSCHEME = 1010,
137 			ID_WXSTATICTEXT1 = 1009,
138 			ID_WXLISTBOXSYNTAX = 1021,
139 			////GUI Enum Control ID End
140 			ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
141 		}; //End of Enum
142 
143 	private:
144 		MadSyntax *m_Syntax;
145 		vector<MadSyntax*> m_ModifiedSyntax;
146 	public:
147 		wxString m_InitSetting; // the init title of madsyntax
148 		MadSyntax *GetSyntax(const wxString &title);
149 		void SetToModifiedSyntax(MadSyntax *syn);
150 		void SetAttrFC(const wxColor &color, const wxString &colorname);
151 		void SetAttrBC(const wxColor &color, const wxString &colorname);
152 		void RepaintKeyword();
153 		void FreeSyntax(bool restore);
154 		void SetPanelFC(const wxColor &color);
155 		void SetPanelBC(const wxColor &color);
156 	public:
157 		void MadHighlightingDialogClose(wxCloseEvent& event);
158 		void CreateGUIControls(void);
159 		void WxListBoxSyntaxSelected(wxCommandEvent& event);
160 		void WxListCtrlFCSelected(wxListEvent& event);
161 		void WxListCtrlBCSelected(wxListEvent& event);
162 		void WxListCtrlKeywordSelected(wxListEvent& event);
163 		void WxCheckBoxBoldClick(wxCommandEvent& event);
164 		void WxCheckBoxItalicClick(wxCommandEvent& event);
165 		void WxCheckBoxUnderlineClick(wxCommandEvent& event);
166 		void WxButtonFCClick(wxCommandEvent& event);
167 		void WxButtonBCClick(wxCommandEvent& event);
168 		void MadHighlightingDialogActivate(wxActivateEvent& event);
169 		void WxButtonLoadClick(wxCommandEvent& event);
170 		void WxButtonSaveClick(wxCommandEvent& event);
171 		void WxButtonDeleteClick(wxCommandEvent& event);
172 };
173 
174 extern MadHighlightingDialog *g_HighlightingDialog;
175 
176 #endif
177