2003-09-18 01:05:52 -04: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_
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2014-12-16 08:51:09 -05:00
|
|
|
// information
|
2003-09-18 01:05:52 -04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2004-05-25 07:20:37 -04:00
|
|
|
//! wxWidgets headers
|
2003-09-18 01:05:52 -04:00
|
|
|
|
2004-05-25 07:20:37 -04:00
|
|
|
//! wxWidgets/contrib headers
|
2005-09-16 14:25:44 -04:00
|
|
|
#include "wx/stc/stc.h" // styled text control
|
2003-09-18 01:05:52 -04: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 11:13:27 -04:00
|
|
|
Edit (wxWindow *parent, wxWindowID id = wxID_ANY,
|
2003-09-18 01:05:52 -04:00
|
|
|
const wxPoint &pos = wxDefaultPosition,
|
|
|
|
const wxSize &size = wxDefaultSize,
|
2010-09-30 07:44:45 -04:00
|
|
|
long style =
|
2007-10-22 04:13:51 -04:00
|
|
|
#ifndef __WXMAC__
|
|
|
|
wxSUNKEN_BORDER|
|
|
|
|
#endif
|
|
|
|
wxVSCROLL
|
2003-09-18 01:05:52 -04: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
|
2015-06-05 07:56:52 -04:00
|
|
|
void OnHighlightLang (wxCommandEvent &event);
|
2003-09-18 01:05:52 -04:00
|
|
|
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 15:46:16 -05:00
|
|
|
// annotations
|
|
|
|
void OnAnnotationAdd(wxCommandEvent& event);
|
|
|
|
void OnAnnotationRemove(wxCommandEvent& event);
|
|
|
|
void OnAnnotationClear(wxCommandEvent& event);
|
|
|
|
void OnAnnotationStyle(wxCommandEvent& event);
|
2003-09-18 01:05:52 -04:00
|
|
|
//! extra
|
|
|
|
void OnChangeCase (wxCommandEvent &event);
|
|
|
|
void OnConvertEOL (wxCommandEvent &event);
|
2014-05-05 10:42:29 -04:00
|
|
|
void OnMultipleSelections(wxCommandEvent& event);
|
|
|
|
void OnMultiPaste(wxCommandEvent& event);
|
|
|
|
void OnMultipleSelectionsTyping(wxCommandEvent& event);
|
2017-03-16 18:31:17 -04:00
|
|
|
void OnCustomPopup(wxCommandEvent& evt);
|
2020-05-31 17:42:33 -04:00
|
|
|
void OnTechnology(wxCommandEvent& event);
|
2003-09-18 01:05:52 -04:00
|
|
|
// stc
|
|
|
|
void OnMarginClick (wxStyledTextEvent &event);
|
|
|
|
void OnCharAdded (wxStyledTextEvent &event);
|
2019-03-10 20:08:13 -04:00
|
|
|
void OnCallTipClick(wxStyledTextEvent &event);
|
2003-09-18 01:05:52 -04:00
|
|
|
|
2013-12-28 22:22:24 -05:00
|
|
|
void OnKeyDown(wxKeyEvent &event);
|
|
|
|
|
2019-03-10 20:08:13 -04:00
|
|
|
// call tips
|
|
|
|
void ShowCallTipAt(int position);
|
|
|
|
|
2003-09-18 01:05:52 -04:00
|
|
|
//! language/lexer
|
|
|
|
wxString DeterminePrefs (const wxString &filename);
|
|
|
|
bool InitializePrefs (const wxString &filename);
|
2018-11-25 14:22:55 -05:00
|
|
|
LanguageInfo const* GetLanguageInfo () {return m_language;}
|
2003-09-18 01:05:52 -04:00
|
|
|
|
|
|
|
//! load/save file
|
|
|
|
bool LoadFile ();
|
|
|
|
bool LoadFile (const wxString &filename);
|
|
|
|
bool SaveFile ();
|
|
|
|
bool SaveFile (const wxString &filename);
|
|
|
|
bool Modified ();
|
2018-11-25 14:22:55 -05:00
|
|
|
wxString GetFilename () {return m_filename;}
|
|
|
|
void SetFilename (const wxString &filename) {m_filename = filename;}
|
2003-09-18 01:05:52 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
// file
|
|
|
|
wxString m_filename;
|
|
|
|
|
2014-12-16 08:51:09 -05:00
|
|
|
// language properties
|
2003-09-18 01:05:52 -04:00
|
|
|
LanguageInfo const* m_language;
|
|
|
|
|
|
|
|
// margin variables
|
|
|
|
int m_LineNrID;
|
|
|
|
int m_LineNrMargin;
|
|
|
|
int m_FoldingID;
|
|
|
|
int m_FoldingMargin;
|
|
|
|
int m_DividerID;
|
|
|
|
|
2019-03-10 20:08:13 -04:00
|
|
|
// call tip data
|
|
|
|
int m_calltipNo;
|
|
|
|
|
2014-03-30 03:07:55 -04:00
|
|
|
wxDECLARE_EVENT_TABLE();
|
2003-09-18 01:05:52 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//! EditProperties
|
|
|
|
class EditProperties: public wxDialog {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
//! constructor
|
|
|
|
EditProperties (Edit *edit, long style = 0);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2005-08-23 12:02:51 -04:00
|
|
|
#if wxUSE_PRINTING_ARCHITECTURE
|
|
|
|
|
2003-09-18 01:05:52 -04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//! EditPrint
|
|
|
|
class EditPrint: public wxPrintout {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
//! constructor
|
2018-09-28 21:45:15 -04:00
|
|
|
EditPrint (Edit *edit, const wxString& title = "");
|
2003-09-18 01:05:52 -04:00
|
|
|
|
|
|
|
//! event handlers
|
2017-05-25 17:30:52 -04:00
|
|
|
bool OnPrintPage (int page) wxOVERRIDE;
|
|
|
|
bool OnBeginDocument (int startPage, int endPage) wxOVERRIDE;
|
2003-09-18 01:05:52 -04:00
|
|
|
|
|
|
|
//! print functions
|
2017-05-25 17:30:52 -04:00
|
|
|
bool HasPage (int page) wxOVERRIDE;
|
|
|
|
void GetPageInfo (int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) wxOVERRIDE;
|
2003-09-18 01:05:52 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
Edit *m_edit;
|
2017-05-25 17:30:52 -04:00
|
|
|
wxArrayInt m_pageEnds;
|
2003-09-18 01:05:52 -04:00
|
|
|
wxRect m_pageRect;
|
|
|
|
wxRect m_printRect;
|
|
|
|
|
|
|
|
bool PrintScaling (wxDC *dc);
|
|
|
|
};
|
|
|
|
|
2005-08-23 12:02:51 -04:00
|
|
|
#endif // wxUSE_PRINTING_ARCHITECTURE
|
2003-09-18 01:05:52 -04:00
|
|
|
|
2005-08-23 12:02:51 -04:00
|
|
|
#endif // _EDIT_H_
|