[go: up one dir, main page]

Menu

[r971]: / trunk / VTS3 / ScriptEdit.h  Maximize  Restore  History

Download this file

179 lines (150 with data), 5.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
//******************************************************************
// Author: Yajun Zhou
// Date: 2002-4-22
//******************************************************************
#if !defined(AFX_SCRIPTEDIT_H__530C4E4B_3567_4332_81F6_84274DFEA53C__INCLUDED_)
#define AFX_SCRIPTEDIT_H__530C4E4B_3567_4332_81F6_84274DFEA53C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ScriptEdit.h : header file
//
class ScriptFrame;
/////////////////////////////////////////////////////////////////////////////
// ScriptEdit view
#include "LineNumCtrl.h"
// Hold a Template name and body
struct ScriptTemplate
{
CString m_name;
CString m_body;
};
// Set of Templates
class ScriptTemplateCollection
{
public:
ScriptTemplateCollection( const char *pTheTitle );
~ScriptTemplateCollection();
void Add( ScriptTemplate &theTemplate );
int Size() const { return m_templates.GetSize(); }
LPCTSTR Title() const { return m_title; }
LPCTSTR TemplateName( int theIndex ) const { return m_templates[theIndex].m_name; }
LPCTSTR TemplateBody( int theIndex ) const { return m_templates[theIndex].m_body; }
protected:
CString m_title;
CArray<ScriptTemplate, ScriptTemplate&> m_templates;
};
// Group of template collections
class ScriptTemplateLibrary
{
public:
ScriptTemplateLibrary();
~ScriptTemplateLibrary();
void ReadFile( const char *pTheFileName );
void RemoveAll();
void FillMenu( CMenu &theMenu, bool atEnd );
LPCTSTR SectionTitle( int theIndex );
const ScriptTemplateCollection& Collection( int theIndex );
protected:
CArray<ScriptTemplateCollection*, ScriptTemplateCollection*> m_collections;
};
class ScriptEdit : public CEditView
{
private:
ScriptFrame * m_pframe;
//protected:
public:
ScriptEdit(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(ScriptEdit)
// Attributes
public:
// Operations
public:
void SetLine(int nLineIndex,LPTSTR lpszString);
int GetCurLineIndex();
void GotoLine(int nLineIndex);
void SetDefaultFont();
void SetFrame( ScriptFrame * pframe ) { m_pframe = pframe; }
//Added by Zhu Zhenhua, 2003-12-25, to help tester in inputing
bool AddInputHelpString( CString sString );
void OnHelpInput(UINT nChar, UINT nRepCnt, UINT nFlags);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(ScriptEdit)
public:
virtual void OnInitialUpdate();
protected:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~ScriptEdit();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
void FillAutoType();
void FillInsertMenu();
// Generated message map functions
protected:
int m_nTempDigit;
void ScrollCurLnVisible(UINT nChar);
BOOL IsCurLnVisible();
void UpdateEditArea();
void DisplayLnNum();
virtual void OnFindNext(LPCTSTR lpszFind, BOOL bNext, BOOL bCase);
virtual void OnReplaceSel(LPCTSTR lpszFind, BOOL bNext, BOOL bCase, LPCTSTR lpszReplace );
virtual void OnReplaceAll(LPCTSTR lpszFind, LPCTSTR lpszReplace, BOOL bCase );
//{{AFX_MSG(ScriptEdit)
afx_msg void OnSetfocus();
afx_msg void OnEditGotoline();
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnPaint();
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnHscroll();
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnVscroll();
afx_msg void OnEditCut();
afx_msg void OnEditClear();
afx_msg void OnEditPaste();
afx_msg void OnEditUndo();
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnEditRepeat();
afx_msg void OnSetTemplateFile();
afx_msg void OnTemplate(UINT nID);
afx_msg void OnEditAutoObject();
afx_msg void OnUpdateEditAutoObject(CCmdUI* pCmdUI);
afx_msg void OnEditAutoProperty();
afx_msg void OnUpdateEditAutoProperty(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CLineNumCtrl m_LineNumCtrl;
CPoint m_ptCurPoint;
CEdit* m_pEdit;
int m_nMargin;
int m_nClientX;
int m_nClientY;
int m_nCurrentLine;
int m_nFirstVisibleLn;
int m_nVisibleLnCount;
int m_nLineCount;
CStringList m_strList; //the help string list, Added by Zhu Zhenhua, 2003-12-25
CString m_templateFileName;
int m_autoObjectType;
int m_autoPropertyID;
int m_tabWidth;
static bool s_templateFileLoaded;
static ScriptTemplateLibrary s_templateLibrary;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SCRIPTEDIT_H__530C4E4B_3567_4332_81F6_84274DFEA53C__INCLUDED_)