]>
Commit | Line | Data |
---|---|---|
88a8b04e RD |
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 | ||
be5a51fb | 23 | //! wxWidgets headers |
88a8b04e | 24 | |
be5a51fb | 25 | //! wxWidgets/contrib headers |
c40691a0 | 26 | #include "wx/stc/stc.h" // styled text control |
88a8b04e RD |
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 | |
7e126a07 | 48 | Edit (wxWindow *parent, wxWindowID id = wxID_ANY, |
88a8b04e RD |
49 | const wxPoint &pos = wxDefaultPosition, |
50 | const wxSize &size = wxDefaultSize, | |
ce00f59b | 51 | long style = |
bfa30135 SC |
52 | #ifndef __WXMAC__ |
53 | wxSUNKEN_BORDER| | |
54 | #endif | |
55 | wxVSCROLL | |
88a8b04e RD |
56 | ); |
57 | ||
58 | //! destructor | |
59 | ~Edit (); | |
60 | ||
61 | // event handlers | |
62 | // common | |
63 | void OnSize( wxSizeEvent &event ); | |
64 | // edit | |
65 | void OnEditRedo (wxCommandEvent &event); | |
66 | void OnEditUndo (wxCommandEvent &event); | |
67 | void OnEditClear (wxCommandEvent &event); | |
68 | void OnEditCut (wxCommandEvent &event); | |
69 | void OnEditCopy (wxCommandEvent &event); | |
70 | void OnEditPaste (wxCommandEvent &event); | |
71 | // find | |
72 | void OnFind (wxCommandEvent &event); | |
73 | void OnFindNext (wxCommandEvent &event); | |
74 | void OnReplace (wxCommandEvent &event); | |
75 | void OnReplaceNext (wxCommandEvent &event); | |
76 | void OnBraceMatch (wxCommandEvent &event); | |
77 | void OnGoto (wxCommandEvent &event); | |
78 | void OnEditIndentInc (wxCommandEvent &event); | |
79 | void OnEditIndentRed (wxCommandEvent &event); | |
80 | void OnEditSelectAll (wxCommandEvent &event); | |
81 | void OnEditSelectLine (wxCommandEvent &event); | |
82 | //! view | |
83 | void OnHilightLang (wxCommandEvent &event); | |
84 | void OnDisplayEOL (wxCommandEvent &event); | |
85 | void OnIndentGuide (wxCommandEvent &event); | |
86 | void OnLineNumber (wxCommandEvent &event); | |
87 | void OnLongLineOn (wxCommandEvent &event); | |
88 | void OnWhiteSpace (wxCommandEvent &event); | |
89 | void OnFoldToggle (wxCommandEvent &event); | |
90 | void OnSetOverType (wxCommandEvent &event); | |
91 | void OnSetReadOnly (wxCommandEvent &event); | |
92 | void OnWrapmodeOn (wxCommandEvent &event); | |
93 | void OnUseCharset (wxCommandEvent &event); | |
94 | //! extra | |
95 | void OnChangeCase (wxCommandEvent &event); | |
96 | void OnConvertEOL (wxCommandEvent &event); | |
97 | // stc | |
98 | void OnMarginClick (wxStyledTextEvent &event); | |
99 | void OnCharAdded (wxStyledTextEvent &event); | |
9e96e16f | 100 | void OnKey (wxStyledTextEvent &event); |
88a8b04e RD |
101 | |
102 | //! language/lexer | |
103 | wxString DeterminePrefs (const wxString &filename); | |
104 | bool InitializePrefs (const wxString &filename); | |
105 | bool UserSettings (const wxString &filename); | |
106 | LanguageInfo const* GetLanguageInfo () {return m_language;}; | |
107 | ||
108 | //! load/save file | |
109 | bool LoadFile (); | |
110 | bool LoadFile (const wxString &filename); | |
111 | bool SaveFile (); | |
112 | bool SaveFile (const wxString &filename); | |
113 | bool Modified (); | |
114 | wxString GetFilename () {return m_filename;}; | |
115 | void SetFilename (const wxString &filename) {m_filename = filename;}; | |
116 | ||
117 | private: | |
118 | // file | |
119 | wxString m_filename; | |
120 | ||
121 | // lanugage properties | |
122 | LanguageInfo const* m_language; | |
123 | ||
124 | // margin variables | |
125 | int m_LineNrID; | |
126 | int m_LineNrMargin; | |
127 | int m_FoldingID; | |
128 | int m_FoldingMargin; | |
129 | int m_DividerID; | |
130 | ||
131 | DECLARE_EVENT_TABLE() | |
132 | }; | |
133 | ||
134 | //---------------------------------------------------------------------------- | |
135 | //! EditProperties | |
136 | class EditProperties: public wxDialog { | |
137 | ||
138 | public: | |
139 | ||
140 | //! constructor | |
141 | EditProperties (Edit *edit, long style = 0); | |
142 | ||
143 | private: | |
144 | ||
145 | }; | |
146 | ||
c54e5eb0 WS |
147 | #if wxUSE_PRINTING_ARCHITECTURE |
148 | ||
88a8b04e RD |
149 | //---------------------------------------------------------------------------- |
150 | //! EditPrint | |
151 | class EditPrint: public wxPrintout { | |
152 | ||
153 | public: | |
154 | ||
155 | //! constructor | |
9a83f860 | 156 | EditPrint (Edit *edit, const wxChar *title = wxT("")); |
88a8b04e RD |
157 | |
158 | //! event handlers | |
159 | bool OnPrintPage (int page); | |
160 | bool OnBeginDocument (int startPage, int endPage); | |
161 | ||
162 | //! print functions | |
163 | bool HasPage (int page); | |
164 | void GetPageInfo (int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); | |
165 | ||
166 | private: | |
167 | Edit *m_edit; | |
168 | int m_printed; | |
169 | wxRect m_pageRect; | |
170 | wxRect m_printRect; | |
171 | ||
172 | bool PrintScaling (wxDC *dc); | |
173 | }; | |
174 | ||
c54e5eb0 | 175 | #endif // wxUSE_PRINTING_ARCHITECTURE |
88a8b04e | 176 | |
c54e5eb0 | 177 | #endif // _EDIT_H_ |