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