]>
Commit | Line | Data |
---|---|---|
1 | ////////////////////////////////////////////////////////////////////////////// | |
2 | // File: edit.h | |
3 | // Purpose: STC test module | |
4 | // Maintainer: Wyo | |
5 | // Created: 2003-09-01 | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) wxGuide | |
8 | // Licence: wxWindows licence | |
9 | ////////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _EDIT_H_ | |
12 | #define _EDIT_H_ | |
13 | ||
14 | //---------------------------------------------------------------------------- | |
15 | // informations | |
16 | //---------------------------------------------------------------------------- | |
17 | ||
18 | ||
19 | //---------------------------------------------------------------------------- | |
20 | // headers | |
21 | //---------------------------------------------------------------------------- | |
22 | ||
23 | //! wxWidgets headers | |
24 | ||
25 | //! wxWidgets/contrib headers | |
26 | #include "wx/stc/stc.h" // styled text control | |
27 | ||
28 | //! application headers | |
29 | #include "prefs.h" // preferences | |
30 | ||
31 | ||
32 | //============================================================================ | |
33 | // declarations | |
34 | //============================================================================ | |
35 | ||
36 | class EditPrint; | |
37 | class EditProperties; | |
38 | ||
39 | ||
40 | //---------------------------------------------------------------------------- | |
41 | //! Edit | |
42 | class Edit: public wxStyledTextCtrl { | |
43 | friend class EditProperties; | |
44 | friend class EditPrint; | |
45 | ||
46 | public: | |
47 | //! constructor | |
48 | Edit (wxWindow *parent, wxWindowID id = wxID_ANY, | |
49 | const wxPoint &pos = wxDefaultPosition, | |
50 | const wxSize &size = wxDefaultSize, | |
51 | long style = wxSUNKEN_BORDER|wxVSCROLL | |
52 | ); | |
53 | ||
54 | //! destructor | |
55 | ~Edit (); | |
56 | ||
57 | // event handlers | |
58 | // common | |
59 | void OnSize( wxSizeEvent &event ); | |
60 | // edit | |
61 | void OnEditRedo (wxCommandEvent &event); | |
62 | void OnEditUndo (wxCommandEvent &event); | |
63 | void OnEditClear (wxCommandEvent &event); | |
64 | void OnEditCut (wxCommandEvent &event); | |
65 | void OnEditCopy (wxCommandEvent &event); | |
66 | void OnEditPaste (wxCommandEvent &event); | |
67 | // find | |
68 | void OnFind (wxCommandEvent &event); | |
69 | void OnFindNext (wxCommandEvent &event); | |
70 | void OnReplace (wxCommandEvent &event); | |
71 | void OnReplaceNext (wxCommandEvent &event); | |
72 | void OnBraceMatch (wxCommandEvent &event); | |
73 | void OnGoto (wxCommandEvent &event); | |
74 | void OnEditIndentInc (wxCommandEvent &event); | |
75 | void OnEditIndentRed (wxCommandEvent &event); | |
76 | void OnEditSelectAll (wxCommandEvent &event); | |
77 | void OnEditSelectLine (wxCommandEvent &event); | |
78 | //! view | |
79 | void OnHilightLang (wxCommandEvent &event); | |
80 | void OnDisplayEOL (wxCommandEvent &event); | |
81 | void OnIndentGuide (wxCommandEvent &event); | |
82 | void OnLineNumber (wxCommandEvent &event); | |
83 | void OnLongLineOn (wxCommandEvent &event); | |
84 | void OnWhiteSpace (wxCommandEvent &event); | |
85 | void OnFoldToggle (wxCommandEvent &event); | |
86 | void OnSetOverType (wxCommandEvent &event); | |
87 | void OnSetReadOnly (wxCommandEvent &event); | |
88 | void OnWrapmodeOn (wxCommandEvent &event); | |
89 | void OnUseCharset (wxCommandEvent &event); | |
90 | //! extra | |
91 | void OnChangeCase (wxCommandEvent &event); | |
92 | void OnConvertEOL (wxCommandEvent &event); | |
93 | // stc | |
94 | void OnMarginClick (wxStyledTextEvent &event); | |
95 | void OnCharAdded (wxStyledTextEvent &event); | |
96 | ||
97 | //! language/lexer | |
98 | wxString DeterminePrefs (const wxString &filename); | |
99 | bool InitializePrefs (const wxString &filename); | |
100 | bool UserSettings (const wxString &filename); | |
101 | LanguageInfo const* GetLanguageInfo () {return m_language;}; | |
102 | ||
103 | //! load/save file | |
104 | bool LoadFile (); | |
105 | bool LoadFile (const wxString &filename); | |
106 | bool SaveFile (); | |
107 | bool SaveFile (const wxString &filename); | |
108 | bool Modified (); | |
109 | wxString GetFilename () {return m_filename;}; | |
110 | void SetFilename (const wxString &filename) {m_filename = filename;}; | |
111 | ||
112 | private: | |
113 | // file | |
114 | wxString m_filename; | |
115 | ||
116 | // lanugage properties | |
117 | LanguageInfo const* m_language; | |
118 | ||
119 | // margin variables | |
120 | int m_LineNrID; | |
121 | int m_LineNrMargin; | |
122 | int m_FoldingID; | |
123 | int m_FoldingMargin; | |
124 | int m_DividerID; | |
125 | ||
126 | DECLARE_EVENT_TABLE() | |
127 | }; | |
128 | ||
129 | //---------------------------------------------------------------------------- | |
130 | //! EditProperties | |
131 | class EditProperties: public wxDialog { | |
132 | ||
133 | public: | |
134 | ||
135 | //! constructor | |
136 | EditProperties (Edit *edit, long style = 0); | |
137 | ||
138 | private: | |
139 | ||
140 | }; | |
141 | ||
142 | #if wxUSE_PRINTING_ARCHITECTURE | |
143 | ||
144 | //---------------------------------------------------------------------------- | |
145 | //! EditPrint | |
146 | class EditPrint: public wxPrintout { | |
147 | ||
148 | public: | |
149 | ||
150 | //! constructor | |
151 | EditPrint (Edit *edit, wxChar *title = _T("")); | |
152 | ||
153 | //! event handlers | |
154 | bool OnPrintPage (int page); | |
155 | bool OnBeginDocument (int startPage, int endPage); | |
156 | ||
157 | //! print functions | |
158 | bool HasPage (int page); | |
159 | void GetPageInfo (int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); | |
160 | ||
161 | private: | |
162 | Edit *m_edit; | |
163 | int m_printed; | |
164 | wxRect m_pageRect; | |
165 | wxRect m_printRect; | |
166 | ||
167 | bool PrintScaling (wxDC *dc); | |
168 | }; | |
169 | ||
170 | #endif // wxUSE_PRINTING_ARCHITECTURE | |
171 | ||
172 | #endif // _EDIT_H_ |