XTPSyntaxEditCtrl.h
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:138k
- // flags : [in] Can have one of the following values:
- // [ul]
- // [li]SW_ERASE When specified with SW_INVALIDATE,
- // erases the newly invalidated region by sending
- // a WM_ERASEBKGND message to the window. [/li]
- // [li]SW_INVALIDATE Invalidates the region identified
- // by prgnUpdate after scrolling.[/li]
- // [li]SW_SCROLLCHILDREN Scrolls all child windows that
- // intersect the rectangle pointed to by lpRectScroll
- // by the number of pixels specified in dx and dy.
- // Windows sends a WM_MOVE message to all child windows
- // that intersect lpRectScroll, even if they do not move.
- // The caret is repositioned when a child window is
- // scrolled and the cursor rectangle intersects the
- // scroll rectangle.[/li]
- // [/ul]
- //-----------------------------------------------------------------------
- int ScrollWindowEx( int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, CRgn* prgnUpdate, LPRECT lpRectUpdate, UINT flags );
- //-----------------------------------------------------------------------
- // Summary:
- // Scrolls the specified client area.
- // Parameters:
- // xAmount : [in] Specifies the amount, in device units, of horizontal
- // scrolling. This parameter must be a negative value
- // to scroll to the left.
- // yAmount : [in] Specifies the amount, in device units, of vertical
- // scrolling. This parameter must be a negative value
- // to scroll up.
- // lpRect : [in] Points to a CRect object or RECT structure that
- // specifies the portion of the client area to be scrolled.
- // If lpRect is NULL, the entire client area is scrolled.
- // The caret is repositioned if the cursor rectangle
- // intersects the scroll rectangle.
- // lpClipRect : [in] Points to a CRect object or RECT structure that
- // specifies the clipping rectangle to scroll.
- // Only bits inside this rectangle are scrolled.
- // Bits outside this rectangle are not affected
- // even if they are in the lpRect rectangle.
- // If lpClipRect is NULL, no clipping is performed
- // on the scroll rectangle.
- //-----------------------------------------------------------------------
- void ScrollWindow( int xAmount, int yAmount, LPCRECT lpRect = NULL, LPCRECT lpClipRect = NULL );
- //-----------------------------------------------------------------------
- // Summary:
- // Retrieves the scroll bar range.
- // Parameters:
- // nBar : [in] Specifies the scroll bar to examine. The parameter can
- // take one of the following values:
- // [ul]
- // [li]SB_HORZ - Retrieves the position of the horizontal
- // scroll bar.[/li]
- // [li]SB_VERT - Retrieves the position of the vertical
- // scroll bar.[/li]
- // [/ul]
- // lpMinPos : [out] Points to the integer variable that is to receive
- // the minimum position.
- // lpMaxPos : [out] Points to the integer variable that is to receive
- // the maximum position.
- //-----------------------------------------------------------------------
- void GetScrollRange( int nBar, LPINT lpMinPos, LPINT lpMaxPos ) const;
- //-----------------------------------------------------------------------
- // Summary:
- // Retrieves the position of the scroll box.
- // Parameters:
- // nBar : [in] Specifies the scroll bar to examine. The parameter can
- // take one of the following values:
- // [ul]
- // [li]SB_HORZ - Retrieves the position of the horizontal
- // scroll bar.[/li]
- // [li]SB_VERT - Retrieves the position of the vertical
- // scroll bar.[/li]
- // [/ul]
- // Returns:
- // The current position of the scroll box in the scroll bar if it is
- // successful; otherwise, it is zero.
- //-----------------------------------------------------------------------
- int GetScrollPos(int nBar);
- //-----------------------------------------------------------------------
- // Summary:
- // Scrolls the window along with the contents for the specified x and
- // y number of columns and rows.
- // Parameters:
- // x : [in] Scroll horizontally in characters.
- // y : [in] Scroll vertically in rows.
- //-----------------------------------------------------------------------
- void Scroll(int x, int y);
- //-----------------------------------------------------------------------
- // Summary:
- // Scrolls the window to a specific location where the specified row
- // or col are visible.
- // Parameters:
- // nTextRow : [in] Row for lookup in document coordinates.
- // nDispRow : [in] Row for lookup in display coordinates.
- // nDispCol : [in] Column for lookup in display coordinates.
- //-----------------------------------------------------------------------
- BOOL EnsureVisibleRow(int nTextRow);
- BOOL EnsureVisibleCol(int nDispRow, int nDispCol); //<COMBINE EnsureVisibleRow@int>
- //-----------------------------------------------------------------------
- // Summary:
- // Creates the window
- // Parameters:
- // pParent : [in] Parent window (Must not be NULL)
- // bHorzScroll : [in] TRUE if horizontal scroll bar is needed
- // bVertScroll : [in] TRUE if vertical scroll bar is needed
- // bSplit : [in] TRUE if split bar is implemented
- // pBuffer : [in] A pointer to The buffer for the control (Used by splitter)
- // lpCS : [in] Specifies the create context of the window.
- // nID : [in] Specifies the control identifier.
- // Returns: TRUE if created, FALSE otherwise
- //-----------------------------------------------------------------------
- BOOL Create(CWnd *pParent, BOOL bHorzScroll, BOOL bVertScroll,
- CXTPSyntaxEditBufferManager *pBuffer = NULL,
- CCreateContext *lpCS = NULL, UINT nID = 0);
- //-----------------------------------------------------------------------
- // Summary:
- // Sets Breakpoint shape at specified row.
- // Parameters:
- // nRow : [in] A row identifier in document coordinates.
- //-----------------------------------------------------------------------
- void AddRemoveBreakPoint(int nRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Sets Bookmark shape at specified row.
- // Parameters:
- // nRow : [in] A row identifier in document coordinates.
- //-----------------------------------------------------------------------
- void AddRemoveBookmark(int nRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Expands/Collapses block at specified row.
- // Parameters:
- // nRow : [in] A row identifier in document coordinates.
- //-----------------------------------------------------------------------
- void CollapseExpandBlock(int nRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Removes Breakpoint shape at specified row.
- // Parameters:
- // nRow : [in] A row identifier in document coordinates.
- //-----------------------------------------------------------------------
- void DeleteBreakpoint(int nRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Removes Breakpoint shape at specified row.
- // Parameters:
- // nRow : [in] A row identifier in document coordinates.
- //-----------------------------------------------------------------------
- void DeleteBookmark(int nRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Moves the current position to the previous bookmark.
- //-----------------------------------------------------------------------
- void PrevBookmark();
- //-----------------------------------------------------------------------
- // Summary:
- // Moves the current position to the next bookmark.
- //-----------------------------------------------------------------------
- void NextBookmark();
- //-----------------------------------------------------------------------
- // Summary:
- // Determines if the current document has breakpoints.
- // Returns:
- // TRUE if breakpoints were set; FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL HasBreakpoints();
- //-----------------------------------------------------------------------
- // Summary:
- // Determines if the current document has bookmarks.
- // Returns:
- // TRUE if bookmarks were set; FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL HasBookmarks();
- //-----------------------------------------------------------------------
- // Summary:
- // Retrieves a row mark for the specified row.
- // Parameters:
- // nRow : [in] row identifier in document coordinates.
- // lmType : [in] type of line mark.
- // pParam : [in] a pointer to a parameter structure.
- // Returns:
- // TRUE if specified row mark exists at the specified row, FALSE otherwise.
- // See also:
- // XTP_EDIT_LINEMARKTYPE, XTP_EDIT_LMPARAM
- //-----------------------------------------------------------------------
- BOOL HasRowMark(int nRow, const XTP_EDIT_LINEMARKTYPE& lmType, XTP_EDIT_LMPARAM* pParam = NULL);
- //-----------------------------------------------------------------------
- // Summary:
- // Collapses all expanded collapsible nodes.
- // See Also:
- // void ExpandAll();
- //-----------------------------------------------------------------------
- void CollapseAll();
- //-----------------------------------------------------------------------
- // Summary:
- // Expands all collapsed nodes.
- // See Also:
- // void CollapseAll();
- //-----------------------------------------------------------------------
- void ExpandAll();
- //-----------------------------------------------------------------------
- // Summary:
- // Returns an array of available theme names from the configuration
- // manager.
- // Returns:
- // A reference to CStringArray object containing available theme names.
- //-----------------------------------------------------------------------
- CStringArray& GetThemes();
- //-----------------------------------------------------------------------
- // Summary:
- // Applies the theme with the specified name onto the editor.
- // Parameters:
- // strTheme : [in] theme name.
- //-----------------------------------------------------------------------
- void ApplyTheme(CString strTheme);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns current theme name.
- // Returns:
- // A reference to CString object with active theme name.
- //-----------------------------------------------------------------------
- const CString& GetCurrentTheme();
- //-----------------------------------------------------------------------
- // Summary:
- // Refreshes colors for the current document.
- // Remarks:
- // Refreshing colors causes reread configuration files and reparsing
- // the current document.
- //-----------------------------------------------------------------------
- virtual void RefreshColors();
- //-----------------------------------------------------------------------
- // Summary:
- // Invalidates required row.
- // Parameters:
- // nRow : [in] row identifier in document coordinates.
- //-----------------------------------------------------------------------
- void InvalidateRow(int nRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Invalidates given set of rows
- // Parameters:
- // nRowFrom : [in] first row identifier in document coordinates.
- // nRowTo : [in] last row identifier in document coordinates.
- //-----------------------------------------------------------------------
- void InvalidateRows(int nRowFrom = -1, int nRowTo = -1);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns valid row flag.
- // Parameters:
- // nDispRow : [in] row identifier in document coordinates.
- // Returns:
- // TRUE if row valid; FALSE otherwise.
- // See also:
- // void SetRowValid(int nDispRow);
- //-----------------------------------------------------------------------
- BOOL IsRowValid(int nDispRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Sets valid flag for the row.
- // Parameters:
- // nDispRow : [in] row identifier in document coordinates.
- // See also:
- // BOOL IsRowValid(int nDispRow);
- //-----------------------------------------------------------------------
- void SetRowValid(int nDispRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Call this member function to determine if the edit control has been activated
- // or deactivated.
- // Returns:
- // TRUE if the edit control has been activated, otherwise FALSE.
- //-----------------------------------------------------------------------
- virtual BOOL IsActive() const;
- //-----------------------------------------------------------------------
- // Summary:
- // This member function is called the the edit control is being activated
- // or deactivated.
- // Parameters:
- // bIsActive - TRUE if the edit control has been activated, otherwise FALSE.
- //-----------------------------------------------------------------------
- virtual void SetActive(BOOL bIsActive);
- //-----------------------------------------------------------------------
- // Summary:
- // Call this member function to determine if the edit control create and use
- // scroll bars on parent window.
- // Returns:
- // TRUE if parent window scroll bars are used, otherwise FALSE.
- //-----------------------------------------------------------------------
- virtual BOOL IsCreateScrollbarOnParent() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Call this member function to define where scrollbars are created -
- // in SyntaxEdit control window or in parent window.
- // Parameters:
- // nSet - TRUE if parent window scroll bars should be used, otherwise FALSE.
- //-----------------------------------------------------------------------
- virtual void SetCreateScrollbarOnParent(BOOL nSet);
- //-----------------------------------------------------------------------
- // Summary:
- // Determines if a document can be modified by checking ReadOnly
- // property value and sending XTP_EDIT_NM_EDITCHANGING notification
- // to parent.
- // Returns:
- // TRUE if the document can be edited, FALSE otherwise.
- //-----------------------------------------------------------------------
- virtual BOOL CanEditDoc();
- //-----------------------------------------------------------------------
- // Summary:
- // Determines if editor in read-only mode.
- // Returns:
- // TRUE if the editor in read-only mode, FALSE otherwise.
- //-----------------------------------------------------------------------
- virtual BOOL IsReadOnly();
- //-----------------------------------------------------------------------
- // Summary:
- // Call this member function to set editor read-only mode.
- // Parameters:
- // bReadOnly - Set as TRUE to switch editor in read-only mode, FALSE otherwise.
- //-----------------------------------------------------------------------
- virtual void SetReadOnly(BOOL bReadOnly = TRUE);
- //-----------------------------------------------------------------------
- // Summary:
- // Determines if editor internally catch standard editor accelerators:
- // Ctrl+C, Ctrl+V, Ctrl+X, Ctrl+Y, Ctrl+Z, Ctrl+Shift+Z, Ctrl+A,
- // Ctrl+Ins, Shift+Ins, Alt+Backspace.
- // Remarks:
- // You can support any of these editing operations externally, by call
- // of member functions. By default this feature is off.
- // Returns:
- // TRUE if accelerators internally supported, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL IsEnabledEditAccelerators();
- //-----------------------------------------------------------------------
- // Summary:
- // Call this member function to enable or disable standard editor accelerators
- // processing. By default this feature is off.
- // Parameters:
- // bEnable - Set as TRUE to enable accelerators, FALSE otherwise.
- //-----------------------------------------------------------------------
- void EnableEditAccelerators(BOOL bEnable);
- //{{AFX_CODEJOCK_PRIVATE
- public:
- virtual BOOL PreTranslateMessage(MSG* pMsg);
- virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
- virtual void PreSubclassWindow();
- virtual void OnFinalRelease();
- virtual BOOL _InitEditControl();
- virtual DWORD ProcessCollapsedRowsBeroreDraw(int nTextRow,
- int& rnSkipRowsCount);
- virtual BOOL _IsVirtualSpaceActive() const;
- virtual void _EnsureVisible(int nTextRow, int nDispCol);
- virtual BOOL SetValueInt(LPCTSTR lpszValue, int nNewValue, int& nRefValue, BOOL bUpdateReg);
- virtual BOOL SetValueBool(LPCTSTR lpszValue, BOOL bNewValue, BOOL& bRefValue, BOOL bUpdateReg);
- protected:
- afx_msg void OnPaint();
- afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
- afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
- afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
- afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
- afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
- afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
- afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
- afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
- afx_msg void OnMouseMove(UINT nFlags, CPoint point);
- afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- afx_msg void OnDestroy();
- afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg void OnSetFocus(CWnd* pOldWnd);
- afx_msg BOOL OnNcActivate(BOOL bActive);
- afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
- afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
- afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
- afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
- afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
- afx_msg BOOL OnEraseBkgnd(CDC* pDC);
- afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
- afx_msg void OnTimer(UINT_PTR nIDEvent);
- afx_msg void OnKillFocus(CWnd* pNewWnd);
- afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
- afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
- afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
- afx_msg LRESULT OnGetText(WPARAM wBufferSize, LPARAM lpBuffer);
- afx_msg LRESULT OnGetTextLen(WPARAM wParam, LPARAM lParam);
- afx_msg LRESULT OnGetFont(WPARAM wParam, LPARAM lParam);
- afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM lParam);
- afx_msg LRESULT OnInputLanguage(WPARAM wParam, LPARAM lParam);
- afx_msg void OnDragCopy();
- afx_msg void OnDragMove();
- afx_msg UINT OnGetDlgCode();
- DECLARE_MESSAGE_MAP()
- //}}AFX_CODEJOCK_PRIVATE
- protected:
- /////////////////////////////////////////////////////////////////
- // Methods
- /////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
- // Summary:
- // Calculates rect(s) for Collapsible node icon
- // Parameters:
- // nDispRow : [in] The window row number for which to print
- // rcNode : [out] Reference to CRect variable to receive node
- // icon rect
- // prcNodeFull : [out] Pointer to CRect variable to receive full
- // node area rect
- //-----------------------------------------------------------------------
- void GetLineNodeRect(int nDispRow, CRect& rcNode, CRect* prcNodeFull = NULL);
- //-----------------------------------------------------------------------
- // Summary:
- // Calculates the edit bar length and stores it into m_nEditbarLength
- // member variable depending upon the gutter length and visibility and
- // line number length and visibility.
- // Parameters:
- // pDC : [in] A pointer to device context to draw.
- //-----------------------------------------------------------------------
- void CalculateEditbarLength(CDC* pDC= NULL);
- //-----------------------------------------------------------------------
- // Summary:
- // Recalculates and set the scroll bars depending on the text size
- // and current position.
- //-----------------------------------------------------------------------
- void _RecalcScrollBars();
- //-----------------------------------------------------------------------
- // Summary:
- // Recalculates and set m_nHScrollMaxWidth member depending on the visible
- // text size.
- //-----------------------------------------------------------------------
- void _RecalcHScrollMaxWidth();
- //-----------------------------------------------------------------------
- // Summary:
- // This member function is called to update Is IME mode supported at
- // the current time.
- //-----------------------------------------------------------------------
- void _UpdateIMEStatus();
- //-----------------------------------------------------------------------
- // Summary:
- // Add number of tabs and spaces required to reach nDispColl.
- // Parameters:
- // rstrTextToIns : [in out] Text to be inserted
- // nDispColl : [in] A display column number to reach to.
- //-----------------------------------------------------------------------
- void FillTabs(CString &rstrTextToIns, int nDispColl);
- //-----------------------------------------------------------------------
- // Summary:
- // Fills and/or calculates number of tabs or blank spaces required.
- // Parameters:
- // szText : [in] Text to be inserted
- // strTextToIns : [out] Return string with all the indentation
- // iNewRow : [out] New row
- // iNewCol : [out] New col (absolute)
- // iNewDispCol : [out] New display col
- // iEditRowFrom : [out] Start row for XTP_EDIT_NM_EDITCHANGED
- // iEditRowTo : [out] End row for XTP_EDIT_NM_EDITCHANGED
- // iChainActionCount : [out] Chain action count for undo
- //-----------------------------------------------------------------------
- BOOL CreateInsertText(LPTSTR szText, CString& strTextToIns,int& iNewRow,int& iNewCol,
- int& iNewDispCol, int& iEditRowFrom, int& iEditRowTo,int& iChainActionCount);
- //-----------------------------------------------------------------------
- // Summary:
- // Send XTP_EDIT_NM_EDITCHANGED notification with specified parameters.
- // Parameters:
- // iRowFrom : [in] Start row identifier.
- // iRowTo : [in] End row identifier.
- // nActions : [in] Action mask.
- //-----------------------------------------------------------------------
- void NotifyEditChanged(int iRowFrom, int iRowTo, UINT nActions);
- //-----------------------------------------------------------------------
- // Summary:
- // Send any notification to parent.
- // Parameters:
- // uCode : [in] The notification code to send.
- //-----------------------------------------------------------------------
- virtual LRESULT NotifyParent(UINT uCode);
- //-----------------------------------------------------------------------
- // Summary:
- // Send any mouse notification to parent.
- // Parameters:
- // uCode : [in] A mouse event notify code (like XTP_EDIT_NM_LBUTTONDOWN or other).
- // nFlags : [in] A mouse event flags.
- // point : [in] A mouse event cursor position.
- // See Also:
- // XTP_EDIT_NM_LBUTTONDOWN, XTP_EDIT_NM_LBUTTONDBLCLICK, XTP_EDIT_NM_LBUTTONUP,
- // XTP_EDIT_NM_RBUTTONDOWN, XTP_EDIT_NM_RBUTTONUP, XTP_EDIT_NM_MOUSEMOVE.
- //-----------------------------------------------------------------------
- virtual LRESULT NotifyMouseEvent(UINT uCode, UINT nFlags, const CPoint& point);
- //-----------------------------------------------------------------------
- // Summary:
- // Send any notification to parent that user click in the bookmark area.
- // Parameters:
- // nRow : [in] Document row.
- // nDispRow : [in] Visible row.
- // Returns:
- // TRUE if action was handled, FALSE otherwise.
- //-----------------------------------------------------------------------
- virtual BOOL NotifyMarginLBtnClick(int nRow, int nDispRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Initialize selection of all the sibling views.
- //-----------------------------------------------------------------------
- virtual void NotifySelInit();
- //-----------------------------------------------------------------------
- // Summary:
- // Recalculates horizontal scroll bar
- //-----------------------------------------------------------------------
- void RecalcHorzScrollPos();
- //-----------------------------------------------------------------------
- // Summary:
- // Recalculates vertical scroll bar
- //-----------------------------------------------------------------------
- void RecalcVertScrollPos();
- //-----------------------------------------------------------------------
- // Summary:
- // Find the next(or previouse) word position depending on the
- // parameter supplied.
- // Parameters:
- // nFindWhat : [in] XTP_EDIT_FINDWORD_PREV to find previous and
- // XTP_EDIT_FINDWORD_NEXT to find next word.
- // nTextRow : [in] A text row number to start finding.
- // nCol : [in] A column number to start finding (1 based value).
- // lcPos_str : [in] A text position to start finding (column
- // is a 0 based value).
- // rlcWordStart : [out] A reference to XTP_EDIT_LINECOL object
- // to receive word start position.
- // rlcWordEnd : [out] A reference to XTP_EDIT_LINECOL object
- // to receive word end position.
- // rbOverSpace : [out] A reference to BOOL variable to receive
- // if finding started from space or tab character.
- //-----------------------------------------------------------------------
- void FindWord(UINT nFindWhat);
- BOOL FindWordEx(UINT nFindWhat, int nTextRow, int nCol,
- XTP_EDIT_LINECOL& rlcWordStart, XTP_EDIT_LINECOL& rlcWordEnd,
- BOOL& rbOverSpace); //<COMBINE FindWord@UINT>
- BOOL FindWordEx_str(UINT nFindWhat, XTP_EDIT_LINECOL lcPos_str,
- XTP_EDIT_LINECOL& rlcWordStart, XTP_EDIT_LINECOL& rlcWordEnd,
- BOOL& rbOverSpace); //<COMBINE FindWord@UINT>
- //-----------------------------------------------------------------------
- // Summary:
- // Try to match text on the supplied parameters.
- // Parameters:
- // nRow : [in] Row to match for.
- // szLineText : [in] Line text.
- // szMatchText : [in] Text to be matched.
- // nStartPos : [in] Start position.
- // bMatchWholeWord : [in] Has to match whole word or not.
- // bMatchCase : [in] Case to be matched or not.
- // bSearchForward : [in] TRUE if it is to search forward.
- // bRedraw : [in] TRUE for redraw control after search.
- //-----------------------------------------------------------------------
- BOOL MatchText(int nRow, LPCTSTR szLineText, LPCTSTR szMatchText, int nStartPos,
- BOOL bMatchWholeWord, BOOL bMatchCase, BOOL bSearchForward,
- BOOL bRedraw = TRUE);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the effective parent.
- // Returns:
- // The parent window in form of CWnd*.
- //-----------------------------------------------------------------------
- CWnd* GetEffectiveParent() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Calculate and returns the display column for another display column
- // specified in the iCol parameter.
- // Parameters:
- // szText : [in] The text on which the calculation should be made.
- // iCol : [in] The display column for which calculation is needed.
- // Returns:
- // The display column as integer value.
- //-----------------------------------------------------------------------
- int CalcValidDispCol(LPCTSTR szText, int iCol);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the absolute column for a display column.
- // Parameters:
- // szText : [in] The text for which calculation is needed.
- // nDispCol : [in] The valid display column.
- // nTextRow : [in] The text row number.
- // Returns:
- // The absolute column.
- //-----------------------------------------------------------------------
- int CalcAbsCol(LPCTSTR szText, int nDispCol);
- //-----------------------------------------------------------------------
- // Summary:
- // Calculates and returns the display column for the specified
- // absolute column.
- // Parameters:
- // szText : [in] The text for calculation.
- // nActualCol : [in] The actual (absolute) column position.
- // nTextRow : [in] The text row number.
- // Returns:
- // The calculated display column.
- //-----------------------------------------------------------------------
- int CalcDispCol(LPCTSTR szText, int nActualCol);
- public:
- int CalcAbsCol(int nTextRow, int nDispCol); //<COMBINE CalcAbsCol@LPCTSTR@int>
- int CalcDispCol(int nTextRow, int nActualCol); //<COMBINE CalcDispCol@LPCTSTR@int>
- //-----------------------------------------------------------------------
- // Summary:
- // Returns a pointer to the line marks manager associated with the
- // current text buffer.
- // Returns:
- // Pointer to CXTPSyntaxEditLineMarksManager
- //-----------------------------------------------------------------------
- CXTPSyntaxEditLineMarksManager* GetLineMarksManager();
- //-----------------------------------------------------------------------
- // Summary:
- // Use this member function to set new text value for specified row.
- // Parameters:
- // nRow : [in] The text row number.
- // pcszText : [in] The row text new value.
- // bCanUndo : [in] Pass TRUE if this can be undone.
- // Remarks:
- // The parser is notified to reparse changed text.
- //-----------------------------------------------------------------------
- void SetRowText(int nRow, LPCTSTR pcszText, BOOL bCanUndo);
- //-----------------------------------------------------------------------
- // Summary:
- // Use this member function to insert new row.
- // Parameters:
- // nRow : [in] The row number to insert at.
- // pcszText : [in] The new row text.
- // bCanUndo : [in] Pass TRUE if this can be undone.
- // Remarks:
- // The parser is notified to reparse changed text.
- //-----------------------------------------------------------------------
- void InsertRow(int nRow, LPCTSTR pcszText, BOOL bCanUndo);
- //-----------------------------------------------------------------------
- // Summary:
- // Use this member function to remove row.
- // Parameters:
- // nRow : [in] The row number to remove.
- // bCanUndo : [in] Pass TRUE if this can be undone.
- // Remarks:
- // The parser is notified to reparse changed text.
- //-----------------------------------------------------------------------
- void RemoveRow(int nRow, BOOL bCanUndo);
- //-----------------------------------------------------------------------
- // Summary:
- // This member function is used to retrieve text colors for the
- // specified row. It is called by the edit control from drawing procedure.
- // Parameters:
- // nRow : [in] The row number to retrieve text colors.
- // nColFrom : [in] The start column number (zero based).
- // nColTo : [in] The end column number (zero based). Value -1 means
- // line end.
- // clrDefault : [in] A const reference to structure which contains
- // default text colors. CXTPSyntaxEditPaintManager::m_clrValues
- // passed by default.
- // rBlocks : [out] A pointer to CXTPSyntaxEditTextBlockList object
- // to return text colors.
- // Remarks:
- // The default implementation call CXTPSyntaxEditLexTextSchema::GetRowColors.
- // You may override this method and create own fast implementation
- // for the simple colors schemas.
- //-----------------------------------------------------------------------
- virtual void GetRowColors(int nTextRow, int nColFrom, int nColTo,
- const XTP_EDIT_COLORVALUES& clrDefault,
- CXTPSyntaxEditTextBlockList* rBlocks);
- //-----------------------------------------------------------------------
- // Summary:
- // This member function is used to retrieve collapsable text blocks
- // for the specified row. It is called by the edit control.
- // Parameters:
- // nRow : [in] The row number to retrieve text colors.
- // rArBlocks : [out] A reference to CXTPSyntaxEditRowsBlockArray object
- // to return collapsable text blocks.
- // Remarks:
- // The default implementation call CXTPSyntaxEditLexTextSchema::GetCollapsableBlocksInfo.
- // You may override this method and create own fast implementation.
- //-----------------------------------------------------------------------
- virtual void GetCollapsableBlocksInfo(int nTextRow,
- CXTPSyntaxEditRowsBlockArray& rArBlocks);
- protected:
- //-----------------------------------------------------------------------
- // Summary:
- // Expands the character set by putting space in the position of tab.
- // Parameters:
- // pDC : [in] A pointer to CDC object.
- // pszChars : [in] The text to be processed.
- // strBufer : [in] Buffer for text to be created after expansion.
- // nCurPos : [in] The current position in the line.
- // Returns:
- // The length of processed text after expansion.
- //-----------------------------------------------------------------------
- int ExpandChars(CDC* pDC, LPCTSTR pszChars, int nCurPos, CString& strBufer);
- //-----------------------------------------------------------------------
- // Summary:
- // Calculate collapsed text sign rect (like for [..])
- // Parameters:
- // pDC : [in] A pointer to CDC object.
- // pCoDrawBlk : [in] Pointer to XTP_EDIT_COLLAPSEDBLOCK structure.
- // rcCoBlk : [in, out] A reference to rectangle with collapced
- // block text area. The right border is updated by this function.
- // See also:
- // struct XTP_EDIT_COLLAPSEDBLOCK
- //-----------------------------------------------------------------------
- void ProcessCollapsedText(CDC* pDC, XTP_EDIT_COLLAPSEDBLOCK* pCoDrawBlk, CRect& rcCoBlk);
- //-----------------------------------------------------------------------
- // Summary:
- // The same functionality as for ProcessCollapsedText but performs some
- // additional checks for input parameters.
- // Parameters:
- // pDC : [in] A pointer to CDC object.
- // pCoDrawBlk : [in] Pointer to XTP_EDIT_COLLAPSEDBLOCK structure.
- // txtBlk : [in] Pointer to XTP_EDIT_TEXTBLOCK structure.
- // rcCoBlk : [in, out] A reference to rectangle with collapced
- // block text area. The right border is updated by this function.
- // See also:
- // struct XTP_EDIT_COLLAPSEDBLOCK, struct XTP_EDIT_TEXTBLOCK
- //-----------------------------------------------------------------------
- BOOL ProcessCollapsedTextEx(CDC* pDC, XTP_EDIT_COLLAPSEDBLOCK* pCoDrawBlk,
- const XTP_EDIT_TEXTBLOCK& txtBlk, CRect& rcCoBlk);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns a collapsed text for the specified collapsed block.
- // Parameters:
- // pCoDrawBlk : [in] XTP_EDIT_COLLAPSEDBLOCK structure.
- // nMaxLinesCount : [in] Max lines of text. Default is 150.
- // Returns:
- // CString object with text for collapsed block.
- // See also:
- // struct XTP_EDIT_COLLAPSEDBLOCK
- //-----------------------------------------------------------------------
- CString GetCollapsedText(XTP_EDIT_COLLAPSEDBLOCK* pCoDrawBlk, int nMaxLinesCount = 150);
- //-----------------------------------------------------------------------
- // Summary:
- // Finds collapsed block on the specified point if exist.
- // Parameters:
- // ptMouse : [in] Mouse coordinates where to check for collapsed block.
- // Returns:
- // Pointer to the XTP_EDIT_COLLAPSEDBLOCK structure with collapsed block
- // parameters if it found, NULL otherwise.
- // See also:
- // struct XTP_EDIT_COLLAPSEDBLOCK.
- //-----------------------------------------------------------------------
- XTP_EDIT_COLLAPSEDBLOCK* GetBlockFromPt(const CPoint& ptMouse);
- //-----------------------------------------------------------------------
- // Summary:
- // Shows tool tip with the text of the collapsed block on the specified
- // point.
- // Parameters:
- // ptMouse : [in] Mouse coordinates where to check for tooltip.
- // See also:
- // CXTPSyntaxEditToolTipCtrl, m_wndToolTip
- //-----------------------------------------------------------------------
- void ShowCollapsedToolTip(const CPoint& ptMouse);
- //-----------------------------------------------------------------------
- // Summary:
- // Expand collapsed block if double clicked on it.
- // Parameters:
- // ptMouse : [in] Mouse coordinates where to check for collapsed block.
- // Returns:
- // A number of row where collapsed block was expanded, 0 if collapsed
- // block was not expanded.
- // See also:
- // CXTPSyntaxEditToolTipCtrl
- //-----------------------------------------------------------------------
- int ProcessCollapsedBlockDblClick(const CPoint& ptMouse);
- //-----------------------------------------------------------------------
- // Summary:
- // Updates the sibling views while in split mode.
- // Parameters:
- // dwUpdate : [in] Specifies the view update flags.
- //-----------------------------------------------------------------------
- void UpdateScrollPos(DWORD dwUpdate = XTP_EDIT_UPDATE_ALL);
- //-----------------------------------------------------------------------
- // Summary:
- // Sets or clears the modification flag for the currently opened
- // document.
- // Parameters:
- // bModified : [in] TRUE if want to set the document modified.
- // Default is TRUE.
- //-----------------------------------------------------------------------
- void SetDocModified(BOOL bModified = TRUE);
- //-----------------------------------------------------------------------
- // Summary:
- // Calculates the maximum width for a text.
- // Parameters:
- // szText : [in] The text for calculation.
- // Returns:
- // The maximum width.
- //-----------------------------------------------------------------------
- int CalcMaximumWidth(LPCTSTR szText);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns a filename of the default ini configuration file.
- // Returns:
- // CString objects with filename.
- //-----------------------------------------------------------------------
- CString GetDefaultCfgFilePath();
- //-----------------------------------------------------------------------
- // Summary:
- // Internal editing event handler.
- // Parameters:
- // nRow : [in] Row identifier.
- // nCol : [in] Column identifier.
- //-----------------------------------------------------------------------
- void OnBeforeEditChanged(int nRow, int nCol);
- //-----------------------------------------------------------------------
- // Summary:
- // Internal editing event handler.
- // Parameters:
- // nRowFrom : [in] Start row identifier.
- // nColFrom : [in] Start column identifier.
- // nRowTo : [in] End row identifier.
- // nColTo : [in] End column identifier.
- // eEditAction : [in] Action identifier.
- //-----------------------------------------------------------------------
- void OnEditChanged(int nRowFrom, int nColFrom, int nRowTo, int nColTo, int eEditAction);
- //-----------------------------------------------------------------------
- // Summary:
- // Internal editing event handler.
- // Parameters:
- // LCFrom : [in] Start coordinates.
- // LCTo : [in] End coordinates.
- // eEditAction : [in] Action identifier.
- // See also:
- // struct XTP_EDIT_LINECOL
- //-----------------------------------------------------------------------
- void OnEditChanged(const XTP_EDIT_LINECOL& LCFrom, const XTP_EDIT_LINECOL& LCTo, int eEditAction);
- //-----------------------------------------------------------------------
- // Summary:
- // Internal editing event handler.
- // Parameters:
- // code : [in] Event code.
- // wParam : [in] Event parameter 1.
- // lParam : [in] Event parameter 2.
- // See also:
- // XTP_NOTIFY_CODE
- //-----------------------------------------------------------------------
- void OnParseEvent(XTP_NOTIFY_CODE code, WPARAM wParam, LPARAM lParam);
- //-----------------------------------------------------------------------
- // Summary:
- // Send WM_NOTIFY with XTP_EDIT_NM_PARSEEVENT code to parent window.
- // Parameters:
- // code : [in] Event code from XTPSyntaxEditOnParseEvent enum.
- // wParam : [in] Event parameter 1.
- // lParam : [in] Event parameter 2.
- // See Also:
- // XTPSyntaxEditOnParseEvent
- //-----------------------------------------------------------------------
- BOOL NotifyParseEvent(XTP_NOTIFY_CODE code, WPARAM wParam, LPARAM lParam);
- //-----------------------------------------------------------------------
- // Summary:
- // Internal editing event handler.
- // Parameters:
- // code : [in] Event code from XTPSyntaxEditOnCfgChangedEvent enum.
- // wParam : [in] Event parameter 1.
- // lParam : [in] Event parameter 2.
- // See also:
- // XTPSyntaxEditOnCfgChangedEvent
- //-----------------------------------------------------------------------
- void OnLexCfgWasChanged(XTP_NOTIFY_CODE code, WPARAM wParam, LPARAM lParam);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns current document row number.
- // Returns:
- // Current document row integer value.
- // See also:
- // void SetCurrentDocumentRow(int nRow);
- //-----------------------------------------------------------------------
- int GetCurrentDocumentRow() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Set row number as current document row.
- // Parameters:
- // nRow : [in] row number.
- // See also:
- // int GetCurrentDocumentRow();
- //-----------------------------------------------------------------------
- void SetCurrentDocumentRow(int nRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns current visible row number.
- // Returns:
- // Integer value of current visible row.
- //-----------------------------------------------------------------------
- int GetCurrentVisibleRow();
- //-----------------------------------------------------------------------
- // Summary:
- // Calculates document row basing in visible row.
- // Parameters:
- // nVisibleRow : [in] Visible row.
- // Returns:
- // Integer value of document row.
- // See also:
- // int GetCurrentVisibleRow();
- //-----------------------------------------------------------------------
- int GetDocumentRow(int nVisibleRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Calculates document row basing in global visible row.
- // Parameters:
- // nStartDocumentRow : [in] Start document row.
- // nRowDelta : [in] Visible rows count.
- // Returns:
- // Integer value of document row.
- //-----------------------------------------------------------------------
- int CalculateDocumentRow(int nStartDocumentRow, int nRowDelta);
- //-----------------------------------------------------------------------
- // Summary:
- // Calculates visible row basing in document row.
- // Parameters:
- // nDocumentRow : [in] Document row.
- // Returns:
- // Integer value of visible row.
- //-----------------------------------------------------------------------
- int GetVisibleRow(int nDocumentRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Calculates global visible row basing in document row.
- // Parameters:
- // nStartDocumentRow : [in] Start row.
- // nDocumentRow : [in] Count of document rows.
- // Returns:
- // Integer value of global visible row.
- //-----------------------------------------------------------------------
- int CalculateVisibleRow(int nStartDocumentRow, int nDocumentRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns maximum visible rows count.
- // Parameters:
- // nMaxDocRow : [in] Max document row up to which calculate visible
- // rows. If you pass -1 then calculate up to the
- // end of the document. -1 is default value.
- // Returns:
- // Integer value of maximum visible rows count.
- //-----------------------------------------------------------------------
- int GetVisibleRowsCount(int nMaxDocRow = -1);
- //-----------------------------------------------------------------------
- // Summary:
- // Moves current row up on a number of rows.
- // Parameters:
- // nCount : [in] Count of rows.
- // Returns:
- // Integer value of current visible row.
- //-----------------------------------------------------------------------
- int MoveCurrentVisibleRowUp(int nCount);
- //-----------------------------------------------------------------------
- // Summary:
- // Moves current row down on a number of rows.
- // Parameters:
- // nCount : [in] Count of rows.
- // Returns:
- // Integer value of current visible row.
- //-----------------------------------------------------------------------
- int MoveCurrentVisibleRowDown(int nCount);
- //-----------------------------------------------------------------------
- // Summary:
- // Shifts current row up on a number of rows.
- // Parameters:
- // nCount : [in] Count of rows.
- // bChangeCaret : [in] Caret movement flag, default is FALSE.
- // Returns:
- // TRUE if screen is changed; FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL ShiftCurrentVisibleRowUp(int nCount, BOOL bChangeCaret = FALSE);
- //-----------------------------------------------------------------------
- // Summary:
- // Shifts current row down on a number of rows.
- // Parameters:
- // nCount : [in] Count of rows.
- // bChangeCaret : [in] Caret movement flag, default is FALSE.
- // Returns:
- // TRUE if screen is changed; FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL ShiftCurrentVisibleRowDown(int nCount, BOOL bChangeCaret = FALSE);
- //-----------------------------------------------------------------------
- // Summary:
- // Gets length of collapsed block.
- // Parameters:
- // nStartRow : [in] Start row of collapsed block.
- // rnLen : [out] Reference to store length value.
- // Returns:
- // TRUE if success; FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL GetCollapsedBlockLen(int nStartRow, int& rnLen);
- //-----------------------------------------------------------------------
- // Summary:
- // Gets the type of row node.
- // Parameters:
- // nRow : [in] Row identifier.
- // dwType : [out] Reference to store row node type.
- // Returns:
- // TRUE if success; FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL GetRowNodes(int nRow, DWORD& dwType);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns a text for the specified line.
- // Parameters:
- // nRow : [in] Row identifier.
- // bAddCRLF : [in] Boolean flag how to process end of text lines.
- // Default is FALSE.
- // iCRLFStyle : [in] Style of end of text lines. Default is -1.
- // Returns:
- // Reference to CString with text.
- // See Also: CXTPSyntaxEditBufferManager::GetLineText
- //-----------------------------------------------------------------------
- const CString& GetLineText(int nRow, BOOL bAddCRLF = FALSE, int iCRLFStyle = -1);
- //-----------------------------------------------------------------------
- // Summary:
- // Gets a text for the specified line.
- // Parameters:
- // nRow : [in] Row identifier.
- // strBuffer : [out] Reference to text buffer to put returned text.
- // bAddCRLF : [in] Boolean flag how to process end of text lines.
- // Default is FALSE.
- // iCRLFStyle : [in] Style of end of text lines. Default is -1.
- // See Also: CXTPSyntaxEditBufferManager::GetLineText
- //-----------------------------------------------------------------------
- void GetLineText(int nRow, CString& strBuffer, BOOL bAddCRLF = FALSE, int iCRLFStyle = -1);
- //-----------------------------------------------------------------------
- // Summary:
- // Loads data into auto complete list.
- //-----------------------------------------------------------------------
- virtual void SetAutoCompleteList();
- //-----------------------------------------------------------------------
- // Summary:
- // Refreshes line marks depending on change type.
- // Parameters:
- // pEditChanged : [in] Pointer to XTP_EDIT_NMHDR_EDITCHANGED structure.
- // See also:
- // LPXTP_EDIT_NMHDR_EDITCHANGED
- //-----------------------------------------------------------------------
- virtual void RefreshLineMarks(XTP_EDIT_NMHDR_EDITCHANGED* pEditChanged);
- //-----------------------------------------------------------------------
- // Summary:
- // Redraws line marks.
- //-----------------------------------------------------------------------
- virtual void RedrawLineMarks();
- //-----------------------------------------------------------------------
- // Summary:
- // Performs Undo/Redo operations and common control properties
- // adjustment.
- // Parameters:
- // nActionsCount : [in] A number of actions to undo/redo.
- // bUndoRedo : [in] TRUE for performing Undo operations, FALSE for
- // performing Redo operations.
- // Returns:
- // TRUE if success, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL DoUndoRedo(int nActionsCount, BOOL bUndoRedo);
- //-----------------------------------------------------------------------
- // Summary:
- // Changes the case of the selection.
- // Parameters:
- // bUpper : [in] TRUE when changing selection case to Upper,
- // FALSE when changing selection case to Lower.
- // Returns:
- // TRUE if performs successfully, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL DoChangeSelectionCase(BOOL bUpper);
- //-----------------------------------------------------------------------
- // Summary:
- // Changes the tabification of the selection.
- // Parameters:
- // bTabify : [in] TRUE when changing spaces to tabs,
- // FALSE when changing tabs to spaces.
- // Returns:
- // TRUE if performs successfully, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL DoChangeSelectionTabify(BOOL bTabify);
- //-----------------------------------------------------------------------
- // Summary:
- // Use this method to read options from the registry.
- // Returns:
- // TRUE if performs successfully, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL GetRegValues();
- //-----------------------------------------------------------------------
- // Summary:
- // Use this method to internally update drawing information (like
- // each character position) in the draw text processor.
- // Remarks:
- // It just draw specified row on the memory device context.
- //-----------------------------------------------------------------------
- void UpdateRowInfoInternally(int nTextRow);
- //-----------------------------------------------------------------------
- // Summary:
- // This method used to determine scroll direction for automatic
- // scrolling (when selecting by mouse).
- // Parameters:
- // pnCols : [out] A pointer to int variable to receive columns count
- // to scroll. May be NULL.
- // pnRows : [out] A pointer to int variable to receive rows count
- // to scroll. May be NULL.
- // Returns:
- // A flags from enum CXTPSyntaxEditCtrl::XTPScrolDirection.
- //-----------------------------------------------------------------------
- virtual DWORD GetAutoscrollDirection(int* pnCols = NULL, int* pnRows = NULL);
- //-----------------------------------------------------------------------
- // Summary:
- // This method used to subtract selection size from the specified position.
- // Returns:
- // A subtracted position.
- //-----------------------------------------------------------------------
- XTP_EDIT_LINECOL _SubtractSelSizeFromPos(XTP_EDIT_LINECOL lcDispPos);
- //-----------------------------------------------------------------------
- // Summary:
- // This method used to set variables for autoindent.
- // Parameters:
- // nBaseDocRow : [in] A text row to calculate autoindentstart.
- // nDispCol_prev : [in] A previouse display column (before enter pressed).
- //-----------------------------------------------------------------------
- virtual void DoAutoIndentIfNeed(int nBaseDocRow, int nDispCol_prev);
- //-----------------------------------------------------------------------
- // Summary:
- // This method used to notify parent window that scrollbar state changed.
- // Parameters:
- // dwScrollBar : [in] Define the scroll bar(s) to change state as
- // WS_HSCROLL and WS_VSCROLL flags.
- // dwState : [in] Define the scroll bar(s) state as WS_HSCROLL and
- // WS_VSCROLL flags.
- // Remarks:
- // Default implementation send XTP_EDIT_NM_ENABLESCROLLBAR notification
- // to the parent.
- //-----------------------------------------------------------------------
- virtual void _EnableScrollBarNotify(DWORD dwScrollBar, DWORD dwState);
- /////////////////////////////////////////////////////////////////////////
- // Variables
- /////////////////////////////////////////////////////////////////////////
- BOOL m_bLineNumbers; // TRUE if line number is to be printed
- BOOL m_bDrawNodes; // TRUE if Collapsible nodes signs are to be printed
- BOOL m_bScrolling; // Temporary variable to specify if scrolling by mouse wheel
- BOOL m_bCaseSensitive; // Case sensitive
- BOOL m_bSelMargin; // TRUE if selection margin is to be enabled or not
- BOOL m_bVertScrollBar; // TRUE if horizontal scrollbar is to be enabled
- BOOL m_bHorzScrollBar; // TRUE if vertical scrollbar is to be enabled
- BOOL m_bEnableWhiteSpace; // Show white space
- BOOL m_bVirtualSpace; // TRUE if virtual space is enabled (cursor can be paced in any place after line end).
- BOOL m_bSyntaxColor; // Enables or disables syntax colorization
- BOOL m_bEnableOleDrag; // Enables or disables OLE drag drop
- BOOL m_bAutoIndent; // Auto indentation is enabled or not
- BOOL m_bIsSmartIndent; // Smart indentation is enabled or not
- BOOL m_bRightButtonDrag; // TRUE if user is dragging through right button
- BOOL m_bIsScrollingEndRow; // Maintains a internal logic to draw the last row which is partly visible
- BOOL m_bTokensLoaded; // Specifies if tokens are loaded or not
- BOOL m_bDroppable; // TRUE if the current position is droppable
- BOOL m_bDragging; // TRUE if in dragging mode
- BOOL m_bIsDragging; // TRUE if dragging, FALSE otherwise
- BOOL m_bPageDirty; // TRUE if the whole page is dirty
- BOOL m_bWideCaret; // Stored Overwrite Caret Style: Thin or Thick.
- BOOL m_bTabWithSpace; // Store tabulation width.
- BOOL m_bIsActive; // TRUE if application is active.
- BOOL m_bFocused; // States if focused or not
- BOOL m_bCreateScrollbarOnParent; // TRUE if parent window scroll bars are used, otherwise FALSE.
- BOOL m_bReadOnly; // Store ReadOnly mode.
- BOOL m_bHideCaret; // Store is caret visible.
- BOOL m_bEnableEditAccelerators; // Enable/disable accelerators for Cut, Copy, Paste, Undo, Redoo and Select All operations.
- int m_nTopCalculatedRow; // Top row of the last range of rows that have scrollbars properly calculated
- int m_nBottomCalculatedRow; // Bottom row of the last range of rows that have scrollbars properly calculated
- int m_nEditbarLength; // Edit bar length including gutter and line number
- int m_nMarginLength; // Margin length
- int m_nLineNumLength; // Line numbers length
- int m_nNodesWidth; // The width of the nodes signs
- int m_nInsertTabCount; // Temporarily stores the no of tabs to be inserted for auto indentation
- int m_nInsertSpaceCount; // Temporarily stores the no of space to be inserted for auto indentation
- int m_nAutoIndentCol; // Contains the column for auto indentation
- int m_nTopRow; // Top row for display
- int m_nCurrentDocumentRow; // Current row in the document
- int m_nCurrentCol; // Current absolute column
- int m_nDispCol; // Current display column
- int m_nWheelScroll; // Lines to scroll on mouse wheel
- int m_nAverageLineLen; // Average length of line
- int m_nCollapsedTextRowsCount; // The total amount of collapsed blocks in the document,
- DWORD m_dwInsertPos; // Current insert position
- DWORD m_dwLastRedrawTime; // Stores last redrawing time
- #ifndef _UNICODE
- // DBCS Support (specially for IME)
- BYTE m_chPrevLeadByte; // For none-UNICODE version IME sends double byte chars as 2 WM_CHAR messages. This member keep a lead byte until second byte receive to process them together.
- #endif
- CPoint m_ptDropPos; // Specifies the drop position
- CPoint m_ptPrevMouse; // Stored mouse position of the previous tip showing.
- CBitmap m_bmpCache; // Current view cached picture
- CXTPSyntaxEditSelection m_Selection;
- //-----------------------------------------------------------------------
- // Summary:
- // This enum defines flags for autoscroll direction.
- //-----------------------------------------------------------------------
- enum XTPScrolDirection
- {
- xtpLeft = 0x0001, // Defines left direction.
- xtpRight = 0x0010, // Defines right direction.
- xtpTop = 0x0100, // Defines top direction.
- xtpBottom = 0x1000, // Defines bottom direction.
- };
- DWORD m_dwAutoScrollDirection; // Store active autoscroll direction.
- CXTPSyntaxEditBufferManager* m_pBuffer; // The buffer manager
- CXTPSyntaxEditPaintManager* m_pPaintManeger; // The paint manager
- CWnd* m_pParentWnd; // Points to parent window.
- CString m_strTmpLineTextBuff; // Temporary text buffer
- CUIntArray m_arCollapsedTextRows; // The array of rows with beginning of collapsed blocks.
- CXTPSyntaxEditToolTipCtrl* m_pToolTip; // Tool tip window for collapsed blocks text.
- CXTPSyntaxEditAutoCompleteWnd* m_pAutoComplete; // Auto complete popup window.
- CString m_strDefaultCfgFilePath; // Store configuration file full name.
- int m_nHScrollMaxWidth; // Maximum horizontal scrollbar position.
- BOOL m_bWndCreateInProgress; // Internal flag to indicate that windows creating is in progress.
- CXTPSyntaxEditRowColorMap m_mapRowBkColor; // The map for row back colors (cache)
- CXTPSyntaxEditRowColorMap m_mapRowColor; // The map for row colors (cache)
- //-----------------------------------------------------------------------
- // Summary:
- // Returns a pointer to the screen schema cache.
- //-----------------------------------------------------------------------
- CXTPSyntaxEditLexTextBlock* GetOnScreenSch(int nForRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Clears a screen schema cache.
- // Parameters:
- // nRowFrom : [in] An integer index of a row where to clear cache from.
- //-----------------------------------------------------------------------
- void ClearOnScreenSchCache(int nRowFrom);
- //-----------------------------------------------------------------------
- // Summary:
- // Calculates an average line length from start row to end row.
- // Parameters:
- // nRowStart : [in] An integer index of a row where to calculate from.
- // nRowEnd : [in] An integer index of a row where to calculate to.
- // Returns:
- // An average line length.
- //-----------------------------------------------------------------------
- virtual UINT CalcAveDataSize(int nRowStart, int nRowEnd);
- // -----------------------------------------------------------------
- // Summary:
- // This member function registers the window class if it has not
- // already been registered.
- // Parameters:
- // hInstance - Instance of resource where control is located
- // Returns:
- // A boolean value that specifies if the window is successfully
- // registered.<p/>
- // TRUE if the window class is successfully registered.<p/>
- // Otherwise FALSE.
- // -----------------------------------------------------------------
- BOOL RegisterWindowClass(HINSTANCE hInstance = NULL);
- //===========================================================================
- // CXTPSyntaxEditCtrl::CTextSearchCache
- //===========================================================================
- class _XTP_EXT_CLASS CTextSearchCache
- {
- public:
- CTextSearchCache();
- void Update(int nCurrTopRow);
- int nForTopRow;
- CXTPSyntaxEditLexTextBlockPtr ptrTBStart;
- };
- CTextSearchCache m_fcCollapsable; // Collapsible rows cache
- CTextSearchCache m_fcRowColors; // Row colors cache
- //===========================================================================
- // CXTPSyntaxEditCtrl::CScreenSearchBlock
- //===========================================================================
- class _XTP_EXT_CLASS CScreenSearchBlock
- {
- public:
- CScreenSearchBlock();
- virtual ~CScreenSearchBlock();
- CScreenSearchBlock(const CScreenSearchBlock& rSrc);
- int nRowStart;
- int nRowEnd;
- DWORD dwLastAccessTime;
- CXTPSyntaxEditLexTextBlockPtr ptrTBFirst;
- };
- typedef CArray<CScreenSearchBlock, CScreenSearchBlock&> CScreenSearchBlockArray;
- //===========================================================================
- // CXTPSyntaxEditCtrl::CScreenSearchCache
- //===========================================================================
- class _XTP_EXT_CLASS CScreenSearchCache : public CScreenSearchBlockArray
- {
- typedef CScreenSearchBlockArray Base;
- public:
- DWORD m_dwLastRemoveOldTime;
- CScreenSearchCache();
- virtual ~CScreenSearchCache();
- void RemoveAll();
- void RemoveAt(int nIndex);
- void RemoveOld(int nTimeOut_sec);
- };
- CScreenSearchCache m_arOnScreenSchCache; // On-screen schema cache for this control.
- CByteArray m_arValidDispRows; // An array with indexes of valid displayed rows.
- //===========================================================================
- // CXTPSyntaxEditCtrl::CAverageVal
- //===========================================================================
- class CAverageVal
- {
- public:
- CAverageVal(int nDataSize = 100);
- void AddValue(UINT uVal);
- UINT GetAverageValue(UINT uDefaultIfNoData = 0);
- protected:
- int m_nDataSize;
- int m_nNextIndex;
- CUIntArray m_arData;
- };
- CAverageVal m_aveRedrawScreenTime;
- //===========================================================================
- CXTPSyntaxEditDrawTextProcessor m_DrawTextProcessor;
- CXTPImmWrapper m_ImmWrapper;
- BOOL m_bIMEsupported;
- public:
- BOOL m_bDisableRedraw; // If TRUE - control window is not redraw, it is draw last window content (draw cached bitmap). FALSE by default.
- BOOL m_bDeleteOnFinalRelease; // If TRUE - Delete self OnFinalRelease() call.
- };
- /////////////////////////////////////////////////////////////////////////////
- AFX_INLINE void CXTPSyntaxEditCtrl::InvalidateRow(int nDispRow) {
- InvalidateRows(nDispRow, nDispRow);
- }
- AFX_INLINE BOOL CXTPSyntaxEditCtrl::GetAutoIndent() const {
- return m_bAutoIndent;
- }
- AFX_INLINE BOOL CXTPSyntaxEditCtrl::GetSyntaxColor() const {
- return m_bSyntaxColor;
- }
- AFX_INLINE BOOL CXTPSyntaxEditCtrl::GetSelMargin() const {
- return m_bSelMargin;
- }
- AFX_INLINE CXTPSyntaxEditBufferManager* CXTPSyntaxEditCtrl::GetEditBuffer() {
- return m_pBuffer;
- }
- AFX_INLINE CXTPSyntaxEditPaintManager* CXTPSyntaxEditCtrl::GetPaintManager() {
- return m_pPaintManeger;
- }
- AFX_INLINE BOOL CXTPSyntaxEditCtrl::GetHorzScrollBar() const {
- return m_bHorzScrollBar;
- }
- AFX_INLINE BOOL CXTPSyntaxEditCtrl::GetVertScrollBar() const {
- return m_bVertScrollBar;
- }
- AFX_INLINE BOOL CXTPSyntaxEditCtrl::IsActive() const {
- return m_bIsActive;
- }
- AFX_INLINE BOOL CXTPSyntaxEditCtrl::IsCreateScrollbarOnParent() const {
- return m_bCreateScrollbarOnParent;
- }
- AFX_INLINE void CXTPSyntaxEditCtrl::SetCreateScrollbarOnParent(BOOL bSet) {
- m_bCreateScrollbarOnParent = bSet;
- }
- AFX_INLINE CXTPSyntaxEditDrawTextProcessor& CXTPSyntaxEditCtrl::GetDrawTextProcessor() {
- return m_DrawTextProcessor;
- }
- AFX_INLINE BOOL CXTPSyntaxEditCtrl::IsEnabledVirtualSpace() const {
- return m_bVirtualSpace;
- }
- AFX_INLINE CXTPSyntaxEditSelection& CXTPSyntaxEditCtrl::GetSelection() {
- return m_Selection;
- }
- AFX_INLINE CXTPSyntaxEditAutoCompleteWnd* CXTPSyntaxEditCtrl::GetAutoCompleteWnd() {
- return m_pAutoComplete;
- }
- AFX_INLINE BOOL CXTPSyntaxEditCtrl::IsReadOnly() {
- return m_bReadOnly;
- }
- AFX_INLINE void CXTPSyntaxEditCtrl::SetReadOnly(BOOL bReadOnly) {
- m_bReadOnly = bReadOnly;
- if (m_hWnd)
- Invalidate(FALSE);
- }
- AFX_INLINE BOOL CXTPSyntaxEditCtrl::IsHideCaret() {
- return m_bHideCaret;
- }
- AFX_INLINE void CXTPSyntaxEditCtrl::SetHideCaret(BOOL bHide) {
- m_bHideCaret = bHide;
- if (m_hWnd)
- Invalidate(FALSE);
- }
- AFX_INLINE BOOL CXTPSyntaxEditCtrl::GetCollapsibleNodes() const {
- return m_bDrawNodes;
- }
- AFX_INLINE BOOL CXTPSyntaxEditCtrl::IsEnabledEditAccelerators() {
- return m_bEnableEditAccelerators;
- }
- AFX_INLINE void CXTPSyntaxEditCtrl::EnableEditAccelerators(BOOL bEnable) {
- m_bEnableEditAccelerators = bEnable;
- }
- AFX_INLINE BOOL CXTPSyntaxEditCtrl::_IsVirtualSpaceActive() const {
- BOOL bVirtualSpace = IsEnabledVirtualSpace();
- return bVirtualSpace;
- }
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(__XTPSYNTAXEDITSYNTAXEDITCTRL_H__)