/** * @file XTPSyntaxEditPropertiesPage.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPSYNTAXEDITPROPERTIESPAGE_H__) # define __XTPSYNTAXEDITPROPERTIESPAGE_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPSyntaxEditPropertiesDlg; class CXTPSyntaxEditView; class CXTPSyntaxEditTextSchemesManager; class CXTPSyntaxEditPaintManager; struct XTP_EDIT_SCHEMAFILEINFO; class CXTPSyntaxEditConfigurationManager; /** @cond */ namespace XTPSyntaxEditLexAnalyser /** @endcond */ { class CXTPSyntaxEditLexPropInfoArray; class CXTPSyntaxEditLexClassInfoArray; struct XTP_EDIT_LEXCLASSINFO; struct XTP_EDIT_LEXPROPINFO; } // namespace XTPSyntaxEditLexAnalyser /** * @brief * CXTPSyntaxEditTipWnd implements a tooltip window for * the CXTPSyntaxEditTipListBox class. */ class _XTP_EXT_CLASS CXTPSyntaxEditTipWnd : public CWnd { public: /** * @brief * Default object constructor. */ CXTPSyntaxEditTipWnd(); /** * @brief * Default object destructor. */ virtual ~CXTPSyntaxEditTipWnd(); /** * @brief * Create a tooltip window. * @param pListBox Pointer to a CListBox to attach. * @return * TRUE if successful, otherwise FALSE. * @see * ShowTip */ virtual BOOL Create(CListBox* pListBox); using CWnd::Create; /** * @brief * Determines if the attached list box has owner draw flags * (LBS_OWNERDRAWFIXED or LBS_OWNERDRAWVARIABLE). * @return * TRUE if the attached list box is owner drawn, otherwise FALSE. * @see * CListBox, LBS_OWNERDRAWFIXED, LBS_OWNERDRAWVARIABLE */ virtual BOOL IsOwnerDrawn(); /** * @brief * Shows the tooltip for a specified list box item. * @param iIndex Index of the list box item to show the tooltip for. * @return * TRUE if successful, otherwise FALSE. * @see * HideTip */ virtual BOOL ShowTip(int iIndex); /** * @brief * Hides the tooltip. * @return * TRUE if the tooltip was visible prior to using this method and * was successfully hidden by using this method, * FALSE if the tooltip was hidden prior to using this method. * @see * ShowTip */ virtual BOOL HideTip(); /** * @brief * Gets the tooltip text color. * @return * The tooltip text color. * @see * GetBackColor */ virtual COLORREF GetTextColor() const; /** * @brief * Gets the tooltip background color. * @return * The tooltip background color. * @see * GetTextColor */ virtual COLORREF GetBackColor() const; protected: /** * @brief * Registers the window class if it has not already been registered. * @param hInstance Instance of the resource where the control is located. * @return * TRUE if the window class was successfully registered, otherwise FALSE. */ virtual BOOL RegisterWindowClass(HINSTANCE hInstance = NULL); /** * @brief * Draws the tooltip for the owner drawn list box. * @param pDC Pointer to a valid device context. * @param rClient Tooltip rectangle (in client coordinates of this window). * @return * TRUE if successful, otherwise FALSE. * @see * DrawTip */ virtual BOOL OwnerDrawTip(CDC* pDC, CRect rClient); /** * @brief * Draws the tooltip. * @param pDC Pointer to a valid device context. * @param rClient Tooltip rectangle (in client coordinates of this window). * @return * TRUE if successful, otherwise FALSE. * @see * OwnerDrawTip */ virtual BOOL DrawTip(CDC* pDC, CRect rClient); /** * @brief * Gets the rectangle for a specified item. * @param iItem [in] List box item index. * @param rItem [out] Reference to a CRect object to receive * the rectangle for the specified item. * @return * TRUE if successful, otherwise FALSE. */ virtual BOOL CalcItemRect(int iItem, CRect& rItem); //{{AFX_VIRTUAL(CXTPSyntaxEditTipWnd) //}}AFX_VIRTUAL /** @cond */ # ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; # endif /** @endcond */ /** @cond */ afx_msg void OnPaint(); afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg LRESULT OnNcHitTest(CPoint point); afx_msg void OnNcPaint(); DECLARE_MESSAGE_MAP() /** @endcond */ protected: int m_iIndex; /**< Current item index. */ CRect m_rWindow; /**< Window rect. */ CPoint m_ptCursor; /**< Cursor position. */ CListBox* m_pListBox; /**< Pointer to the attached list box. */ private: void SetTipTimer(); void KillTipTimer(); UINT m_uIDEvent1; UINT m_uIDEvent2; }; /** * @brief * This class implements a list box with a tooltip. */ class _XTP_EXT_CLASS CXTPSyntaxEditTipListBox : public CListBox { public: /** * @brief * Default object constructor. */ CXTPSyntaxEditTipListBox(); /** * @brief * Determines which list box item, if any, is at a specified point. * @param pPoint Pointer to a POINT object or a NULL value. If the value of this * parameter is NULL, then the current mouse coordinates are used. * @return * The list box item index at the specified point, if any, otherwise LB_ERR. */ int HitTest(LPPOINT pPoint = NULL) const; /** * @brief * Determines which list box item, if any, is at a specified point. * @param point Point to be tested. * @param bIsClient TRUE if the point contains client coordinates, * FALSE if the point contains screen coordinates. * @return * The list box item index at the specified point, if any, otherwise LB_ERR. */ int HitTest(CPoint point, BOOL bIsClient = FALSE) const; /** * @brief * Shows the tooltip at a specified point, if any. * @param point Point to be tested. * @param bIsClient TRUE if the point contains client coordinates, * FALSE if the point contains screen coordinates. * @return * The list box item index at the specified point, if any, otherwise LB_ERR. */ int ShowTip(CPoint point, BOOL bIsClient = FALSE); /** * @brief * Determines if the selection was changed by the user. * @return * TRUE if the selection was changed by the user, otherwise FALSE. */ BOOL SelChanged(); // const; protected: /** @cond */ virtual BOOL PreTranslateMessage(MSG* pMsg); /** @endcond */ protected: DWORD m_dwIdx; /**< Selection indexes: LOWORD - previous selection index, HIWORD - active selection index. */ CXTPSyntaxEditTipWnd m_wndInfoTip; /**< Tooltip window. */ }; /** * @brief * This class implements a combo box with a tooltip. */ class _XTP_EXT_CLASS CXTPSyntaxEditTipComboBox : public CComboBox { public: /** * @brief * Gets the attached list box. * @return * A reference to the attached list box. * @see * CXTPSyntaxEditTipListBox */ CXTPSyntaxEditTipListBox& GetListBox(); protected: /** @cond */ afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); afx_msg void OnDestroy(); DECLARE_MESSAGE_MAP() /** @endcond */ private: CXTPSyntaxEditTipListBox m_wndListBox; }; AFX_INLINE CXTPSyntaxEditTipListBox& CXTPSyntaxEditTipComboBox::GetListBox() { return m_wndListBox; } /** * @brief * This class implements a property page for common edit options. */ class _XTP_EXT_CLASS CXTPSyntaxEditPropertiesPageEdit : public CPropertyPage { /** @cond */ DECLARE_DYNCREATE(CXTPSyntaxEditPropertiesPageEdit) /** @endcond */ public: /** * @brief * Default object constructor. * @param pEditView Pointer to a CXTPSyntaxEditView object. */ CXTPSyntaxEditPropertiesPageEdit(CXTPSyntaxEditView* pEditView = NULL); /** * @brief * Default object destructor. */ virtual ~CXTPSyntaxEditPropertiesPageEdit(); /** @cond */ enum { IDD = XTP_IDD_EDIT_PAGEEDITOR }; BOOL m_bAutoReload; BOOL m_bHorzScrollBar; BOOL m_bVertScrollBar; BOOL m_bSyntaxColor; BOOL m_bAutoIndent; BOOL m_bSelMargin; BOOL m_bLineNumbers; BOOL m_bVirtualSpace; BOOL m_bCollapsibleNodes; int m_nCaretStyle; int m_nTabType; int m_nTabSize; CButton m_btnRadioSpaces; CButton m_btnRadioTab; CButton m_btnRadioCaretThin; CButton m_btnRadioCaretThick; protected: virtual void DoDataExchange(CDataExchange* pDX); /**< DDX/DDV support */ public: virtual BOOL OnApply(); /** @endcond */ protected: /** * @brief * Reads controls state (options) from the registry. * @return * TRUE if successful, otherwise FALSE. * @see * WriteRegistryValues */ BOOL ReadRegistryValues(); /** * @brief * Writes controls state (options) to the registry. * @return * TRUE if successful, otherwise FALSE. * @see * ReadRegistryValues */ BOOL WriteRegistryValues(); /** * @brief * Sets the value of the modified flag. * @param bChanged TRUE if options were modified, FALSE otherwise. * @see * CPropertyPage::SetModified */ void SetModified(BOOL bChanged = TRUE); /** @cond */ virtual BOOL OnInitDialog(); afx_msg void OnChkAutoReload(); afx_msg void OnChkHorzScrollBar(); afx_msg void OnChkVertScrollBar(); afx_msg void OnChkSyntaxColor(); afx_msg void OnChkAutoIndent(); afx_msg void OnChkSelMargin(); afx_msg void OnChkLineNumbers(); afx_msg void OnChkVirtualSpace(); afx_msg void OnChangeTabsSize(); afx_msg void OnTabsSpaces(); afx_msg void OnTabsTab(); afx_msg void OnCaretThin(); afx_msg void OnCaretThick(); DECLARE_MESSAGE_MAP() /** @endcond */ protected: BOOL m_bModified; /**< Modified flag. */ CXTPSyntaxEditView* m_pEditView; /**< Pointer to a CXTPSyntaxEditView object. */ }; /** * @brief * This class implements property page font options. */ class _XTP_EXT_CLASS CXTPSyntaxEditPropertiesPageFont : public CPropertyPage { /** @cond */ DECLARE_DYNCREATE(CXTPSyntaxEditPropertiesPageFont) /** @endcond */ public: /** * @brief * Default object constructor. * @param pEditView Pointer to a CXTPSyntaxEditView object. */ CXTPSyntaxEditPropertiesPageFont(CXTPSyntaxEditView* pEditView = NULL); /** * @brief * Default object destructor. */ virtual ~CXTPSyntaxEditPropertiesPageFont(); /** * @brief * Gets the editor font. * @return * A reference to the editor font. * @see * GetSafeLogFont */ CFont& GetEditFont(); /** * @brief * Gets the LOGFONT data for the editor font object. * @param lf Reference to a LOGFONT structure to receive the font data. * @return * TRUE if the font data was obtained, otherwise FALSE. * @see * GetEditFont */ BOOL GetSafeLogFont(LOGFONT& lf); /** * @brief * Sets the font for a specified CFont object. * @param editFont Reference to the CFont object to set the font of. * @param lf Reference to a LOGFONT structure containing * the font to be set. * @details * The previous font will be deleted. * @return * TRUE if successful, otherwise FALSE. * @see * CFont::CreateFontIndirect */ BOOL CreateSafeFontIndirect(CFont& editFont, const LOGFONT& lf); /** @cond */ enum { IDD = XTP_IDD_EDIT_PAGEFONT }; CXTPSyntaxEditColorComboBox m_wndComboHiliteText; CXTPSyntaxEditColorComboBox m_wndComboHiliteBack; CXTPSyntaxEditColorComboBox m_wndComboText; CXTPSyntaxEditColorComboBox m_wndComboBack; CXTPSyntaxEditColorSampleText m_txtSampleSel; CXTPSyntaxEditColorSampleText m_txtSample; CButton m_btnCustomText; CButton m_btnCustomBack; CButton m_btnCustomHiliteText; CButton m_btnCustomHiliteBack; CXTPSyntaxEditTipComboBox m_wndComboScript; CXTPSyntaxEditTipComboBox m_wndComboStyle; CXTPSyntaxEditTipComboBox m_wndComboSize; CXTPSyntaxEditTipComboBox m_wndComboName; BOOL m_bStrikeOut; BOOL m_bUnderline; CString m_csName; CString m_csSize; CString m_csStyle; COLORREF m_crHiliteText; COLORREF m_crHiliteBack; COLORREF m_crText; COLORREF m_crBack; /** @endcond */ /** @cond */ protected: virtual void DoDataExchange(CDataExchange* pDX); /**< DDX/DDV support */ public: virtual BOOL OnApply(); /** @endcond */ protected: /** * @brief * Initializes the font name combo box. */ void InitFontCombo(); /** * @brief * Initializes the font style combo box. */ void InitStyleCombo(); /** * @brief * Initializes the font size combo box. */ void InitSizeCombo(); /** * @brief * Initializes the font script combo box. */ void InitScriptCombo(); /** * @brief * Initializes the color combo box. */ void InitColorComboxes(); /** * @brief * Updates the font for a sample text control. */ void UpdateSampleFont(); /** * @brief * Updates the colors for a sample text control. */ void UpdateSampleColors(); /** * @brief * Gets the text of the selected list box item and updates * the combo box. * @param comboBox [in] Reference to a CComboBox object. * @param csItemText [out] Reference to a CString to receive the text of * the selected list box item. * @return * The index of the selected list box item if successful, otherwise CB_ERR. * @see * CComboBox::GetLBText */ int GetLBText(CComboBox& comboBox, CString& csItemText); /** * @brief * Reads controls state (options) from the registry. * @return * TRUE if successful, otherwise FALSE. * @see * WriteRegistryValues */ BOOL ReadRegistryValues(); /** * @brief * Writes controls state (options) to the registry. * @return * TRUE if successful, otherwise FALSE. * @see * ReadRegistryValues */ BOOL WriteRegistryValues(); /** * @brief * Sets the value of the modified flag. * @param bChanged TRUE if options were modified, FALSE otherwise. * @see * CPropertyPage::SetModified */ void SetModified(BOOL bChanged = TRUE); /** * @brief * Gets the edit control paint manager. * @return * A pointer to the edit control paint manager. */ CXTPSyntaxEditPaintManager* GetPaintManager(); /** @cond */ virtual BOOL OnInitDialog(); afx_msg void OnSelChangeComboNames(); afx_msg void OnSelChangeComboStyles(); afx_msg void OnSelChangeComboSizes(); afx_msg void OnChkStrikeOut(); afx_msg void OnChkUnderline(); afx_msg void OnSelEndOkScript(); afx_msg void OnBtnCustomText(); afx_msg void OnBtnCustomBack(); afx_msg void OnBtnCustomHiliteText(); afx_msg void OnBtnCustomtHiliteBack(); afx_msg void OnSelEndOkHiliteText(); afx_msg void OnSelEndOkHiliteBack(); afx_msg void OnSelEndOkText(); afx_msg void OnSelEndOkBack(); DECLARE_MESSAGE_MAP() /** @endcond */ protected: const UINT m_uFaceSize; /**< Face name maximum string size. */ BYTE m_iCharSet; /**< Char set. */ BOOL m_bModified; /**< Modified flag. */ CXTPSyntaxEditView* m_pEditView; /**< Pointer to a CXTPSyntaxEditView object. */ CXTPFont m_xtpFontEdit; /**< Editor font. */ XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_editFont, m_xtpFontEdit, GetEditFontHandle); }; AFX_INLINE CFont& CXTPSyntaxEditPropertiesPageFont::GetEditFont() { return m_xtpFontEdit; } /** * @brief * This class implements property page colors options. */ class _XTP_EXT_CLASS CXTPSyntaxEditPropertiesPageColor : public CPropertyPage { /** @cond */ DECLARE_DYNCREATE(CXTPSyntaxEditPropertiesPageColor) /** @endcond */ public: /** * @brief * Default object constructor. * @param pEditView Pointer to a CXTPSyntaxEditView object. */ CXTPSyntaxEditPropertiesPageColor(CXTPSyntaxEditView* pEditView = NULL); /** * @brief * Default object destructor. */ virtual ~CXTPSyntaxEditPropertiesPageColor(); /** * @brief * Writes controls state (options) to the registry. * @return * TRUE if successful, otherwise FALSE. */ BOOL WriteRegistryValues(); /** * @brief * Sets the value of the modified flag. * @param bChanged TRUE if options were modified, FALSE otherwise. * @see * CPropertyPage::SetModified */ void SetModified(BOOL bChanged = TRUE); /** @cond */ enum { IDD = XTP_IDD_EDIT_PAGECOLOR }; CXTPSyntaxEditColorSampleText m_txtSampleSel; CXTPSyntaxEditColorSampleText m_txtSample; CXTPSyntaxEditColorComboBox m_wndComboHiliteText; CXTPSyntaxEditColorComboBox m_wndComboHiliteBack; CXTPSyntaxEditColorComboBox m_wndComboText; CXTPSyntaxEditColorComboBox m_wndComboBack; CButton m_btnBold; CButton m_btnItalic; CButton m_btnUnderline; CButton m_btnCustomText; CButton m_btnCustomBack; CButton m_btnCustomHiliteText; CButton m_btnCustomHiliteBack; CXTPSyntaxEditTipListBox m_lboxName; CXTPSyntaxEditTipListBox m_lboxProp; CStatic m_gboxSampleText; BOOL m_bBold; BOOL m_bItalic; BOOL m_bUnderline; COLORREF m_crHiliteText; COLORREF m_crHiliteBack; COLORREF m_crText; COLORREF m_crBack; public: virtual BOOL OnSetActive(); protected: virtual void DoDataExchange(CDataExchange* pDX); /**< DDX/DDV support */ public: virtual BOOL OnApply(); /** @endcond */ protected: /** * @brief * Updates the colors for a sample text control. */ void UpdateSampleColors(); /** * @brief * Updates the font for a sample text control. */ void UpdateFont(); /** * @brief * Initializes dialog controls for a specified lex schema. * @param pSchemaInfo Pointer to an XTP_EDIT_SCHEMAFILEINFO object. * @return * TRUE if successful, otherwise FALSE. */ BOOL InitSchemaClasses(XTP_EDIT_SCHEMAFILEINFO* pSchemaInfo); /** * @brief * Initializes dialog controls for a specified lex class. * @param infoClass Reference to an XTP_EDIT_LEXCLASSINFO object. */ void InitClassData(const XTPSyntaxEditLexAnalyser::XTP_EDIT_LEXCLASSINFO& infoClass); /** * @brief * Determines if a specified class is a top-level schema class. * @param infoClass Reference to an XTP_EDIT_LEXCLASSINFO object. * @return * TRUE if the specified class is a top-level schema class, otherwise FALSE. */ BOOL IsTopLevelClass(const XTPSyntaxEditLexAnalyser::XTP_EDIT_LEXCLASSINFO& infoClass); /** * @brief * Updates controls state (enabled/disabled). */ void EnableControls(); /** * @brief * Gets a specified lex property as a comma-separated string. * @param infoProp Reference to an XTP_EDIT_LEXPROPINFO object. * @return * The specified lex property as a comma-separated string. * @see * XTP_EDIT_LEXPROPINFO */ CString GetPropValue(const XTPSyntaxEditLexAnalyser::XTP_EDIT_LEXPROPINFO& infoProp) const; /** * @brief * Sets defaults controls state. */ void SetDefaults(); /** * @brief * Determines if a specified property data exists within a specified array. * @param arrProp Reference to the properties data array. * @param lpszPropName Lex property name. * @return * The index of the specified property data within the specified array * if it exists, otherwise a value of -1. */ int PropExists(XTPSyntaxEditLexAnalyser::CXTPSyntaxEditLexPropInfoArray& arrProp, LPCTSTR lpszPropName); /** * @brief * Updates the font parameters for the currently selected lex class. * @param lpszPropName Lex class property name (font attribute). * @param bValue Reference to the value to be set. * @return * TRUE if successful, otherwise FALSE. * @see * UpdateColorValue */ BOOL UpdateFontValue(BOOL& bValue, LPCTSTR lpszPropName); /** * @brief * Updates the color parameters for currently selected lex class. * @param combo Reference to an edit color combo box. * @param color Reference to the value to be set. * @param lpszPropName Lex class property name (color attribute). * @return * TRUE if successful, otherwise FALSE. * @see * UpdateFontValue */ BOOL UpdateColorValue(CXTPSyntaxEditColorComboBox& combo, COLORREF& color, LPCTSTR lpszPropName); /** * @brief * Gets the display name property value of a lex class. * @param info Reference to an XTP_EDIT_LEXCLASSINFO object. * @return * The display name property value of the lex class. */ CString GetDisplayName(const XTPSyntaxEditLexAnalyser::XTP_EDIT_LEXCLASSINFO& info) const; /** @cond */ virtual BOOL OnInitDialog(); afx_msg void OnBtnCustomText(); afx_msg void OnBtnCustomBack(); afx_msg void OnBtnCustomHiliteText(); afx_msg void OnBtnCustomtHiliteBack(); afx_msg void OnChkBold(); afx_msg void OnChkItalic(); afx_msg void OnChkUnderline(); afx_msg void OnSelEndOkHiliteText(); afx_msg void OnSelEndOkHiliteBack(); afx_msg void OnSelEndOkText(); afx_msg void OnSelEndOkBack(); afx_msg void OnSelChangeSchemaNames(); afx_msg void OnSelChangeSchemaProp(); afx_msg void OnDblClickSchema(); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); DECLARE_MESSAGE_MAP() /** @endcond */ protected: BOOL m_bModified; /**< Modified flag. */ CXTPSyntaxEditView* m_pEditView; /**< Pointer to a CXTPSyntaxEditView object. */ CXTPSyntaxEditConfigurationManager* m_ptrConfigMgr; /**< Pointer to Configuration Manager. */ CXTPSyntaxEditTextSchemesManager* m_pTextSchemesMgr; /**< Pointer to Schemes Manager. */ CXTPFont m_xtpFontEdit; /**< Editor font. */ XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_editFont, m_xtpFontEdit, GetEditFontHandle); CMapStringToPtr m_mapLexClassInfo; /**< Map lex schema name to schema classes array (CXTPSyntaxEditLexClassInfoArray*). */ XTPSyntaxEditLexAnalyser::CXTPSyntaxEditLexClassInfoArray* m_parLexClassInfo; /**< selected schema classes. */ }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPSYNTAXEDITPROPERTIESPAGE_H__) /** @endcond */