OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #ifndef _JS_CONSOLE_H_ | |
8 #define _JS_CONSOLE_H_ | |
9 | |
10 #include "../res/resource.h" | |
11 | |
12 #define WST_NONE 0x00 // No si
ze changed | |
13 #define WST_LEFT 0x01 // size
to left | |
14 #define WST_TOP 0x02 // size
to top | |
15 #define WST_RIGHT 0x04 // size
to right | |
16 #define WST_BOTTOM 0x08 // size
to bottom | |
17 #define WST_TOPLEFT (WST_TOP|WST_LEFT) // size to top &
left | |
18 #define WST_TOPRIGHT (WST_TOP|WST_RIGHT) // size to top & right | |
19 #define WST_BOTTOMRIGHT (WST_BOTTOM|WST_RIGHT) // size to bottom & right | |
20 #define WST_BOTTOMLEFT (WST_BOTTOM|WST_LEFT) // size to bottom & right | |
21 | |
22 #ifndef IDC_DLGSIZEBOX | |
23 #define IDC_DLGSIZEBOX 50 | |
24 #endif /* IDC_DLGSIZEBOX */ | |
25 | |
26 enum { m_idSizeIcon = IDC_DLGSIZEBOX }; | |
27 enum { // possible Control reSize Type | |
28 CST_NONE = 0, | |
29 CST_RESIZE, // NOMOVE + SIZE, add all delta-size of dlg to c
ontrol | |
30 CST_REPOS, // MOVE(absolutely) + NOSIZE, move control's pos
by delta-size | |
31 CST_RELATIVE, // MOVE(proportional) + NOSIZE, keep control always at
a relative pos | |
32 CST_ZOOM, // MOVE + SIZE (both are automatically proportio
nal) | |
33 CST_DELTA_ZOOM // MOVE(proportional, set manually) + SIZE(proportional,
set manuall) | |
34 }; | |
35 | |
36 // contained class to hold item state | |
37 // | |
38 class CJS_ItemCtrl | |
39 { | |
40 public: | |
41 UINT m_nID; | |
42 UINT m_stxLeft : 4; // when left resizing ..
. | |
43 UINT m_stxRight : 4; // when right resizing .
.. | |
44 UINT m_styTop : 4; // when top resizing ... | |
45 UINT m_styBottom : 4; // when bottom resizing
... | |
46 UINT m_bFlickerFree : 1; | |
47 UINT m_bInvalidate : 1; // Invalidate ctrl's rec
t(eg. no-automatical update for static when resize+move) | |
48 UINT m_r0 : 14; | |
49 CRect m_wRect; | |
50 double m_xRatio, m_cxRatio; | |
51 double m_yRatio, m_cyRatio; | |
52 | |
53 protected: | |
54 void Assign(const CJS_ItemCtrl& src); | |
55 | |
56 public: | |
57 CJS_ItemCtrl(); | |
58 CJS_ItemCtrl(const CJS_ItemCtrl& src); | |
59 | |
60 HDWP OnSize(HDWP hdwp, int sizeType, CRect *pnCltRect, CRect *poCltRect,
CRect *pR0, CWnd *pDlg); | |
61 | |
62 CJS_ItemCtrl& operator=(const CJS_ItemCtrl& src); | |
63 }; | |
64 | |
65 class CJS_ResizeDlg : public CDialog | |
66 { | |
67 // DECLARE_DYNAMIC(CJS_ResizeDlg) | |
68 public: | |
69 CJS_ResizeDlg(UINT nID,CWnd *pParentWnd = NULL); | |
70 virtual ~CJS_ResizeDlg(); | |
71 | |
72 | |
73 public: | |
74 std::vector<CJS_ItemCtrl> m_Items; // array of controlle
d items | |
75 CRect m_cltRect, m_cltR0; | |
76 int m_xMin, m_yMin; | |
77 int m_xSt, m_ySt;
//step? | |
78 UINT m_nDelaySide; //drag s
ide of window | |
79 CStatic m_wndSizeIcon; // size icon
window | |
80 | |
81 protected: | |
82 void AddControl( UINT nID, int xl, in
t xr, int yt, int yb, int bFlickerFree = 0, | |
83 doub
le xRatio = -1.0, double cxRatio = -1.0, | |
84 doub
le yRatio = -1.0, double cyRatio = -1.0 ); | |
85 void AllowSizing(int xst, int yst); | |
86 void HideSizeIcon(void); | |
87 virtual BOOL OnInitDialog(); | |
88 | |
89 void OnSizing(UINT nSide, LPRECT lpRe
ct); | |
90 void OnSize(UINT nType, int cx, int c
y); | |
91 void OnGetMinMaxInfo(MINMAXINFO *pmmi
); | |
92 BOOL OnEraseBkgnd(CDC* pDC); | |
93 | |
94 public: | |
95 int UpdateControlRect(UINT n
ID, CRect *pnr); | |
96 }; | |
97 | |
98 | |
99 //------------------------CIconListBox for CWndElementList----------------------
--------------- | |
100 | |
101 class CIconListBox : public CListBox | |
102 { | |
103 public: | |
104 CIconListBox(); | |
105 virtual ~CIconListBox(); | |
106 | |
107 public: | |
108 int InsertString(int nIndex, LPCWSTR lpszIte
m , int nImage); | |
109 virtual void ResetContent(); | |
110 virtual void GetText(int nIndex, CString& rString); | |
111 | |
112 virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); | |
113 void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStr
uct); | |
114 int CompareItem(LPCOMPAREITEMSTRUCT lpCompar
eItemStruct); | |
115 | |
116 protected: | |
117 // Generated message map functions | |
118 //{{AFX_MSG(CIconListBox) | |
119 afx_msg void OnMouseMove(UINT nFlags, CPoint point); | |
120 //}}AFX_MSG | |
121 DECLARE_MESSAGE_MAP() | |
122 | |
123 protected: | |
124 struct ItemDatas | |
125 { | |
126 CString csText; | |
127 int nImage; | |
128 }; | |
129 }; | |
130 //----------------------------------CWndElementList-----------------------------
--------------- | |
131 #define IDC_LIST_JS_ELEMENT 10070 | |
132 | |
133 #define ELEMENT_LIST_WIDTH 140 | |
134 #define ELEMENT_LIST_HEIGHT 180 | |
135 #define ELEMENT_LIST_TOP_OFFSET 13 | |
136 | |
137 #define ELEMENT_TYPE_NAME 0 | |
138 #define ELEMENT_TYPE_CONST 1 | |
139 #define ELEMENT_TYPE_FUN 2 | |
140 #define ELEMENT_TYPE_PRO 3 | |
141 | |
142 class CWndElementList : public CWnd | |
143 { | |
144 public: | |
145 CWndElementList(); | |
146 virtual ~CWndElementList(); | |
147 | |
148 public: | |
149 virtual void OnSize(UINT nType, int cx, int cy); | |
150 virtual BOOL Create(CWnd* pParentWnd); | |
151 virtual BOOL ShowWindow(int nCmdShow); | |
152 void RemoveAllElement(); | |
153 void SetElementList(LPCWSTR* pElement, int* pType ,
int iCount); | |
154 void AddElement(CFX_WideString csValue , int nType); | |
155 BOOL GetElementSel(CString &csElement); | |
156 BOOL SelectNext(); | |
157 BOOL SelectPrevious(); | |
158 BOOL SelectFirst(); | |
159 BOOL SelectLast(); | |
160 BOOL SelectNextPage(); | |
161 BOOL SelectPreviousPage(); | |
162 int GetListHeight(); | |
163 | |
164 protected: | |
165 // Generated message map functions | |
166 //{{AFX_MSG(CWndElementList) | |
167 afx_msg void OnPaint(); | |
168 afx_msg BOOL OnNcActivate(BOOL bActive); | |
169 afx_msg void OnSelJSElement(); | |
170 afx_msg void OnDblclkJSElement(); | |
171 afx_msg void OnDestroy(); | |
172 //}}AFX_MSG | |
173 DECLARE_MESSAGE_MAP() | |
174 protected: | |
175 CIconListBox m_ListBox; | |
176 BOOL m_bBlock; | |
177 }; | |
178 | |
179 ////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// | |
180 // CJS_ConsoleDlg ¶Ô»°¿ò | |
181 class CJS_ConsoleDlg : public CJS_ResizeDlg | |
182 { | |
183 DECLARE_DYNAMIC(CJS_ConsoleDlg) | |
184 | |
185 public: | |
186 CJS_ConsoleDlg(CReader_App* pApp, CWnd* pParent); | |
187 virtual ~CJS_ConsoleDlg(); | |
188 | |
189 enum { IDD = IDD_JS_CONSOLE }; | |
190 | |
191 void Create(); | |
192 | |
193 void AppendConsoleText(const CFX_WideString&
swText); | |
194 void SetConsoleText(const CFX_WideString& swT
ext); | |
195 CFX_WideString GetConsoleText() const; | |
196 CFX_WideString GetScriptText() const; | |
197 | |
198 BOOL ResetElementList(LPCWSTR lpstrRef); | |
199 IFXJS_Runtime* GetJSRuntime(); | |
200 | |
201 protected: | |
202 virtual void DoDataExchange(CDataExchange* pDX); // DDX/D
DV Ö§³Ö | |
203 | |
204 protected: | |
205 virtual BOOL OnInitDialog(); | |
206 virtual void OnCancel(); | |
207 | |
208 virtual BOOL PreTranslateMessage(MSG* pMsg); | |
209 | |
210 protected: | |
211 // Generated message map functions | |
212 //{{AFX_MSG(CJS_ConsoleDlg) | |
213 afx_msg void OnBnClickedClear(); | |
214 afx_msg void OnBnClickedOk(); | |
215 afx_msg void OnBnClickTips(); | |
216 afx_msg void OnSizing(UINT nSide, LPRECT lpRect); | |
217 afx_msg void OnSize(UINT nType, int cx, int cy); | |
218 afx_msg void OnGetMinMaxInfo(MINMAXINFO *pmmi); | |
219 afx_msg BOOL OnEraseBkgnd(CDC* pDC); | |
220 afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); | |
221 | |
222 afx_msg void OnLButtonDown(UINT nFlags, CPoint point); | |
223 afx_msg void OnChangeScriptEdit(WPARAM wParam , LPARAM lParam); | |
224 afx_msg void OnMove(int x , int y); | |
225 public: | |
226 virtual int DoModal(); | |
227 //}}AFX_MSG | |
228 DECLARE_MESSAGE_MAP() | |
229 | |
230 public: | |
231 CGW_LineNumberEdit m_edtSC; | |
232 BOOL m_bTips; | |
233 const UINT m_uTextlimited; | |
234 FX_HGLOBAL m_hGlobal; | |
235 CReader_App * m_pApp; | |
236 CWndElementList m_WndElementList; | |
237 }; | |
238 | |
239 #endif //_JS_CONSOLE_H_ | |
OLD | NEW |