00001 //=================================================================================================// 00002 // filename: RmMFCEditorTextCtrl.h // 00003 // // 00004 // author: Toshiaki Tsuji // 00005 // ATI Research, Inc. // 00006 // 3D Application Research Group // 00007 // // 00008 // description: Shader Editor TextCtrl 00009 // // 00010 //=================================================================================================// 00011 // $File: //depot/3darg/Tools/RenderMonkey/sdk/Include/MFCUtilities/RmMFCEditorTextCtrl.h $ 00012 // $Author: tsuji $ $Revision: #7 $ 00013 //=================================================================================================// 00014 // (C) 2002 ATI Research, Inc. All rights reserved. // 00015 //=================================================================================================// 00016 00017 #ifndef RM_MFC_EDITOR_TEXT_CTRL_H 00018 #define RM_MFC_EDITOR_TEXT_CTRL_H 00019 00020 //#include "RmShaderEditorTypes.h" 00021 00022 //=================================================================================================// 00023 // Forward Declaration 00024 //=================================================================================================// 00025 class RmMFCShaderSyntaxParser; 00026 00027 //..............................................................................................................// 00028 //..............................................................................................................// 00029 //..............................................................................................................// 00030 //..............................................................................................................// 00031 // 00032 // TextEditor using BCGEdit 00033 // 00034 //..............................................................................................................// 00035 //..............................................................................................................// 00036 //..............................................................................................................// 00037 //..............................................................................................................// 00038 class RMMFCUTIL_API RmMFCShaderEditorTextCtrl : public CBCGPEditCtrl 00039 { 00040 DECLARE_DYNCREATE(RmMFCShaderEditorTextCtrl) 00041 00042 public : 00043 RmMFCShaderEditorTextCtrl(); 00044 virtual ~RmMFCShaderEditorTextCtrl(); 00045 00046 //-------------------------------------------------------------------------------------------------/ 00047 // Load Parsing Rules 00048 //-------------------------------------------------------------------------------------------------/ 00049 void LoadParsingRule( const RM_TCHAR *szFileName ); 00050 00051 //-------------------------------------------------------------------------------------------------/ 00052 // Load Keywords from SyntaxParser 00053 //-------------------------------------------------------------------------------------------------/ 00054 void LoadKeywords( RmMFCShaderSyntaxParser *pSyntaxParser ); 00055 00056 //--------------------------------------------------------------------- 00057 // Highlighting 00058 //--------------------------------------------------------------------- 00059 void SetHighlightColor( COLORREF highlightColor ) { m_highlightCiolor = highlightColor; }; 00060 COLORREF GetHightlightColor() const { return m_highlightCiolor; }; 00061 00062 void HighlightLine( int lineNumber ); 00063 00064 //--------------------------------------------------------------------- 00065 // Modified Flag 00066 //--------------------------------------------------------------------- 00067 void SetModified( bool bModified ); 00068 00069 //--------------------------------------------------------------------- 00070 // Font 00071 //--------------------------------------------------------------------- 00072 void SetActiveFont( CFont *pFont ); 00073 00074 //--------------------------------------------------------------------- 00075 // Go to spacified line 00076 //--------------------------------------------------------------------- 00077 void GotoLine( int lineNumber ); 00078 00079 //-------------------------------------------------------------------------------------------------/ 00080 // Tab Related 00081 //-------------------------------------------------------------------------------------------------/ 00082 void UseSpaceForTabs( bool bUseSpace ) { m_bKeepTabs = !bUseSpace; }; 00083 bool IsUseSpaceForTabs() const 00084 { 00085 if (m_bKeepTabs) 00086 return true; 00087 else 00088 return false; 00089 }; 00090 00091 void SetTabSize( int tabSize ) { m_nTabSize = tabSize; }; 00092 int GetTabSize() const { return m_nTabSize; }; 00093 00094 void SetIndentSize( int indentSize ) { m_nIndentSize = indentSize; }; 00095 int GetIndentSize() const { return m_nIndentSize; }; 00096 00097 // Update vertical scroll bar 00098 void UpdateVertScrollBar(); 00099 00100 // Access color block 00101 CList <BCGP_EDIT_COLOR_BLOCK, BCGP_EDIT_COLOR_BLOCK&>& GetBlcokList() { return m_lstColorBlocks; }; 00102 00103 protected : 00104 //-------------------------------------------------------------------------------------------------/ 00105 // Override this to customize right click popup 00106 //-------------------------------------------------------------------------------------------------/ 00107 virtual void EditPopupMenu( CMenu &menu ); 00108 00109 // BCGEdit will call this whenever text is changed 00110 virtual void OnAfterTextChanged( int nOffsetFrom, const CString &strText, 00111 BOOL bInserted ); 00112 00113 // BCGEdit will call this whenever caret's position changed 00114 virtual void OnSetCaret(); 00115 00116 // Get CodeTitle 00117 virtual RmStringT GetCodeTitle(); 00118 00119 private : 00120 COLORREF m_highlightCiolor; 00121 CFont *m_pFont; 00122 00123 //-------------------------------------------------------------------------------------------------/ 00124 // Selected Text 00125 //-------------------------------------------------------------------------------------------------/ 00126 CString GetSelectedText(); 00127 00128 //-------------------------------------------------------------------------------------------------/ 00129 // Find and Replace 00130 //-------------------------------------------------------------------------------------------------/ 00131 CFindReplaceDialog *m_pFindReplaceDlg; 00132 00133 bool FindNext(); 00134 bool ReplaceCurrent(); // Returns true if replace happened 00135 void ReplaceAll(); 00136 00137 RM_TCHAR* m_strFindReplace; // A storage buffer for the find / replace dialog 00138 int m_findDlgPosX; 00139 int m_findDlgPosY; 00140 00141 bool m_bFindReplaceWholeWord; 00142 bool m_bFindReplaceCaseSensitive; 00143 00144 COLORREF m_highlightColor; 00145 00146 protected : 00147 //{{AFX_VIRTUAL(RmMFCShaderEditorTextCtrl) 00148 virtual BOOL OnWndMsg( UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult ); 00149 //}}AFX_VIRTUAL 00150 00151 //{{AFX_MSG(RmMFCShaderEditorTextCtrl) 00152 afx_msg void OnRButtonDown( UINT nFlags, CPoint point ); 00153 00154 afx_msg void OnEditCut(); 00155 afx_msg void OnEditCopy(); 00156 afx_msg void OnEditPaste(); 00157 afx_msg void OnEditClear(); 00158 afx_msg void OnEditFind(); 00159 afx_msg void OnEditReplace(); 00160 afx_msg void OnEditSelectAll(); 00161 00162 afx_msg void OnUndo(); 00163 afx_msg void OnRedo(); 00164 00165 afx_msg void OnFilePrint(); 00166 00167 // Regsistered Message 00168 afx_msg LRESULT OnFind(WPARAM, LPARAM); 00169 00170 // Handle getting focus event 00171 afx_msg void OnSetFocus( CWnd* pOldWnd ); 00172 00173 //}}AFX_MSG 00174 DECLARE_MESSAGE_MAP() 00175 }; // End of RmMFCShaderEditorTextCtrl 00176 00177 #endif
1.3.6