class SECEditController: public MvcController, public ISECEditPresentationState, public ISECEditFindReplaceNotify
The SECEditController class manages the SECEdit data model, and also communicates with the SECEditViewport-derived viewport. The controller class listens for user driven events, and manipulates the model and viewport accordingly. All user events are processed through handlers in the controller, which is plugged into the viewport window.
Defined in: SECEditController.h
EDIT_API SECEditController()
Constructs an SECEditController object.
EDIT_API virtual BOOL Create(CWnd* pWnd, sfl::MvcVisualComponent* pComp)
Creates the controller on the specified visual component.
EDIT_API virtual void Init()
Initializes the controller object.
EDIT_API virtual ~SECEditController()
Default Destructor
EDIT_API virtual BOOL GetColumnSelect() const
Queries whether the current selection, if any, is a column selection.
EDIT_API virtual BOOL GetSelection(SECEditLineColPair& lcpSel, BOOL bAllowVWS = FALSE) const
Retrieves the line/column coordinates for the current selection.
EDIT_API virtual BOOL GetSelection(int& nStartLine, int& nStartCol, int& nEndLine, int& nEndCol, BOOL bAllowVWS = FALSE) const
Retrieves the starting and ending positions of the current selection.
EDIT_API virtual SECEditSelectionType GetSelectionType() const
Returns the type of the current selection.
EDIT_API virtual BOOL IsSelecting() const
Queries whether text is currently selected.
EDIT_API virtual BOOL GetColumnSelectInProgress(CRect& rcSelect) const
Returns the rect in logical coordinates of the column select in progress
EDIT_API virtual BOOL GetShowSelAlways() const
Does this view show selection always instead of only when its view has focus
EDIT_API virtual BOOL GetSelectColumns(int nLine, int& nStartCol, int &nEndCol) const
Retrieves the starting and ending columns of the current selection.
EDIT_API virtual _SEC_FIND_REPLACE_STATE* GetFindReplaceState() const
Retrieves the global find/replace state information.
EDIT_API virtual int GetGutterWidth() const
Returns the width of the gutter on the left side of the viewport.
EDIT_API virtual void SetGutterWidth(int nWidth)
Sets the Width for Gutter (only the mark section)
EDIT_API virtual int GetGutterIndexWidth() const
Returns the Width of the Index Section
EDIT_API virtual void SetGutterIndexWidth(int nWidth = -1)
Sets the Width of the Index Section, -1 forces it to be calculated automaticlly
EDIT_API virtual UINT GetGutterAlignment() const
Returns the Alignment for Gutter area
EDIT_API virtual void SetGutterAlignment(UINT nAlign)
Sets the Alignment for Gutter area
EDIT_API virtual int GetGutterMarkWidth() const
Returns the Width for Mark Area
EDIT_API virtual int GetGutterIndexDigits() const
Returns amount of index digits to be displayed
EDIT_API virtual void SetGutterIndexDigits(int nDigits = -1)
Sets amount of index digits, -1 cause it to be calculated automaticlly
inline virtual COLORREF GetGutterIndexColor()
Returns the color used in Index
inline virtual void SetGutterIndexColor(COLORREF rgb)
Sets the Color for Gutter Index
inline virtual SECEditFontInfo* GetGutterIndexFont() const
Returns the font info for Index text
EDIT_API virtual void UpdateGutterIndexFont()
Called after m_pGutterIndexFont is modified
EDIT_API virtual CString GetGutterIndexText(int nLine) const
Returns the string to be displayed as index
EDIT_API virtual CPoint LineColToPoint(SECEditLineCol& lc, CDC* pDC) const
Converts the given line and column coordinates into a logical point.
EDIT_API virtual CPoint LineColToPoint(SECEditLineCol& lc) const
Converts the given line and column coordinates into a logical point.
EDIT_API virtual SECEditLineCol PointToLineCol(CPoint& pt, CDC* pDC, BOOL bPreceedTab = TRUE) const
Converts a logical point to a line and column coordinate.
EDIT_API virtual SECEditLineCol PointToLineCol(CPoint& pt, BOOL bPreceedTab = TRUE) const
Converts a logical point to a line and column coordinate.
EDIT_API BOOL BackTab()
Moves the caret back one tab.
EDIT_API void CharLeft()
Moves the cursor one character to the left.
EDIT_API void CharLeftExtend()
Extends the selection one character to the left.
EDIT_API void CharRight()
Moves the cursor one character to the right.
EDIT_API void CharRightExtend()
Extends the selection one character to the right.
EDIT_API void DocumentStart()
Moves to the beginning of the document.
EDIT_API void DocumentStartExtend()
Extends the selection to the beginning of the document.
EDIT_API void DocumentEnd()
Moves to the end of the document.
EDIT_API void DocumentEndExtend()
Extends the selection to the end of the document.
EDIT_API void Home()
Moves to the start of the line, or to the first character on the line.
EDIT_API void HomeExtend()
Extends the selection to the start of the line, or the first character on the line.
EDIT_API void WordLeft()
Moves back one word.
EDIT_API void WordLeftExtend()
Extends the selection back one word.
EDIT_API void WordRight()
Moves forward one word.
EDIT_API void WordRightExtend()
Extends the selection forward one word.
EDIT_API void LineDown()
Moves down one line.
EDIT_API void LineDownExtend()
Extends the selection down one line.
EDIT_API void LineEnd()
Moves to the end of the current line.
EDIT_API void LineEndExtend()
Extends the selection to the end of the current line.
EDIT_API void LineUp()
Moves up one line.
EDIT_API void LineUpExtend()
Extends the selection up one line.
EDIT_API void PageDown()
Moves down one page.
EDIT_API void PageDownExtend()
Extends the selection down one page.
EDIT_API void PageUp()
Moves up one page.
EDIT_API void PageUpExtend()
Extends the selection up one page.
EDIT_API SECEditLineCol GetLCLineUp(const SECEditLineCol& lc) const
Returns the character coordinates above lc
EDIT_API SECEditLineCol GetLCLineDown(const SECEditLineCol& lc) const
Returns the character coordinates below lc
EDIT_API SECEditLineCol GetLCCharLeft(const SECEditLineCol& lc) const
Returns the coordinates of the character immediately left of lc
EDIT_API SECEditLineCol GetLCCharRight(const SECEditLineCol& lc) const
Returns the coordinates of the character immediately right of lc
EDIT_API SECEditLineCol GetLCWordLeft(const SECEditLineCol& lc, BOOL bExtraSpace = FALSE) const
Returns the coordinates of the start of the word immediately left of lc
EDIT_API SECEditLineCol GetLCWordRight(const SECEditLineCol& lc, BOOL bExtraSpace = FALSE) const
Returns the coordinates of the start of the word immediately right of lc
EDIT_API void CaretUp()
Moves the caret up one line.
EDIT_API void CaretDown()
Moves the caret down one line.
EDIT_API void CaretLeft()
Moves the caret one character to the left.
EDIT_API void CaretRight()
Moves the caret one character to the right.
EDIT_API void CaretHome()
Moves the caret to the start of the current line or to the first character on that line.
EDIT_API void CaretEnd()
Moves the caret to either the end of the current line.
EDIT_API void CaretPageUp()
Moves the caret one page up.
EDIT_API void CaretPageDown()
Moves the caret one page down.
EDIT_API void CaretDocHome()
Moves the caret to the beginning of the document.
EDIT_API void CaretDocEnd()
Moves the caret to the end of the document.
EDIT_API virtual void InvokeCaret(BOOL bSolid = TRUE)
Creates a caret for the viewport
EDIT_API virtual void RevokeCaret()
Destroys the caret.
EDIT_API virtual void MoveCaret(int nLine, int nCol, BOOL bVirtual = FALSE)
Moves the caret to a logical screen point.
EDIT_API virtual void MoveCaret(CPoint pt, BOOL bVirtual = FALSE)
Moves the caret to the line and column position given.
EDIT_API virtual void MakeCaretVisible()
Helper method for making the caret visible.
EDIT_API virtual BOOL UpdateCaretPosFromCmd(SECEditCommand* pCmd)
Updates the current caret position based on the given command.
EDIT_API void FindNextWord()
Finds the next occurance of the selected text.
EDIT_API void FindNext()
Finds the next occurance of the specified text.
EDIT_API void FindPrevWord()
Finds the previous occurrance of the selected text.
EDIT_API void FindPrev()
Finds the previous occurrance of the specified text.
EDIT_API virtual BOOL NeedFindForReplace(_SEC_FIND_REPLACE_STATE* pState)
Queries whether a find opeation needs to take place before a replace operation can occur.
EDIT_API virtual BOOL SECEditFindReplaceNotifyMsg(SECEditFindReplaceDlg* pFindReplaceDlg)
Called to communicate that an action needs to be peformed.
EDIT_API virtual void ShowFindReplaceDlg(BOOL bFindDialogOnly)
Displays the find/replace dialog.
EDIT_API virtual DROPEFFECT DoDragDrop()
Performs a drag drop operation.
EDIT_API virtual DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
Called when the cursor first enters the window.
EDIT_API virtual void OnDragLeave()
Called when the cursor is dragged out of the window.
EDIT_API virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
Called repeatedly when the cursor is dragged over the window.
EDIT_API virtual BOOL OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
Called when data is dropped into the window.
EDIT_API virtual BOOL GetOleText(COleDataObject* pDataObject, CString& strText, BOOL& bColumnar)
Retrieves the text from an OLE data source object.
EDIT_API virtual COleDataSource* GetNewCOleDataSource()
Creates a new COleDataSource object.
EDIT_API BOOL CanUndo() const
Determines whether an operation can be undone.
EDIT_API int CharFromPos(CPoint pt) const
Retrieves the line and character indices for the character closest to a specified position.
EDIT_API int GetFirstVisibleLine() const
Determines the top visible line number.
EDIT_API int GetLastVisibleLine() const
Determines the bottom visible line number.
EDIT_API BOOL IsLineVisible(int nLine) const
Determines if a line is visible
EDIT_API int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const
Retrieves a line of text.
EDIT_API int GetLineCount() const
Retrieves the number of text lines.
EDIT_API BOOL GetModify() const
Determines whether the contents have been modified.
EDIT_API void SetModify(BOOL bModified = TRUE)
Sets or clears the modification flag.
EDIT_API void GetSel(int& nStartChar, int& nEndChar) const
Gets the starting and ending character positions of the current selection.
EDIT_API DWORD GetSel() const
Gets the starting and ending character positions of the current selection.
EDIT_API int GetWindowText(LPTSTR lpszStringBuf, int nMaxCount) const
Returns the window text.
EDIT_API void GetWindowText(CString& rString) const
Returns the window text.
EDIT_API CPoint PosFromChar(UINT nChar) const
Retrieves the coordinates of the upper-left corner of a specified character index.
EDIT_API void EmptyUndoBuffer()
Resets (clears) the undo flag.
EDIT_API int LineFromChar(int nIndex = -1, int* pCol = NULL) const
Retrieves the line number of the line that contains the specified character index.
EDIT_API int LineIndex(int nLine = -1, int nCol = 0) const
Retrieves the character index of a line.
EDIT_API int LineLength(int nCharIndex = -1) const
Retrieves the length of a line.
EDIT_API void LineScroll(int nLines, int nChars = 0)
Scrolls the text.
EDIT_API void MoveToLine(int nLine)
Sets nLine as the top visible line.
EDIT_API void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE)
Replaces the current selection with the specified text.
EDIT_API void SetSel(int nStartChar, int nEndChar, BOOL bNoScroll = FALSE)
Selects a range of characters.
EDIT_API void SetSel(DWORD dwSelection, BOOL bNoScroll = FALSE)
Selects a range of characters.
EDIT_API BOOL SetReadOnly(BOOL bReadOnly = TRUE)
Sets the read-only state.
EDIT_API void SetWindowText(LPCTSTR lpszString)
Sets the window text.
EDIT_API void Clear()
Deletes (clears) the current selection (if any).
EDIT_API void Copy()
Copies the current selection (if any) to the clipboard.
EDIT_API void Cut()
Deletes (cuts) the current selection (if any) and copies to the clipboard.
EDIT_API void Paste()
Inserts the data from the clipboard at the current cursor position.
EDIT_API BOOL Undo()
Reverses the last operation.
EDIT_API SECEditLineCol GetCaretPos() const
Returns the caret location
EDIT_API virtual BOOL GetSyntaxColoring() const
Does this controller's viewport want syntax coloring
EDIT_API virtual SECEditFontInfo* GetFontInfo() const
Gets the Font and Coloring information for this viewport to use
EDIT_API virtual ISECEditLangConfig* GetLangPtr() const
Retrieves a pointer to a configuration manager object.
EDIT_API virtual SECEdit* GetEditModel() const
Gets a pointer to the data model.
EDIT_API virtual SECEditViewport* GetSECEditViewport() const
Gets a pointer to the viewport.
EDIT_API void GetLine(int nLine, int nCol, LPCTSTR& lpszLine, CString& strLine)
Retrieves a line of text from the edit buffer.
EDIT_API virtual BOOL GetWordBound(CString& strWord, int nLine = -1, int nCol = -1, BOOL bForward = TRUE, int* pLine = NULL, int* pCol = NULL) const
Retrieves the next or previous word from the given position.
EDIT_API virtual CString GetCurrentWord(int* pStartCol = NULL, int* pEndCol = NULL) const
Retrieves the word at current caret position.
EDIT_API virtual CString GetWord(int nLine, int nCol, int* pStartCol = NULL, int* pEndCol = NULL) const
Retrieves the word at the given position.
EDIT_API virtual BOOL GetWordStart(CString& strLeft, int& nLine, int& nCol) const
Retrieves the beginning portion of a word and its starting position.
EDIT_API virtual BOOL GetWordEnd(CString& strRight, int& nLine, int& nCol) const
Retrieves the ending portion of a word and its ending position.
EDIT_API virtual BOOL MouseDown() const
Queries the status of the mouse button.
EDIT_API virtual BOOL IsReadOnly() const
Queries the read-only status of the data model.
EDIT_API BOOL CaretVirtual() const
Queries whether the caret is currently positioned in virtual white space.
EDIT_API void CenterLine(int nLine = -1)
Moves the given line as close to the center of the viewport as possible
EDIT_API virtual BOOL Insert(SECEditLineColPair& lcpInsertBlock, LPCTSTR lpszText, int nLength = -1)
Inserts text at a specific position.
EDIT_API virtual BOOL Insert(int nLine, int nCol, LPCTSTR lpszText, int nLength = -1, BOOL bItemDataFlags = TRUE)
Inserts text at a specific position.
EDIT_API void LineCut()
Cuts the selected or current line to the clipboard.
EDIT_API void LineDelete()
Deletes the selected or current line to the clipboard.
EDIT_API BOOL Delete()
Deletes the selection or the character to the right of the cursor.
EDIT_API BOOL DeleteBack()
Deletes the selection or the character to the left of the cursor.
EDIT_API void EditCut()
Cuts the selected text to the clipboard.
EDIT_API void EditCopy()
Copies the selected text to the clipboard.
EDIT_API BOOL EditPaste()
Pastes the text from the clipboard.
EDIT_API BOOL EditRedo()
Performs a redo operation of the last undo command.
EDIT_API BOOL EditUndo()
Performs an undo of the last executed command.
EDIT_API void Tab()
Inserts one tab.
EDIT_API void SelectionLowercase()
Converts the current selection to lowercase.
EDIT_API void SelectionUppercase()
Converts the current selection to uppercase.
EDIT_API BOOL ToggleViewWhitespace()
Toggles the visibility of white space in the text.
EDIT_API void WindowScroll(int nLines, int nChars = 0)
Scrolls the window vertically and/or horizontally.
EDIT_API void WindowScrollDown()
Scrolls the window down one line.
EDIT_API void WindowScrollUp()
Scrolls the window up one line.
EDIT_API void WordDeleteToEnd()
Deletes a word to the right.
EDIT_API void WordDeleteToStart()
Deletes a word to the left.
EDIT_API virtual BOOL ExtendContextMenu(CMenu& top, CMenu& popup)
Builds the default context menu
EDIT_API virtual void UpdateContextMenu(CMenu& popup)
Calls the Update Handlers for items ont he context menu
EDIT_API virtual BOOL OnCaretLineChanged(int nPreviousLine, BOOL bLineChanged)
Called when the caret changes lines.
EDIT_API BOOL ClearSelection(BOOL bInvalidate = TRUE)
Clears the current selection.
EDIT_API CString GetSelText() const
Retrieves the selected text.
EDIT_API BOOL HasSelection() const
Queries the selection state.
EDIT_API BOOL HasWritableSelection() const
Queries the presence of modifiable selected text.
EDIT_API BOOL IsLineColInSel(const SECEditLineCol& lc) const
Determines if the given coordinates are within a selected text region.
EDIT_API void ReplaceSelection(LPCTSTR lpszNewText = NULL, BOOL bColumnar = FALSE)
Replaces the text currently selected.
EDIT_API void SelectAll()
Selects all text in the document.
EDIT_API void SelectLineRange()
Selects a range of lines.
EDIT_API void SelectLineRange(int nStartLine, int nEndLine = -1)
Selects a range of lines.
EDIT_API BOOL UpdateSelectionFromCmd(SECEditCommand* pCmd)
Updates the current selection based on the given command.
EDIT_API void InvalidateSelection() const
Invalidates the selectiond
EDIT_API void InvalidateLines(int nStartLine, int nEndLine = -1) const
Invalidates the given range of lines
EDIT_API void ExtendSelection(const SECEditLineCol& lc, BOOL bInvalidate = TRUE)
Extends the selection from the caret to the given point
EDIT_API void ExtendSelection(int nLine, int nCol, BOOL bInvalidate = TRUE)
Extends the selection from the caret to the given point
EDIT_API void SetShowSelAlways(BOOL bShowSel)
Sets the value for shoing the selection always
EDIT_API void SetSelection(int nStartLine, int nStartCol, int nEndLine, int nEndCol, SECEditSelectionType seltype = secST_StreamSelect)
Sets the selection
EDIT_API void SetSelection(const SECEditLineColPair& lcpSel, SECEditSelectionType seltype = secST_StreamSelect)
Sets the selection
EDIT_API void SelectLine(int nStartLine)
Sets the selection for one line
EDIT_API void OnHighlight()
Toggle highlight at current line
EDIT_API virtual void ToggleHighlight(int nLine)
Toggle highlight at a specified line
EDIT_API BOOL GetHighlight(int nLine) const
Check if the nLine is highlighted
EDIT_API void AdjustCaretFromPoint()
Converts the logical point location of the caret to line and column coordinates.
EDIT_API void AdjustCaretLastCol()
Adjusts the caret after vertical caret movement.
EDIT_API void AdjustLastCol()
Stores the horizontal caret logical point ordinate as the last known screen column.
EDIT_API void AdjustPointFromCaret()
Converts the current line and column caret location to a logical point.
EDIT_API virtual COleDataSource* CacheSelText(BOOL bClipboard = TRUE)
Creates a new COleDataSource with the selected text.
EDIT_API virtual SECEditLineCol DeleteSelection()
Deletes any selected text.
EDIT_API virtual BOOL DoCmd(sfl::MvcCommand* pCmd)
Executes a command.
EDIT_API virtual void DoInsertChar(const CString& strChar)
Inserts the given character at the current location.
EDIT_API CString GetSingleLineSel()
Retrieves the text in the current selection.
EDIT_API BOOL GetVirtualWhitespace() const
Queries whether virtual white space is enabled.
EDIT_API BOOL InsertColumnText(SECEditLineCol lcInsert, LPCTSTR lpszText)
Inserts text as a column of text.
EDIT_API void PadToCaret()
Appends spaces to a line until to pad the line to the currrent caret location.
BOOL m_bModalFindDlg
Controls whether the find/replace dialog is modal or modeless
Set to true for transient operations that require virtual whitespace to be enabled
BOOL m_bShowSelAlways
Does this controller show selection always?
TRUE if the view has lost focus to a splitter window containing this view
SECEditCommand* m_pLastCmd
Holds a pointer to the last typing command to group undo operations
unsigned int m_n1stChar
Contains the first part of a multibyte character entry in OnChar
UINT m_nScrollTimer
Timer ID for Drag/Scrolling
BOOL m_bCaretHidden
Visible status of the caret
TRUE if the current message being handled in a custom caret message
int m_nPreviousLine
Caches the previous line location of the caret when the caret switches lines
HACCEL m_hAccelTable
The handle the accelerator table that maps keystrokes to edit commands
HCURSOR m_hGutterCursor
The handle the the cursor used when the mouse is over the gutter area
int m_nGutterWidth
The width of the gutter area in logical units
BOOL m_bCanDrop
During a Drag/Drop operation, signals if the view will accept a drop of the data
BOOL m_bDropCaretCanShow
During a Drag/Drop oepration, singals if the view should show a caret indicating the location for the drop
BOOL m_bMouseDown
Tracks whether the primary mouse button is down
BOOL m_bMakeCaretVisible
Flag indicating if the caret should be scrolled into view if it moves outside the window
A count used when setting the status of the caret visibility
SECEditLineCol m_lcCaret
The location of the caret in this controller's viewport
CPoint m_ptCaretPos
The position of the caret in logical units
CPoint m_ptCaretPrev
The previous position of the caret in logicial units
CPoint m_ptSelAnchor
The anchor position of a column selection
int m_nLastScreenCol
Caches the previous caret offset into the line in device units. Used when navigating up or down through lines
BOOL m_bUseLastCol
TRUE if caret column position caching is enabled
BOOL m_bHaveCaret
TRUE if this controller's window has the caret
BOOL m_bCaretVirtual
TRUE if the caret is currently in virtual whitespace
SECEditSelection m_sel
Holds the current selection if any
BOOL m_bLastMatch
Internal flag used when determining the last match in a search operation
CString m_strLastMatch
Internal variable used when determining the last match in a search operation
Offset added to the zero based line and column indicators
mutable BOOL m_bIgnoreGutter
Flag that tells the line conversion routines to ignore the gutter when converting
int m_nGutterAlignment
Format style for gutter area
int m_nGutterIndexWidth
Width of the gutter Index area
int m_nGutterIndexDigits
Amount of digits to be displayed in the gutter
SECEditFontInfo* m_pGutterIndexFont
Font Info used in Gutter (Index) Area
COLORREF m_rgbGutterIndexColor
Color used for Gutter (Index) Font