]>
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, | |
bfa30135 SC |
51 | long style = |
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); | |
100 | ||
101 | //! language/lexer | |
102 | wxString DeterminePrefs (const wxString &filename); | |
103 | bool InitializePrefs (const wxString &filename); | |
104 | bool UserSettings (const wxString &filename); | |
105 | LanguageInfo const* GetLanguageInfo () {return m_language;}; | |
106 | ||
107 | //! load/save file | |
108 | bool LoadFile (); | |
109 | bool LoadFile (const wxString &filename); | |
110 | bool SaveFile (); | |
111 | bool SaveFile (const wxString &filename); | |
112 | bool Modified (); | |
113 | wxString GetFilename () {return m_filename;}; | |
114 | void SetFilename (const wxString &filename) {m_filename = filename;}; | |
115 | ||
116 | private: | |
117 | // file | |
118 | wxString m_filename; | |
119 | ||
120 | // lanugage properties | |
121 | LanguageInfo const* m_language; | |
122 | ||
123 | // margin variables | |
124 | int m_LineNrID; | |
125 | int m_LineNrMargin; | |
126 | int m_FoldingID; | |
127 | int m_FoldingMargin; | |
128 | int m_DividerID; | |
129 | ||
130 | DECLARE_EVENT_TABLE() | |
131 | }; | |
132 | ||
133 | //---------------------------------------------------------------------------- | |
134 | //! EditProperties | |
135 | class EditProperties: public wxDialog { | |
136 | ||
137 | public: | |
138 | ||
139 | //! constructor | |
140 | EditProperties (Edit *edit, long style = 0); | |
141 | ||
142 | private: | |
143 | ||
144 | }; | |
145 | ||
c54e5eb0 WS |
146 | #if wxUSE_PRINTING_ARCHITECTURE |
147 | ||
88a8b04e RD |
148 | //---------------------------------------------------------------------------- |
149 | //! EditPrint | |
150 | class EditPrint: public wxPrintout { | |
151 | ||
152 | public: | |
153 | ||
154 | //! constructor | |
522a028a | 155 | EditPrint (Edit *edit, const wxChar *title = _T("")); |
88a8b04e RD |
156 | |
157 | //! event handlers | |
158 | bool OnPrintPage (int page); | |
159 | bool OnBeginDocument (int startPage, int endPage); | |
160 | ||
161 | //! print functions | |
162 | bool HasPage (int page); | |
163 | void GetPageInfo (int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); | |
164 | ||
165 | private: | |
166 | Edit *m_edit; | |
167 | int m_printed; | |
168 | wxRect m_pageRect; | |
169 | wxRect m_printRect; | |
170 | ||
171 | bool PrintScaling (wxDC *dc); | |
172 | }; | |
173 | ||
c54e5eb0 | 174 | #endif // wxUSE_PRINTING_ARCHITECTURE |
88a8b04e | 175 | |
c54e5eb0 | 176 | #endif // _EDIT_H_ |