2003-09-18 05:05:52 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// 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
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2004-05-25 11:20:37 +00:00
|
|
|
//! wxWidgets headers
|
2003-09-18 05:05:52 +00:00
|
|
|
|
2004-05-25 11:20:37 +00:00
|
|
|
//! wxWidgets/contrib headers
|
2005-09-16 18:25:44 +00:00
|
|
|
#include "wx/stc/stc.h" // styled text control
|
2003-09-18 05:05:52 +00:00
|
|
|
|
|
|
|
//! application headers
|
|
|
|
#include "prefs.h" // preferences
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
// declarations
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
class EditPrint;
|
|
|
|
class EditProperties;
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//! Edit
|
|
|
|
class Edit: public wxStyledTextCtrl {
|
|
|
|
friend class EditProperties;
|
|
|
|
friend class EditPrint;
|
|
|
|
|
|
|
|
public:
|
|
|
|
//! constructor
|
2004-09-28 15:13:27 +00:00
|
|
|
Edit (wxWindow *parent, wxWindowID id = wxID_ANY,
|
2003-09-18 05:05:52 +00:00
|
|
|
const wxPoint &pos = wxDefaultPosition,
|
|
|
|
const wxSize &size = wxDefaultSize,
|
2010-09-30 11:44:45 +00:00
|
|
|
long style =
|
2007-10-22 08:13:51 +00:00
|
|
|
#ifndef __WXMAC__
|
|
|
|
wxSUNKEN_BORDER|
|
|
|
|
#endif
|
|
|
|
wxVSCROLL
|
2003-09-18 05:05:52 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
//! 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);
|
2013-02-05 20:46:16 +00:00
|
|
|
// annotations
|
|
|
|
void OnAnnotationAdd(wxCommandEvent& event);
|
|
|
|
void OnAnnotationRemove(wxCommandEvent& event);
|
|
|
|
void OnAnnotationClear(wxCommandEvent& event);
|
|
|
|
void OnAnnotationStyle(wxCommandEvent& event);
|
2003-09-18 05:05:52 +00:00
|
|
|
//! extra
|
|
|
|
void OnChangeCase (wxCommandEvent &event);
|
|
|
|
void OnConvertEOL (wxCommandEvent &event);
|
|
|
|
// stc
|
|
|
|
void OnMarginClick (wxStyledTextEvent &event);
|
|
|
|
void OnCharAdded (wxStyledTextEvent &event);
|
2010-03-30 03:50:06 +00:00
|
|
|
void OnKey (wxStyledTextEvent &event);
|
2003-09-18 05:05:52 +00:00
|
|
|
|
|
|
|
//! 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;
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//! EditProperties
|
|
|
|
class EditProperties: public wxDialog {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
//! constructor
|
|
|
|
EditProperties (Edit *edit, long style = 0);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2005-08-23 16:02:51 +00:00
|
|
|
#if wxUSE_PRINTING_ARCHITECTURE
|
|
|
|
|
2003-09-18 05:05:52 +00:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//! EditPrint
|
|
|
|
class EditPrint: public wxPrintout {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
//! constructor
|
2009-07-23 20:30:22 +00:00
|
|
|
EditPrint (Edit *edit, const wxChar *title = wxT(""));
|
2003-09-18 05:05:52 +00:00
|
|
|
|
|
|
|
//! 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);
|
|
|
|
};
|
|
|
|
|
2005-08-23 16:02:51 +00:00
|
|
|
#endif // wxUSE_PRINTING_ARCHITECTURE
|
2003-09-18 05:05:52 +00:00
|
|
|
|
2005-08-23 16:02:51 +00:00
|
|
|
#endif // _EDIT_H_
|