| 1 | /// Search and replace using regular expressions (custom dialog) |
1 | /// Search and replace using regular expressions (custom dialog) |
| 2 | |
2 | |
| |
3 | // Modified by Infocatcher
|
| |
4 | // version: 0.1.3 - 2009.05.17
|
| |
5 | // Example for "Replace with function" flag:
|
| |
6 | // What: \d+
|
| |
7 | // With: parseInt($0) + 1;
|
| |
8 | // Or
|
| |
9 | // What: \d+
|
| |
10 | // With: var n = parseInt($0); return n >= 20 ? 20 : ++n;
|
| |
11 |
|
| |
12 | // In this file:
|
| |
13 | // What: (oFunction\.AddParameter\()(\d+)(\); \/\/~ [^\r\n]+, old: \d+)
|
| |
14 | // With: $1 + (parseInt($2) - 20) + $3;
|
| |
15 |
|
| 3 | var AkelPad=new ActiveXObject("AkelPad.document"); |
16 | var AkelPad=new ActiveXObject("AkelPad.document"); |
| 4 | var WshShell=new ActiveXObject("WScript.shell"); |
17 | var WshShell=new ActiveXObject("WScript.shell"); |
| 5 | |
18 | |
| 6 | var BT_FINDNEXT =1 |
19 | var BT_FINDNEXT =1 |
| 7 | var BT_REPLACE =2 |
20 | var BT_REPLACE =2 |
| 8 | var BT_REPLACEALL =3 |
21 | var BT_REPLACEALL =3 |
| 9 | |
22 | |
| 10 | var DN_DOWN =0x00000001 |
23 | var DN_DOWN =0x00000001 |
| 11 | var DN_UP =0x00000002 |
24 | var DN_UP =0x00000002 |
| 12 | var DN_BEGINNING =0x00000004 |
25 | var DN_BEGINNING =0x00000004 |
| 13 | var DN_SELECTION =0x00000008 |
26 | var DN_SELECTION =0x00000008 |
| 14 | var DN_ALLFILES =0x00000010 |
27 | var DN_ALLFILES =0x00000010 |
| 15 | |
28 | |
| 16 | //Options |
29 | //Options |
| 17 | var pFindIt=""; |
30 | var pFindIt=""; |
| 18 | var pReplaceWith=""; |
31 | var pReplaceWith=""; |
| 19 | var bSensitive=false; |
32 | var bSensitive=false; |
| 20 | var bMultiline=false; |
33 | var bMultiline=false; |
| 21 | var bEscSequences=false; |
34 | var bEscSequences=false; |
| |
35 | var bReplaceFunction=false;
|
| 22 | var nDirection=DN_DOWN; |
36 | var nDirection=DN_DOWN; |
| 23 | |
37 | |
| 24 | var hMainWnd=AkelPad.GetMainWnd(); |
38 | var hMainWnd=AkelPad.GetMainWnd(); |
| 25 | var oFunction=AkelPad.SystemFunction(); |
39 | var oFunction=AkelPad.SystemFunction(); |
| 26 | var pScriptName=WScript.ScriptName; |
40 | var pScriptName=WScript.ScriptName; |
| 27 | var hInstanceDLL=AkelPad.GetInstanceDll(); |
41 | var hInstanceDLL=AkelPad.GetInstanceDll(); |
| 28 | var hWndDialog; |
42 | var hWndDialog; |
| 29 | var hWndWhat; |
43 | var hWndWhat; |
| 30 | var hWndStatic; |
44 | var hWndStatic; |
| 31 | var hWndCase; |
45 | var hWndCase; |
| 32 | var hWndGlobal; |
46 | var hWndGlobal; |
| 33 | var hWndMultiline; |
47 | var hWndMultiline; |
| 34 | var hWndEscSequences; |
48 | var hWndEscSequences; |
| |
49 | var hWndReplaceFunction;
|
| 35 | var hWndGroup; |
50 | var hWndGroup; |
| 36 | var hWndDown; |
51 | var hWndDown; |
| 37 | var hWndUp; |
52 | var hWndUp; |
| 38 | var hWndBeginning; |
53 | var hWndBeginning; |
| 39 | var hWndSelection; |
54 | var hWndSelection; |
| 40 | var hWndAllFiles; |
55 | var hWndAllFiles; |
| 41 | var hWndFindNext; |
56 | var hWndFindNext; |
| 42 | var hWndReplace; |
57 | var hWndReplace; |
| 43 | var hWndReplaceAll; |
58 | var hWndReplaceAll; |
| 44 | var hWndCancel; |
59 | var hWndCancel; |
| 45 | var hGuiFont; |
60 | var hGuiFont; |
| 46 | var lpBuffer; |
61 | var lpBuffer; |
| 47 | var nFindItLength; |
62 | var nFindItLength; |
| 48 | var nSearchResult; |
63 | var nSearchResult; |
| 49 | var nButton=0; |
64 | var nButton=0; |
| 50 | var pReplaceWithEsc; |
65 | var pReplaceWithEsc; |
| 51 | var _TCHAR; |
66 | var _TCHAR; |
| 52 | var _TSTR; |
67 | var _TSTR; |
| 53 | var _TSIZE; |
68 | var _TSIZE; |
| 54 | |
69 | |
| 55 | if (hMainWnd) |
70 | if (hMainWnd) |
| 56 | { |
71 | { |
| 57 | if (ScriptEngineMajorVersion() <= 5 && ScriptEngineMinorVersion() < 5) |
72 | if (ScriptEngineMajorVersion() <= 5 && ScriptEngineMinorVersion() < 5) |
| 58 | { |
73 | { |
| 59 | AkelPad.MessageBox(hMainWnd, GetLangString(0), pScriptName, 48 /*MB_ICONEXCLAMATION*/); |
74 | AkelPad.MessageBox(hMainWnd, GetLangString(0), pScriptName, 48 /*MB_ICONEXCLAMATION*/); |
| 60 | WScript.Quit(); |
75 | WScript.Quit(); |
| 61 | } |
76 | } |
| 62 | |
77 | |
| 63 | if (AkelPad.IsOldWindows()) |
78 | if (AkelPad.IsOldWindows()) |
| 64 | { |
79 | { |
| 65 | _TCHAR="A"; |
80 | _TCHAR="A"; |
| 66 | _TSTR=0 /*DT_ANSI*/; |
81 | _TSTR=0 /*DT_ANSI*/; |
| 67 | _TSIZE=1 /*sizeof(char)*/; |
82 | _TSIZE=1 /*sizeof(char)*/; |
| 68 | } |
83 | } |
| 69 | else |
84 | else |
| 70 | { |
85 | { |
| 71 | _TCHAR="W"; |
86 | _TCHAR="W"; |
| 72 | _TSTR=1 /*DT_UNICODE*/; |
87 | _TSTR=1 /*DT_UNICODE*/; |
| 73 | _TSIZE=2 /*sizeof(wchar_t)*/; |
88 | _TSIZE=2 /*sizeof(wchar_t)*/; |
| 74 | } |
89 | } |
| 75 | |
90 | |
| 76 | if (AkelPad.WindowRegisterClass(pScriptName)) |
91 | if (AkelPad.WindowRegisterClass(pScriptName)) |
| 77 | { |
92 | { |
| 78 | if (lpBuffer=AkelPad.MemAlloc(256 * _TSIZE)) |
93 | if (lpBuffer=AkelPad.MemAlloc(256 * _TSIZE)) |
| 79 | { |
94 | { |
| 80 | //Create dialog |
95 | //Create dialog |
| 81 | AkelPad.MemCopy(lpBuffer, pScriptName, _TSTR); |
96 | AkelPad.MemCopy(lpBuffer, pScriptName, _TSTR); |
| 82 | oFunction.AddParameter(0); |
97 | oFunction.AddParameter(0); |
| 83 | oFunction.AddParameter(lpBuffer); |
98 | oFunction.AddParameter(lpBuffer); |
| 84 | oFunction.AddParameter(0); |
99 | oFunction.AddParameter(0); |
| 85 | oFunction.AddParameter(0x90CA0000); //WS_VISIBLE|WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX |
100 | oFunction.AddParameter(0x90CA0000); //WS_VISIBLE|WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX |
| 86 | oFunction.AddParameter(0); |
101 | oFunction.AddParameter(0); |
| 87 | oFunction.AddParameter(0); |
102 | oFunction.AddParameter(0); |
| 88 | oFunction.AddParameter(392); |
103 | oFunction.AddParameter(432); //~ dialog width, old: 392 |
| 89 | oFunction.AddParameter(223); |
104 | oFunction.AddParameter(223); |
| 90 | oFunction.AddParameter(hMainWnd); |
105 | oFunction.AddParameter(hMainWnd); |
| 91 | oFunction.AddParameter(0); //ID |
106 | oFunction.AddParameter(0); //ID |
| 92 | oFunction.AddParameter(hInstanceDLL); |
107 | oFunction.AddParameter(hInstanceDLL); |
| 93 | oFunction.AddParameter(DialogCallback); //Script function callback. To use it class must be registered by WindowRegisterClass. |
108 | oFunction.AddParameter(DialogCallback); //Script function callback. To use it class must be registered by WindowRegisterClass. |
| 94 | hWndDialog=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
109 | hWndDialog=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 95 | |
110 | |
| 96 | if (hWndDialog) |
111 | if (hWndDialog) |
| 97 | { |
112 | { |
| 98 | //Message loop |
113 | //Message loop |
| 99 | AkelPad.WindowGetMessage(); |
114 | AkelPad.WindowGetMessage(); |
| 100 | } |
115 | } |
| 101 | AkelPad.MemFree(lpBuffer); |
116 | AkelPad.MemFree(lpBuffer); |
| 102 | } |
117 | } |
| 103 | AkelPad.WindowUnregisterClass(pScriptName); |
118 | AkelPad.WindowUnregisterClass(pScriptName); |
| 104 | } |
119 | } |
| 105 | } |
120 | } |
| 106 | |
121 | |
| 107 | function DialogCallback(hWnd, uMsg, wParam, lParam) |
122 | function DialogCallback(hWnd, uMsg, wParam, lParam) |
| 108 | { |
123 | { |
| 109 | if (uMsg == 1) //WM_CREATE |
124 | if (uMsg == 1) //WM_CREATE |
| 110 | { |
125 | { |
| 111 | try |
126 | try |
| 112 | { |
127 | { |
| 113 | pFindIt=WshShell.RegRead("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Find"); |
128 | pFindIt=WshShell.RegRead("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Find"); |
| 114 | pReplaceWith=WshShell.RegRead("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Replace"); |
129 | pReplaceWith=WshShell.RegRead("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Replace"); |
| 115 | bSensitive=WshShell.RegRead("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Sensitive"); |
130 | bSensitive=WshShell.RegRead("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Sensitive"); |
| 116 | bMultiline=WshShell.RegRead("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Multiline"); |
131 | bMultiline=WshShell.RegRead("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Multiline"); |
| 117 | bEscSequences=WshShell.RegRead("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\EscSequences"); |
132 | bEscSequences=WshShell.RegRead("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\EscSequences"); |
| |
133 | bReplaceFunction=WshShell.RegRead("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\ReplaceFunction");
|
| 118 | nDirection=WshShell.RegRead("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Direction"); |
134 | nDirection=WshShell.RegRead("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Direction"); |
| 119 | } |
135 | } |
| 120 | catch (nError) |
136 | catch (nError) |
| 121 | { |
137 | { |
| 122 | } |
138 | } |
| 123 | |
139 | |
| 124 | oFunction.AddParameter(17); //DEFAULT_GUI_FONT |
140 | oFunction.AddParameter(17); //DEFAULT_GUI_FONT |
| 125 | hGuiFont=oFunction.Call("gdi32::GetStockObject"); |
141 | hGuiFont=oFunction.Call("gdi32::GetStockObject"); |
| 126 | |
142 | |
| 127 | //Dialog caption |
143 | //Dialog caption |
| 128 | AkelPad.MemCopy(lpBuffer, pScriptName, _TSTR); |
144 | AkelPad.MemCopy(lpBuffer, pScriptName, _TSTR); |
| 129 | oFunction.AddParameter(hWnd); |
145 | oFunction.AddParameter(hWnd); |
| 130 | oFunction.AddParameter(lpBuffer); |
146 | oFunction.AddParameter(lpBuffer); |
| 131 | oFunction.Call("user32::SetWindowText" + _TCHAR); |
147 | oFunction.Call("user32::SetWindowText" + _TCHAR); |
| 132 | |
148 | |
| 133 | |
149 | |
| 134 | ////Static window What |
150 | ////Static window What |
| 135 | |
151 | |
| 136 | //Create window |
152 | //Create window |
| 137 | AkelPad.MemCopy(lpBuffer, "STATIC", _TSTR); |
153 | AkelPad.MemCopy(lpBuffer, "STATIC", _TSTR); |
| 138 | oFunction.AddParameter(0); |
154 | oFunction.AddParameter(0); |
| 139 | oFunction.AddParameter(lpBuffer); |
155 | oFunction.AddParameter(lpBuffer); |
| 140 | oFunction.AddParameter(0); |
156 | oFunction.AddParameter(0); |
| 141 | oFunction.AddParameter(0x50000000); //WS_VISIBLE|WS_CHILD |
157 | oFunction.AddParameter(0x50000000); //WS_VISIBLE|WS_CHILD |
| 142 | oFunction.AddParameter(6); |
158 | oFunction.AddParameter(6); |
| 143 | oFunction.AddParameter(18); |
159 | oFunction.AddParameter(18); |
| 144 | oFunction.AddParameter(33); |
160 | oFunction.AddParameter(33); |
| 145 | oFunction.AddParameter(20); |
161 | oFunction.AddParameter(20); |
| 146 | oFunction.AddParameter(hWnd); |
162 | oFunction.AddParameter(hWnd); |
| 147 | oFunction.AddParameter(-1); //ID |
163 | oFunction.AddParameter(-1); //ID |
| 148 | oFunction.AddParameter(hInstanceDLL); |
164 | oFunction.AddParameter(hInstanceDLL); |
| 149 | oFunction.AddParameter(0); |
165 | oFunction.AddParameter(0); |
| 150 | hWndStatic=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
166 | hWndStatic=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 151 | |
167 | |
| 152 | //Set font and text |
168 | //Set font and text |
| 153 | SetWindowFontAndText(hWndStatic, hGuiFont, GetLangString(2)); |
169 | SetWindowFontAndText(hWndStatic, hGuiFont, GetLangString(2)); |
| 154 | |
170 | |
| 155 | |
171 | |
| 156 | ////Edit window What |
172 | ////Edit window What |
| 157 | |
173 | |
| 158 | //Create window |
174 | //Create window |
| 159 | AkelPad.MemCopy(lpBuffer, "EDIT", _TSTR); |
175 | AkelPad.MemCopy(lpBuffer, "EDIT", _TSTR); |
| 160 | oFunction.AddParameter(0x200); //WS_EX_CLIENTEDGE |
176 | oFunction.AddParameter(0x200); //WS_EX_CLIENTEDGE |
| 161 | oFunction.AddParameter(lpBuffer); |
177 | oFunction.AddParameter(lpBuffer); |
| 162 | oFunction.AddParameter(0); |
178 | oFunction.AddParameter(0); |
| 163 | oFunction.AddParameter(0x50010080); //WS_VISIBLE|WS_CHILD|WS_TABSTOP|ES_AUTOHSCROLL |
179 | oFunction.AddParameter(0x50010080); //WS_VISIBLE|WS_CHILD|WS_TABSTOP|ES_AUTOHSCROLL |
| 164 | oFunction.AddParameter(41); |
180 | oFunction.AddParameter(41); |
| 165 | oFunction.AddParameter(15); |
181 | oFunction.AddParameter(15); |
| 166 | oFunction.AddParameter(240); |
182 | oFunction.AddParameter(280); //~ What width, old: 240 |
| 167 | oFunction.AddParameter(20); |
183 | oFunction.AddParameter(20); |
| 168 | oFunction.AddParameter(hWnd); |
184 | oFunction.AddParameter(hWnd); |
| 169 | oFunction.AddParameter(1001); //ID |
185 | oFunction.AddParameter(1001); //ID |
| 170 | oFunction.AddParameter(hInstanceDLL); |
186 | oFunction.AddParameter(hInstanceDLL); |
| 171 | oFunction.AddParameter(0); |
187 | oFunction.AddParameter(0); |
| 172 | hWndWhat=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
188 | hWndWhat=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 173 | |
189 | |
| 174 | //Set font and text |
190 | //Set font and text |
| 175 | { |
191 | { |
| 176 | var nSelStart; |
192 | var nSelStart; |
| 177 | var nSelEnd; |
193 | var nSelEnd; |
| 178 | |
194 | |
| 179 | nSelStart=AkelPad.GetSelStart(); |
195 | nSelStart=AkelPad.GetSelStart(); |
| 180 | nSelEnd=AkelPad.GetSelEnd(); |
196 | nSelEnd=AkelPad.GetSelEnd(); |
| 181 | |
197 | |
| 182 | if (nSelStart != nSelEnd && !(nDirection == DN_SELECTION) && !AkelPad.SendMessage(AkelPad.GetEditWnd(), 3127 /*AEM_GETCOLUMNSEL*/, 0, 0)) |
198 | if (nSelStart != nSelEnd && !(nDirection == DN_SELECTION) && !AkelPad.SendMessage(AkelPad.GetEditWnd(), 3127 /*AEM_GETCOLUMNSEL*/, 0, 0)) |
| 183 | SetWindowFontAndText(hWndWhat, hGuiFont, AkelPad.GetSelText()); |
199 | SetWindowFontAndText(hWndWhat, hGuiFont, AkelPad.GetSelText()); |
| 184 | else |
200 | else |
| 185 | SetWindowFontAndText(hWndWhat, hGuiFont, pFindIt); |
201 | SetWindowFontAndText(hWndWhat, hGuiFont, pFindIt); |
| 186 | } |
202 | } |
| 187 | |
203 | |
| 188 | //Select text |
204 | //Select text |
| 189 | AkelPad.SendMessage(hWndWhat, 177 /*EM_SETSEL*/, 0, -1); |
205 | AkelPad.SendMessage(hWndWhat, 177 /*EM_SETSEL*/, 0, -1); |
| 190 | |
206 | |
| 191 | |
207 | |
| 192 | ////Static window With |
208 | ////Static window With |
| 193 | |
209 | |
| 194 | //Create window |
210 | //Create window |
| 195 | AkelPad.MemCopy(lpBuffer, "STATIC", _TSTR); |
211 | AkelPad.MemCopy(lpBuffer, "STATIC", _TSTR); |
| 196 | oFunction.AddParameter(0); |
212 | oFunction.AddParameter(0); |
| 197 | oFunction.AddParameter(lpBuffer); |
213 | oFunction.AddParameter(lpBuffer); |
| 198 | oFunction.AddParameter(0); |
214 | oFunction.AddParameter(0); |
| 199 | oFunction.AddParameter(0x50000000); //WS_VISIBLE|WS_CHILD |
215 | oFunction.AddParameter(0x50000000); //WS_VISIBLE|WS_CHILD |
| 200 | oFunction.AddParameter(6); |
216 | oFunction.AddParameter(6); |
| 201 | oFunction.AddParameter(41); |
217 | oFunction.AddParameter(41); |
| 202 | oFunction.AddParameter(33); |
218 | oFunction.AddParameter(33); |
| 203 | oFunction.AddParameter(20); |
219 | oFunction.AddParameter(20); |
| 204 | oFunction.AddParameter(hWnd); |
220 | oFunction.AddParameter(hWnd); |
| 205 | oFunction.AddParameter(-1); //ID |
221 | oFunction.AddParameter(-1); //ID |
| 206 | oFunction.AddParameter(hInstanceDLL); |
222 | oFunction.AddParameter(hInstanceDLL); |
| 207 | oFunction.AddParameter(0); |
223 | oFunction.AddParameter(0); |
| 208 | hWndStatic=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
224 | hWndStatic=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 209 | |
225 | |
| 210 | //Set font and text |
226 | //Set font and text |
| 211 | SetWindowFontAndText(hWndStatic, hGuiFont, GetLangString(3)); |
227 | SetWindowFontAndText(hWndStatic, hGuiFont, GetLangString(3)); |
| 212 | |
228 | |
| 213 | |
229 | |
| 214 | ////Edit window With |
230 | ////Edit window With |
| 215 | |
231 | |
| 216 | //Create window |
232 | //Create window |
| 217 | AkelPad.MemCopy(lpBuffer, "EDIT", _TSTR); |
233 | AkelPad.MemCopy(lpBuffer, "EDIT", _TSTR); |
| 218 | oFunction.AddParameter(0x200); //WS_EX_CLIENTEDGE |
234 | oFunction.AddParameter(0x200); //WS_EX_CLIENTEDGE |
| 219 | oFunction.AddParameter(lpBuffer); |
235 | oFunction.AddParameter(lpBuffer); |
| 220 | oFunction.AddParameter(0); |
236 | oFunction.AddParameter(0); |
| 221 | oFunction.AddParameter(0x50010080); //WS_VISIBLE|WS_CHILD|WS_TABSTOP|ES_AUTOHSCROLL |
237 | oFunction.AddParameter(0x50010080); //WS_VISIBLE|WS_CHILD|WS_TABSTOP|ES_AUTOHSCROLL |
| 222 | oFunction.AddParameter(41); |
238 | oFunction.AddParameter(41); |
| 223 | oFunction.AddParameter(37); |
239 | oFunction.AddParameter(37); |
| 224 | oFunction.AddParameter(240); |
240 | oFunction.AddParameter(280); //~ With width, old: 240 |
| 225 | oFunction.AddParameter(20); |
241 | oFunction.AddParameter(20); |
| 226 | oFunction.AddParameter(hWnd); |
242 | oFunction.AddParameter(hWnd); |
| 227 | oFunction.AddParameter(1002); //ID |
243 | oFunction.AddParameter(1002); //ID |
| 228 | oFunction.AddParameter(hInstanceDLL); |
244 | oFunction.AddParameter(hInstanceDLL); |
| 229 | oFunction.AddParameter(0); |
245 | oFunction.AddParameter(0); |
| 230 | hWndWith=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
246 | hWndWith=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 231 | |
247 | |
| 232 | //Set font and text |
248 | //Set font and text |
| 233 | SetWindowFontAndText(hWndWith, hGuiFont, pReplaceWith); |
249 | SetWindowFontAndText(hWndWith, hGuiFont, pReplaceWith); |
| 234 | |
250 | |
| 235 | |
251 | |
| 236 | ////Checkbox Sensitive |
252 | ////Checkbox Sensitive |
| 237 | |
253 | |
| 238 | //Create window |
254 | //Create window |
| 239 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
255 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
| 240 | oFunction.AddParameter(0); |
256 | oFunction.AddParameter(0); |
| 241 | oFunction.AddParameter(lpBuffer); |
257 | oFunction.AddParameter(lpBuffer); |
| 242 | oFunction.AddParameter(0); |
258 | oFunction.AddParameter(0); |
| 243 | oFunction.AddParameter(0x50010003); //WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX |
259 | oFunction.AddParameter(0x50010003); //WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX |
| 244 | oFunction.AddParameter(14); |
260 | oFunction.AddParameter(14); |
| 245 | oFunction.AddParameter(70); |
261 | oFunction.AddParameter(70); |
| 246 | oFunction.AddParameter(158); |
262 | oFunction.AddParameter(158); |
| 247 | oFunction.AddParameter(20); |
263 | oFunction.AddParameter(20); |
| 248 | oFunction.AddParameter(hWnd); |
264 | oFunction.AddParameter(hWnd); |
| 249 | oFunction.AddParameter(1003); //ID |
265 | oFunction.AddParameter(1003); //ID |
| 250 | oFunction.AddParameter(hInstanceDLL); |
266 | oFunction.AddParameter(hInstanceDLL); |
| 251 | oFunction.AddParameter(0); |
267 | oFunction.AddParameter(0); |
| 252 | hWndCase=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
268 | hWndCase=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 253 | |
269 | |
| 254 | //Set font and text |
270 | //Set font and text |
| 255 | SetWindowFontAndText(hWndCase, hGuiFont, GetLangString(4)); |
271 | SetWindowFontAndText(hWndCase, hGuiFont, GetLangString(4)); |
| 256 | |
272 | |
| 257 | |
273 | |
| 258 | ////Checkbox Multiline |
274 | ////Checkbox Multiline |
| 259 | |
275 | |
| 260 | //Create window |
276 | //Create window |
| 261 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
277 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
| 262 | oFunction.AddParameter(0); |
278 | oFunction.AddParameter(0); |
| 263 | oFunction.AddParameter(lpBuffer); |
279 | oFunction.AddParameter(lpBuffer); |
| 264 | oFunction.AddParameter(0); |
280 | oFunction.AddParameter(0); |
| 265 | oFunction.AddParameter(0x50010003); //WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX |
281 | oFunction.AddParameter(0x50010003); //WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX |
| 266 | oFunction.AddParameter(14); |
282 | oFunction.AddParameter(14); |
| 267 | oFunction.AddParameter(91); |
283 | oFunction.AddParameter(91); |
| 268 | oFunction.AddParameter(158); |
284 | oFunction.AddParameter(158); |
| 269 | oFunction.AddParameter(20); |
285 | oFunction.AddParameter(20); |
| 270 | oFunction.AddParameter(hWnd); |
286 | oFunction.AddParameter(hWnd); |
| 271 | oFunction.AddParameter(1004); //ID |
287 | oFunction.AddParameter(1004); //ID |
| 272 | oFunction.AddParameter(hInstanceDLL); |
288 | oFunction.AddParameter(hInstanceDLL); |
| 273 | oFunction.AddParameter(0); |
289 | oFunction.AddParameter(0); |
| 274 | hWndMultiline=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
290 | hWndMultiline=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 275 | |
291 | |
| 276 | //Set font and text |
292 | //Set font and text |
| 277 | SetWindowFontAndText(hWndMultiline, hGuiFont, GetLangString(6)); |
293 | SetWindowFontAndText(hWndMultiline, hGuiFont, GetLangString(6)); |
| 278 | |
294 | |
| 279 | |
295 | |
| 280 | ////Checkbox Esc-sequences |
296 | ////Checkbox Esc-sequences |
| 281 | |
297 | |
| 282 | //Create window |
298 | //Create window |
| 283 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
299 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
| 284 | oFunction.AddParameter(0); |
300 | oFunction.AddParameter(0); |
| 285 | oFunction.AddParameter(lpBuffer); |
301 | oFunction.AddParameter(lpBuffer); |
| 286 | oFunction.AddParameter(0); |
302 | oFunction.AddParameter(0); |
| 287 | oFunction.AddParameter(0x50010003); //WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX |
303 | oFunction.AddParameter(0x50010003); //WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX |
| 288 | oFunction.AddParameter(14); |
304 | oFunction.AddParameter(14); |
| 289 | oFunction.AddParameter(112); |
305 | oFunction.AddParameter(112); |
| 290 | oFunction.AddParameter(158); |
306 | oFunction.AddParameter(158); |
| 291 | oFunction.AddParameter(20); |
307 | oFunction.AddParameter(20); |
| 292 | oFunction.AddParameter(hWnd); |
308 | oFunction.AddParameter(hWnd); |
| 293 | oFunction.AddParameter(1005); //ID |
309 | oFunction.AddParameter(1005); //ID |
| 294 | oFunction.AddParameter(hInstanceDLL); |
310 | oFunction.AddParameter(hInstanceDLL); |
| 295 | oFunction.AddParameter(0); |
311 | oFunction.AddParameter(0); |
| 296 | hWndEscSequences=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
312 | hWndEscSequences=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 297 | |
313 | |
| 298 | //Set font and text |
314 | //Set font and text |
| 299 | SetWindowFontAndText(hWndEscSequences, hGuiFont, GetLangString(7)); |
315 | SetWindowFontAndText(hWndEscSequences, hGuiFont, GetLangString(7)); |
| 300 | |
316 | |
| 301 | |
317 | |
| |
318 | ////Checkbox Replace with function
|
| |
319 |
|
| |
320 | //Create window
|
| |
321 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR);
|
| |
322 | oFunction.AddParameter(0);
|
| |
323 | oFunction.AddParameter(lpBuffer);
|
| |
324 | oFunction.AddParameter(0);
|
| |
325 | oFunction.AddParameter(0x50010003); //WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX
|
| |
326 | oFunction.AddParameter(14);
|
| |
327 | oFunction.AddParameter(133); // +21
|
| |
328 | oFunction.AddParameter(158);
|
| |
329 | oFunction.AddParameter(20);
|
| |
330 | oFunction.AddParameter(hWnd);
|
| |
331 | oFunction.AddParameter(2000); //ID
|
| |
332 | oFunction.AddParameter(hInstanceDLL);
|
| |
333 | oFunction.AddParameter(0);
|
| |
334 | hWndReplaceFunction=oFunction.Call("user32::CreateWindowEx" + _TCHAR);
|
| |
335 |
|
| |
336 | //Set font and text
|
| |
337 | SetWindowFontAndText(hWndReplaceFunction, hGuiFont, GetLangString(100));
|
| |
338 |
|
| |
339 |
|
| 302 | ////GroupBox 1 |
340 | ////GroupBox 1 |
| 303 | |
341 | |
| 304 | //Create window |
342 | //Create window |
| 305 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
343 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
| 306 | oFunction.AddParameter(0); |
344 | oFunction.AddParameter(0); |
| 307 | oFunction.AddParameter(lpBuffer); |
345 | oFunction.AddParameter(lpBuffer); |
| 308 | oFunction.AddParameter(0); |
346 | oFunction.AddParameter(0); |
| 309 | oFunction.AddParameter(0x50000007); //WS_VISIBLE|WS_CHILD|BS_GROUPBOX |
347 | oFunction.AddParameter(0x50000007); //WS_VISIBLE|WS_CHILD|BS_GROUPBOX |
| 310 | oFunction.AddParameter(182); |
348 | oFunction.AddParameter(222); //~ GroupBox 1 margin-left, old: 182 |
| 311 | oFunction.AddParameter(67); |
349 | oFunction.AddParameter(67); |
| 312 | oFunction.AddParameter(99); |
350 | oFunction.AddParameter(99); |
| 313 | oFunction.AddParameter(94); |
351 | oFunction.AddParameter(94); |
| 314 | oFunction.AddParameter(hWnd); |
352 | oFunction.AddParameter(hWnd); |
| 315 | oFunction.AddParameter(-1); //ID |
353 | oFunction.AddParameter(-1); //ID |
| 316 | oFunction.AddParameter(hInstanceDLL); |
354 | oFunction.AddParameter(hInstanceDLL); |
| 317 | oFunction.AddParameter(0); |
355 | oFunction.AddParameter(0); |
| 318 | hWndGroup=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
356 | hWndGroup=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 319 | |
357 | |
| 320 | //Set font and text |
358 | //Set font and text |
| 321 | SetWindowFontAndText(hWndGroup, hGuiFont, GetLangString(8)); |
359 | SetWindowFontAndText(hWndGroup, hGuiFont, GetLangString(8)); |
| 322 | |
360 | |
| 323 | |
361 | |
| 324 | ////Radiobutton Down |
362 | ////Radiobutton Down |
| 325 | |
363 | |
| 326 | //Create window |
364 | //Create window |
| 327 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
365 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
| 328 | oFunction.AddParameter(0); |
366 | oFunction.AddParameter(0); |
| 329 | oFunction.AddParameter(lpBuffer); |
367 | oFunction.AddParameter(lpBuffer); |
| 330 | oFunction.AddParameter(0); |
368 | oFunction.AddParameter(0); |
| 331 | oFunction.AddParameter(0x50000009); //WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON |
369 | oFunction.AddParameter(0x50000009); //WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON |
| 332 | oFunction.AddParameter(189); |
370 | oFunction.AddParameter(229); //~ Radiobutton Down margin-left, old: 189 |
| 333 | oFunction.AddParameter(83); |
371 | oFunction.AddParameter(83); |
| 334 | oFunction.AddParameter(90); |
372 | oFunction.AddParameter(90); |
| 335 | oFunction.AddParameter(16); |
373 | oFunction.AddParameter(16); |
| 336 | oFunction.AddParameter(hWnd); |
374 | oFunction.AddParameter(hWnd); |
| 337 | oFunction.AddParameter(1006); //ID |
375 | oFunction.AddParameter(1006); //ID |
| 338 | oFunction.AddParameter(hInstanceDLL); |
376 | oFunction.AddParameter(hInstanceDLL); |
| 339 | oFunction.AddParameter(0); |
377 | oFunction.AddParameter(0); |
| 340 | hWndDown=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
378 | hWndDown=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 341 | |
379 | |
| 342 | //Set font and text |
380 | //Set font and text |
| 343 | SetWindowFontAndText(hWndDown, hGuiFont, GetLangString(9)); |
381 | SetWindowFontAndText(hWndDown, hGuiFont, GetLangString(9)); |
| 344 | |
382 | |
| 345 | |
383 | |
| 346 | ////Radiobutton Up |
384 | ////Radiobutton Up |
| 347 | |
385 | |
| 348 | //Create window |
386 | //Create window |
| 349 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
387 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
| 350 | oFunction.AddParameter(0); |
388 | oFunction.AddParameter(0); |
| 351 | oFunction.AddParameter(lpBuffer); |
389 | oFunction.AddParameter(lpBuffer); |
| 352 | oFunction.AddParameter(0); |
390 | oFunction.AddParameter(0); |
| 353 | oFunction.AddParameter(0x50000009); //WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON |
391 | oFunction.AddParameter(0x50000009); //WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON |
| 354 | oFunction.AddParameter(189); |
392 | oFunction.AddParameter(229); //~ Radiobutton Up margin-left, old: 189 |
| 355 | oFunction.AddParameter(101); |
393 | oFunction.AddParameter(101); |
| 356 | oFunction.AddParameter(90); |
394 | oFunction.AddParameter(90); |
| 357 | oFunction.AddParameter(16); |
395 | oFunction.AddParameter(16); |
| 358 | oFunction.AddParameter(hWnd); |
396 | oFunction.AddParameter(hWnd); |
| 359 | oFunction.AddParameter(1007); //ID |
397 | oFunction.AddParameter(1007); //ID |
| 360 | oFunction.AddParameter(hInstanceDLL); |
398 | oFunction.AddParameter(hInstanceDLL); |
| 361 | oFunction.AddParameter(0); |
399 | oFunction.AddParameter(0); |
| 362 | hWndUp=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
400 | hWndUp=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 363 | |
401 | |
| 364 | //Set font and text |
402 | //Set font and text |
| 365 | SetWindowFontAndText(hWndUp, hGuiFont, GetLangString(10)); |
403 | SetWindowFontAndText(hWndUp, hGuiFont, GetLangString(10)); |
| 366 | |
404 | |
| 367 | |
405 | |
| 368 | ////Radiobutton Beginning |
406 | ////Radiobutton Beginning |
| 369 | |
407 | |
| 370 | //Create window |
408 | //Create window |
| 371 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
409 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
| 372 | oFunction.AddParameter(0); |
410 | oFunction.AddParameter(0); |
| 373 | oFunction.AddParameter(lpBuffer); |
411 | oFunction.AddParameter(lpBuffer); |
| 374 | oFunction.AddParameter(0); |
412 | oFunction.AddParameter(0); |
| 375 | oFunction.AddParameter(0x50000009); //WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON |
413 | oFunction.AddParameter(0x50000009); //WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON |
| 376 | oFunction.AddParameter(189); |
414 | oFunction.AddParameter(229); //~ Radiobutton Beginning margin-left, old: 189 |
| 377 | oFunction.AddParameter(119); |
415 | oFunction.AddParameter(119); |
| 378 | oFunction.AddParameter(90); |
416 | oFunction.AddParameter(90); |
| 379 | oFunction.AddParameter(16); |
417 | oFunction.AddParameter(16); |
| 380 | oFunction.AddParameter(hWnd); |
418 | oFunction.AddParameter(hWnd); |
| 381 | oFunction.AddParameter(1008); //ID |
419 | oFunction.AddParameter(1008); //ID |
| 382 | oFunction.AddParameter(hInstanceDLL); |
420 | oFunction.AddParameter(hInstanceDLL); |
| 383 | oFunction.AddParameter(0); |
421 | oFunction.AddParameter(0); |
| 384 | hWndBeginning=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
422 | hWndBeginning=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 385 | |
423 | |
| 386 | //Set font and text |
424 | //Set font and text |
| 387 | SetWindowFontAndText(hWndBeginning, hGuiFont, GetLangString(11)); |
425 | SetWindowFontAndText(hWndBeginning, hGuiFont, GetLangString(11)); |
| 388 | |
426 | |
| 389 | |
427 | |
| 390 | ////Radiobutton Selection |
428 | ////Radiobutton Selection |
| 391 | |
429 | |
| 392 | //Create window |
430 | //Create window |
| 393 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
431 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
| 394 | oFunction.AddParameter(0); |
432 | oFunction.AddParameter(0); |
| 395 | oFunction.AddParameter(lpBuffer); |
433 | oFunction.AddParameter(lpBuffer); |
| 396 | oFunction.AddParameter(0); |
434 | oFunction.AddParameter(0); |
| 397 | oFunction.AddParameter(0x50000009); //WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON |
435 | oFunction.AddParameter(0x50000009); //WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON |
| 398 | oFunction.AddParameter(189); |
436 | oFunction.AddParameter(229); //~ Radiobutton Selection margin-left, old: 189 |
| 399 | oFunction.AddParameter(137); |
437 | oFunction.AddParameter(137); |
| 400 | oFunction.AddParameter(90); |
438 | oFunction.AddParameter(90); |
| 401 | oFunction.AddParameter(16); |
439 | oFunction.AddParameter(16); |
| 402 | oFunction.AddParameter(hWnd); |
440 | oFunction.AddParameter(hWnd); |
| 403 | oFunction.AddParameter(1009); //ID |
441 | oFunction.AddParameter(1009); //ID |
| 404 | oFunction.AddParameter(hInstanceDLL); |
442 | oFunction.AddParameter(hInstanceDLL); |
| 405 | oFunction.AddParameter(0); |
443 | oFunction.AddParameter(0); |
| 406 | hWndSelection=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
444 | hWndSelection=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 407 | |
445 | |
| 408 | //Set font and text |
446 | //Set font and text |
| 409 | SetWindowFontAndText(hWndSelection, hGuiFont, GetLangString(12)); |
447 | SetWindowFontAndText(hWndSelection, hGuiFont, GetLangString(12)); |
| 410 | |
448 | |
| 411 | |
449 | |
| 412 | if (AkelPad.IsMDI()) |
450 | if (AkelPad.IsMDI()) |
| 413 | { |
451 | { |
| 414 | ////Radiobutton AllFiles |
452 | ////Radiobutton AllFiles |
| 415 | |
453 | |
| 416 | //Create window |
454 | //Create window |
| 417 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
455 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
| 418 | oFunction.AddParameter(0); |
456 | oFunction.AddParameter(0); |
| 419 | oFunction.AddParameter(lpBuffer); |
457 | oFunction.AddParameter(lpBuffer); |
| 420 | oFunction.AddParameter(0); |
458 | oFunction.AddParameter(0); |
| 421 | oFunction.AddParameter(0x50000009); //WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON |
459 | oFunction.AddParameter(0x50000009); //WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON |
| 422 | oFunction.AddParameter(189); |
460 | oFunction.AddParameter(229); //~ Radiobutton AllFiles margin-left, old: 189 |
| 423 | oFunction.AddParameter(164); |
461 | oFunction.AddParameter(164); |
| 424 | oFunction.AddParameter(90); |
462 | oFunction.AddParameter(90); |
| 425 | oFunction.AddParameter(16); |
463 | oFunction.AddParameter(16); |
| 426 | oFunction.AddParameter(hWnd); |
464 | oFunction.AddParameter(hWnd); |
| 427 | oFunction.AddParameter(1010); //ID |
465 | oFunction.AddParameter(1010); //ID |
| 428 | oFunction.AddParameter(hInstanceDLL); |
466 | oFunction.AddParameter(hInstanceDLL); |
| 429 | oFunction.AddParameter(0); |
467 | oFunction.AddParameter(0); |
| 430 | hWndAllFiles=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
468 | hWndAllFiles=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 431 | |
469 | |
| 432 | //Set font and text |
470 | //Set font and text |
| 433 | SetWindowFontAndText(hWndAllFiles, hGuiFont, GetLangString(13)); |
471 | SetWindowFontAndText(hWndAllFiles, hGuiFont, GetLangString(13)); |
| 434 | |
472 | |
| 435 | |
473 | |
| 436 | ////GroupBox 2 |
474 | ////GroupBox 2 |
| 437 | |
475 | |
| 438 | //Create window |
476 | //Create window |
| 439 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
477 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
| 440 | oFunction.AddParameter(0); |
478 | oFunction.AddParameter(0); |
| 441 | oFunction.AddParameter(lpBuffer); |
479 | oFunction.AddParameter(lpBuffer); |
| 442 | oFunction.AddParameter(0); |
480 | oFunction.AddParameter(0); |
| 443 | oFunction.AddParameter(0x50000007); //WS_VISIBLE|WS_CHILD|BS_GROUPBOX |
481 | oFunction.AddParameter(0x50000007); //WS_VISIBLE|WS_CHILD|BS_GROUPBOX |
| 444 | oFunction.AddParameter(182); |
482 | oFunction.AddParameter(222); //~ GroupBox 2 margin-left, old: 182 |
| 445 | oFunction.AddParameter(153); |
483 | oFunction.AddParameter(153); |
| 446 | oFunction.AddParameter(99); |
484 | oFunction.AddParameter(99); |
| 447 | oFunction.AddParameter(31); |
485 | oFunction.AddParameter(31); |
| 448 | oFunction.AddParameter(hWnd); |
486 | oFunction.AddParameter(hWnd); |
| 449 | oFunction.AddParameter(-1); //ID |
487 | oFunction.AddParameter(-1); //ID |
| 450 | oFunction.AddParameter(hInstanceDLL); |
488 | oFunction.AddParameter(hInstanceDLL); |
| 451 | oFunction.AddParameter(0); |
489 | oFunction.AddParameter(0); |
| 452 | hWndGroup=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
490 | hWndGroup=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 453 | |
491 | |
| 454 | //Set font and text |
492 | //Set font and text |
| 455 | SetWindowFontAndText(hWndGroup, hGuiFont, ""); |
493 | SetWindowFontAndText(hWndGroup, hGuiFont, ""); |
| 456 | } |
494 | } |
| 457 | |
495 | |
| 458 | |
496 | |
| 459 | ////Button window FindNext |
497 | ////Button window FindNext |
| 460 | |
498 | |
| 461 | //Create window |
499 | //Create window |
| 462 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
500 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
| 463 | oFunction.AddParameter(0); |
501 | oFunction.AddParameter(0); |
| 464 | oFunction.AddParameter(lpBuffer); |
502 | oFunction.AddParameter(lpBuffer); |
| 465 | oFunction.AddParameter(0); |
503 | oFunction.AddParameter(0); |
| 466 | oFunction.AddParameter(0x50010001); //WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_DEFPUSHBUTTON |
504 | oFunction.AddParameter(0x50010001); //WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_DEFPUSHBUTTON |
| 467 | oFunction.AddParameter(294); |
505 | oFunction.AddParameter(334); //~ Button window FindNext margin-left, old: 294 |
| 468 | oFunction.AddParameter(10); |
506 | oFunction.AddParameter(10); |
| 469 | oFunction.AddParameter(81); |
507 | oFunction.AddParameter(81); |
| 470 | oFunction.AddParameter(23); |
508 | oFunction.AddParameter(23); |
| 471 | oFunction.AddParameter(hWnd); |
509 | oFunction.AddParameter(hWnd); |
| 472 | oFunction.AddParameter(1011); //ID |
510 | oFunction.AddParameter(1011); //ID |
| 473 | oFunction.AddParameter(hInstanceDLL); |
511 | oFunction.AddParameter(hInstanceDLL); |
| 474 | oFunction.AddParameter(0); |
512 | oFunction.AddParameter(0); |
| 475 | hWndFindNext=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
513 | hWndFindNext=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 476 | |
514 | |
| 477 | //Set font and text |
515 | //Set font and text |
| 478 | SetWindowFontAndText(hWndFindNext, hGuiFont, GetLangString(14)); |
516 | SetWindowFontAndText(hWndFindNext, hGuiFont, GetLangString(14)); |
| 479 | |
517 | |
| 480 | |
518 | |
| 481 | ////Button window Replace |
519 | ////Button window Replace |
| 482 | |
520 | |
| 483 | //Create window |
521 | //Create window |
| 484 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
522 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
| 485 | oFunction.AddParameter(0); |
523 | oFunction.AddParameter(0); |
| 486 | oFunction.AddParameter(lpBuffer); |
524 | oFunction.AddParameter(lpBuffer); |
| 487 | oFunction.AddParameter(0); |
525 | oFunction.AddParameter(0); |
| 488 | oFunction.AddParameter(0x50010000); //WS_VISIBLE|WS_CHILD|WS_TABSTOP |
526 | oFunction.AddParameter(0x50010000); //WS_VISIBLE|WS_CHILD|WS_TABSTOP |
| 489 | oFunction.AddParameter(294); |
527 | oFunction.AddParameter(334); //~ Button window Replace margin-left, old: 294 |
| 490 | oFunction.AddParameter(37); |
528 | oFunction.AddParameter(37); |
| 491 | oFunction.AddParameter(81); |
529 | oFunction.AddParameter(81); |
| 492 | oFunction.AddParameter(23); |
530 | oFunction.AddParameter(23); |
| 493 | oFunction.AddParameter(hWnd); |
531 | oFunction.AddParameter(hWnd); |
| 494 | oFunction.AddParameter(1012); //ID |
532 | oFunction.AddParameter(1012); //ID |
| 495 | oFunction.AddParameter(hInstanceDLL); |
533 | oFunction.AddParameter(hInstanceDLL); |
| 496 | oFunction.AddParameter(0); |
534 | oFunction.AddParameter(0); |
| 497 | hWndReplace=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
535 | hWndReplace=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 498 | |
536 | |
| 499 | //Set font and text |
537 | //Set font and text |
| 500 | SetWindowFontAndText(hWndReplace, hGuiFont, GetLangString(15)); |
538 | SetWindowFontAndText(hWndReplace, hGuiFont, GetLangString(15)); |
| 501 | |
539 | |
| 502 | |
540 | |
| 503 | ////Button window ReplaceAll |
541 | ////Button window ReplaceAll |
| 504 | |
542 | |
| 505 | //Create window |
543 | //Create window |
| 506 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
544 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
| 507 | oFunction.AddParameter(0); |
545 | oFunction.AddParameter(0); |
| 508 | oFunction.AddParameter(lpBuffer); |
546 | oFunction.AddParameter(lpBuffer); |
| 509 | oFunction.AddParameter(0); |
547 | oFunction.AddParameter(0); |
| 510 | oFunction.AddParameter(0x50010000); //WS_VISIBLE|WS_CHILD|WS_TABSTOP |
548 | oFunction.AddParameter(0x50010000); //WS_VISIBLE|WS_CHILD|WS_TABSTOP |
| 511 | oFunction.AddParameter(294); |
549 | oFunction.AddParameter(334); //~ Button window ReplaceAll margin-left, old: 294 |
| 512 | oFunction.AddParameter(63); |
550 | oFunction.AddParameter(63); |
| 513 | oFunction.AddParameter(81); |
551 | oFunction.AddParameter(81); |
| 514 | oFunction.AddParameter(23); |
552 | oFunction.AddParameter(23); |
| 515 | oFunction.AddParameter(hWnd); |
553 | oFunction.AddParameter(hWnd); |
| 516 | oFunction.AddParameter(1013); //ID |
554 | oFunction.AddParameter(1013); //ID |
| 517 | oFunction.AddParameter(hInstanceDLL); |
555 | oFunction.AddParameter(hInstanceDLL); |
| 518 | oFunction.AddParameter(0); |
556 | oFunction.AddParameter(0); |
| 519 | hWndReplaceAll=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
557 | hWndReplaceAll=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 520 | |
558 | |
| 521 | //Set font and text |
559 | //Set font and text |
| 522 | SetWindowFontAndText(hWndReplaceAll, hGuiFont, GetLangString(16)); |
560 | SetWindowFontAndText(hWndReplaceAll, hGuiFont, GetLangString(16)); |
| 523 | |
561 | |
| 524 | |
562 | |
| 525 | ////Button window Cancel |
563 | ////Button window Cancel |
| 526 | |
564 | |
| 527 | //Create window |
565 | //Create window |
| 528 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
566 | AkelPad.MemCopy(lpBuffer, "BUTTON", _TSTR); |
| 529 | oFunction.AddParameter(0); |
567 | oFunction.AddParameter(0); |
| 530 | oFunction.AddParameter(lpBuffer); |
568 | oFunction.AddParameter(lpBuffer); |
| 531 | oFunction.AddParameter(0); |
569 | oFunction.AddParameter(0); |
| 532 | oFunction.AddParameter(0x50010000); //WS_VISIBLE|WS_CHILD|WS_TABSTOP |
570 | oFunction.AddParameter(0x50010000); //WS_VISIBLE|WS_CHILD|WS_TABSTOP |
| 533 | oFunction.AddParameter(294); |
571 | oFunction.AddParameter(334); //~ Button window Cancel margin-left, old: 294 |
| 534 | oFunction.AddParameter(89); |
572 | oFunction.AddParameter(89); |
| 535 | oFunction.AddParameter(81); |
573 | oFunction.AddParameter(81); |
| 536 | oFunction.AddParameter(23); |
574 | oFunction.AddParameter(23); |
| 537 | oFunction.AddParameter(hWnd); |
575 | oFunction.AddParameter(hWnd); |
| 538 | oFunction.AddParameter(2); //ID |
576 | oFunction.AddParameter(2); //ID |
| 539 | oFunction.AddParameter(hInstanceDLL); |
577 | oFunction.AddParameter(hInstanceDLL); |
| 540 | oFunction.AddParameter(0); |
578 | oFunction.AddParameter(0); |
| 541 | hWndCancel=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
579 | hWndCancel=oFunction.Call("user32::CreateWindowEx" + _TCHAR); |
| 542 | |
580 | |
| 543 | //Set font and text |
581 | //Set font and text |
| 544 | SetWindowFontAndText(hWndCancel, hGuiFont, GetLangString(1)); |
582 | SetWindowFontAndText(hWndCancel, hGuiFont, GetLangString(1)); |
| 545 | |
583 | |
| 546 | |
584 | |
| 547 | //Checks |
585 | //Checks |
| 548 | if (bSensitive) AkelPad.SendMessage(hWndCase, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
586 | if (bSensitive) AkelPad.SendMessage(hWndCase, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
| 549 | if (bMultiline) AkelPad.SendMessage(hWndMultiline, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
587 | if (bMultiline) AkelPad.SendMessage(hWndMultiline, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
| 550 | if (bEscSequences) AkelPad.SendMessage(hWndEscSequences, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
588 | if (bEscSequences) AkelPad.SendMessage(hWndEscSequences, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
| |
589 | if (bReplaceFunction)
|
| |
590 | {
|
| |
591 | AkelPad.SendMessage(hWndReplaceFunction, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0);
|
| |
592 | EnableWindow(hWndEscSequences, !bReplaceFunction);
|
| |
593 | }
|
| 551 | |
594 | |
| 552 | if (nDirection == DN_ALLFILES) |
595 | if (nDirection == DN_ALLFILES) |
| 553 | { |
596 | { |
| 554 | if (AkelPad.IsMDI()) |
597 | if (AkelPad.IsMDI()) |
| 555 | AkelPad.SendMessage(hWndAllFiles, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
598 | AkelPad.SendMessage(hWndAllFiles, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
| 556 | else |
599 | else |
| 557 | nDirection=DN_DOWN; |
600 | nDirection=DN_DOWN; |
| 558 | } |
601 | } |
| 559 | else if (nDirection == DN_BEGINNING) AkelPad.SendMessage(hWndBeginning, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
602 | else if (nDirection == DN_BEGINNING) AkelPad.SendMessage(hWndBeginning, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
| 560 | else if (nDirection == DN_SELECTION) AkelPad.SendMessage(hWndSelection, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
603 | else if (nDirection == DN_SELECTION) AkelPad.SendMessage(hWndSelection, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
| 561 | |
604 | |
| 562 | if (nDirection == DN_DOWN) AkelPad.SendMessage(hWndDown, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
605 | if (nDirection == DN_DOWN) AkelPad.SendMessage(hWndDown, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
| 563 | else if (nDirection == DN_UP) AkelPad.SendMessage(hWndUp, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
606 | else if (nDirection == DN_UP) AkelPad.SendMessage(hWndUp, 241 /*BM_SETCHECK*/, 1 /*BST_CHECKED*/, 0); |
| 564 | |
607 | |
| 565 | //Center dialog |
608 | //Center dialog |
| 566 | CenterWindow(hMainWnd, hWnd); |
609 | CenterWindow(hMainWnd, hWnd); |
| 567 | } |
610 | } |
| 568 | else if (uMsg == 7) //WM_SETFOCUS |
611 | else if (uMsg == 7) //WM_SETFOCUS |
| 569 | { |
612 | { |
| 570 | oFunction.AddParameter(hWndWhat); |
613 | oFunction.AddParameter(hWndWhat); |
| 571 | oFunction.Call("user32::SetFocus"); |
614 | oFunction.Call("user32::SetFocus"); |
| 572 | } |
615 | } |
| 573 | else if (uMsg == 256) //WM_KEYDOWN |
616 | else if (uMsg == 256) //WM_KEYDOWN |
| 574 | { |
617 | { |
| 575 | if (wParam == 27) //VK_ESCAPE |
618 | if (wParam == 27) //VK_ESCAPE |
| 576 | { |
619 | { |
| 577 | //Escape key pushes Cancel button |
620 | //Escape key pushes Cancel button |
| 578 | oFunction.AddParameter(hWndDialog); |
621 | oFunction.AddParameter(hWndDialog); |
| 579 | oFunction.AddParameter(273); //WM_COMMAND |
622 | oFunction.AddParameter(273); //WM_COMMAND |
| 580 | oFunction.AddParameter(2); //"Cancel" |
623 | oFunction.AddParameter(2); //"Cancel" |
| 581 | oFunction.AddParameter(0); |
624 | oFunction.AddParameter(0); |
| 582 | oFunction.Call("user32::PostMessage" + _TCHAR); |
625 | oFunction.Call("user32::PostMessage" + _TCHAR); |
| 583 | } |
626 | } |
| 584 | else if (wParam == 13) //VK_RETURN |
627 | else if (wParam == 13) //VK_RETURN |
| 585 | { |
628 | { |
| 586 | //Return key pushes OK button |
629 | //Return key pushes OK button |
| 587 | oFunction.AddParameter(hWndDialog); |
630 | oFunction.AddParameter(hWndDialog); |
| 588 | oFunction.AddParameter(273); //WM_COMMAND |
631 | oFunction.AddParameter(273); //WM_COMMAND |
| 589 | oFunction.AddParameter(1011); //"FindNext" |
632 | oFunction.AddParameter(1011); //"FindNext" |
| 590 | oFunction.AddParameter(0); |
633 | oFunction.AddParameter(0); |
| 591 | oFunction.Call("user32::PostMessage" + _TCHAR); |
634 | oFunction.Call("user32::PostMessage" + _TCHAR); |
| 592 | } |
635 | } |
| 593 | } |
636 | } |
| 594 | else if (uMsg == 273) //WM_COMMAND |
637 | else if (uMsg == 273) //WM_COMMAND |
| 595 | { |
638 | { |
| 596 | if ((wParam & 0xffff) == 1001) |
639 | if ((wParam & 0xffff) == 1001) |
| 597 | { |
640 | { |
| 598 | oFunction.AddParameter(hWndWhat); |
641 | oFunction.AddParameter(hWndWhat); |
| 599 | nFindItLength=oFunction.Call("user32::GetWindowTextLength" + _TCHAR); |
642 | nFindItLength=oFunction.Call("user32::GetWindowTextLength" + _TCHAR); |
| 600 | |
643 | |
| 601 | if (nFindItLength) |
644 | if (nFindItLength) |
| 602 | { |
645 | { |
| 603 | EnableWindow(hWndFindNext, true); |
646 | EnableWindow(hWndFindNext, true); |
| 604 | EnableWindow(hWndReplace, true); |
647 | EnableWindow(hWndReplace, true); |
| 605 | EnableWindow(hWndReplaceAll, true); |
648 | EnableWindow(hWndReplaceAll, true); |
| 606 | } |
649 | } |
| 607 | else |
650 | else |
| 608 | { |
651 | { |
| 609 | EnableWindow(hWndFindNext, false); |
652 | EnableWindow(hWndFindNext, false); |
| 610 | EnableWindow(hWndReplace, false); |
653 | EnableWindow(hWndReplace, false); |
| 611 | EnableWindow(hWndReplaceAll, false); |
654 | EnableWindow(hWndReplaceAll, false); |
| 612 | } |
655 | } |
| 613 | } |
656 | } |
| 614 | else if ((wParam & 0xffff) == 1003 || //"Sensitive" |
657 | else if ((wParam & 0xffff) == 1003 || //"Sensitive" |
| 615 | (wParam & 0xffff) == 1004 || //"Multiline" |
658 | (wParam & 0xffff) == 1004 || //"Multiline" |
| 616 | (wParam & 0xffff) == 1005) //"Esc-sequences" |
659 | (wParam & 0xffff) == 1005 || //"Esc-sequences" |
| |
660 | (wParam & 0xffff) == 2000) //"Function"
|
| 617 | { |
661 | { |
| 618 | if ((wParam & 0xffff) == 1003) |
662 | if ((wParam & 0xffff) == 1003) |
| 619 | bSensitive=AkelPad.SendMessage(hWndCase, 240 /*BM_GETCHECK*/, 0, 0); |
663 | bSensitive=AkelPad.SendMessage(hWndCase, 240 /*BM_GETCHECK*/, 0, 0); |
| 620 | else if ((wParam & 0xffff) == 1004) |
664 | else if ((wParam & 0xffff) == 1004) |
| 621 | bMultiline=AkelPad.SendMessage(hWndMultiline, 240 /*BM_GETCHECK*/, 0, 0); |
665 | bMultiline=AkelPad.SendMessage(hWndMultiline, 240 /*BM_GETCHECK*/, 0, 0); |
| 622 | else if ((wParam & 0xffff) == 1005) |
666 | else if ((wParam & 0xffff) == 1005) |
| 623 | bEscSequences=AkelPad.SendMessage(hWndEscSequences, 240 /*BM_GETCHECK*/, 0, 0); |
667 | bEscSequences=AkelPad.SendMessage(hWndEscSequences, 240 /*BM_GETCHECK*/, 0, 0); |
| |
668 | else if ((wParam & 0xffff) == 2000)
|
| |
669 | {
|
| |
670 | bReplaceFunction=AkelPad.SendMessage(hWndReplaceFunction, 240 /*BM_GETCHECK*/, 0, 0);
|
| |
671 | EnableWindow(hWndEscSequences, !bReplaceFunction);
|
| |
672 | }
|
| 624 | } |
673 | } |
| 625 | else if ((wParam & 0xffff) == 1006 || //"Down" |
674 | else if ((wParam & 0xffff) == 1006 || //"Down" |
| 626 | (wParam & 0xffff) == 1007 || //"Up" |
675 | (wParam & 0xffff) == 1007 || //"Up" |
| 627 | (wParam & 0xffff) == 1008 || //"Beginning" |
676 | (wParam & 0xffff) == 1008 || //"Beginning" |
| 628 | (wParam & 0xffff) == 1009 || //"Selection" |
677 | (wParam & 0xffff) == 1009 || //"Selection" |
| 629 | (wParam & 0xffff) == 1010) //"AllFiles" |
678 | (wParam & 0xffff) == 1010) //"AllFiles" |
| 630 | { |
679 | { |
| 631 | if (nDirection & DN_ALLFILES) |
680 | if (nDirection & DN_ALLFILES) |
| 632 | AkelPad.SendMessage(hWndAllFiles, 243 /*BM_SETSTATE*/, false, 0); |
681 | AkelPad.SendMessage(hWndAllFiles, 243 /*BM_SETSTATE*/, false, 0); |
| 633 | else if (nDirection & DN_BEGINNING) |
682 | else if (nDirection & DN_BEGINNING) |
| 634 | AkelPad.SendMessage(hWndBeginning, 243 /*BM_SETSTATE*/, false, 0); |
683 | AkelPad.SendMessage(hWndBeginning, 243 /*BM_SETSTATE*/, false, 0); |
| 635 | |
684 | |
| 636 | if ((wParam & 0xffff) == 1006) |
685 | if ((wParam & 0xffff) == 1006) |
| 637 | nDirection=DN_DOWN; |
686 | nDirection=DN_DOWN; |
| 638 | else if ((wParam & 0xffff) == 1007) |
687 | else if ((wParam & 0xffff) == 1007) |
| 639 | nDirection=DN_UP; |
688 | nDirection=DN_UP; |
| 640 | else if ((wParam & 0xffff) == 1008) |
689 | else if ((wParam & 0xffff) == 1008) |
| 641 | nDirection=DN_BEGINNING; |
690 | nDirection=DN_BEGINNING; |
| 642 | else if ((wParam & 0xffff) == 1009) |
691 | else if ((wParam & 0xffff) == 1009) |
| 643 | nDirection=DN_SELECTION; |
692 | nDirection=DN_SELECTION; |
| 644 | else if ((wParam & 0xffff) == 1010) |
693 | else if ((wParam & 0xffff) == 1010) |
| 645 | nDirection=DN_ALLFILES; |
694 | nDirection=DN_ALLFILES; |
| 646 | } |
695 | } |
| 647 | else if ((wParam & 0xffff) == 1011 || //"FindNext" |
696 | else if ((wParam & 0xffff) == 1011 || //"FindNext" |
| 648 | (wParam & 0xffff) == 1012 || //"Replace" |
697 | (wParam & 0xffff) == 1012 || //"Replace" |
| 649 | (wParam & 0xffff) == 1013) //"ReplaceAll" |
698 | (wParam & 0xffff) == 1013) //"ReplaceAll" |
| 650 | { |
699 | { |
| 651 | if ((wParam & 0xffff) == 1011) |
700 | if ((wParam & 0xffff) == 1011) |
| 652 | nButton=BT_FINDNEXT; |
701 | nButton=BT_FINDNEXT; |
| 653 | else if ((wParam & 0xffff) == 1012) |
702 | else if ((wParam & 0xffff) == 1012) |
| 654 | nButton=BT_REPLACE; |
703 | nButton=BT_REPLACE; |
| 655 | else if ((wParam & 0xffff) == 1013) |
704 | else if ((wParam & 0xffff) == 1013) |
| 656 | nButton=BT_REPLACEALL; |
705 | nButton=BT_REPLACEALL; |
| 657 | |
706 | |
| 658 | oFunction.AddParameter(hWndWhat); |
707 | oFunction.AddParameter(hWndWhat); |
| 659 | oFunction.AddParameter(lpBuffer); |
708 | oFunction.AddParameter(lpBuffer); |
| 660 | oFunction.AddParameter(256); |
709 | oFunction.AddParameter(256); |
| 661 | oFunction.Call("user32::GetWindowText" + _TCHAR); |
710 | oFunction.Call("user32::GetWindowText" + _TCHAR); |
| 662 | pFindIt=AkelPad.MemRead(lpBuffer, _TSTR); |
711 | pFindIt=AkelPad.MemRead(lpBuffer, _TSTR); |
| 663 | |
712 | |
| 664 | oFunction.AddParameter(hWndWith); |
713 | oFunction.AddParameter(hWndWith); |
| 665 | oFunction.AddParameter(lpBuffer); |
714 | oFunction.AddParameter(lpBuffer); |
| 666 | oFunction.AddParameter(256); |
715 | oFunction.AddParameter(256); |
| 667 | oFunction.Call("user32::GetWindowText" + _TCHAR); |
716 | oFunction.Call("user32::GetWindowText" + _TCHAR); |
| 668 | pReplaceWith=AkelPad.MemRead(lpBuffer, _TSTR); |
717 | pReplaceWith=AkelPad.MemRead(lpBuffer, _TSTR); |
| 669 | |
718 | |
| 670 | pReplaceWithEsc=pReplaceWith; |
719 | pReplaceWithEsc=pReplaceWith; |
| 671 | if (bEscSequences) |
720 | if (bReplaceFunction) |
| |
721 | {
|
| |
722 | if (!/(^|[^\w.])return\s+\S/.test(pReplaceWithEsc))
|
| |
723 | pReplaceWithEsc = "return " + pReplaceWithEsc;
|
| |
724 | pReplaceWithEsc = "var args = {};"
|
| |
725 | + "for (var i = 0, l = arguments.length; i < l; i++)\n"
|
| |
726 | + ' args["$" + i] = arguments[i];\n'
|
| |
727 | + "with(args) {\n"
|
| |
728 | + pReplaceWithEsc
|
| |
729 | + "\n}";
|
| |
730 | pReplaceWithEsc = new Function(pReplaceWithEsc);
|
| |
731 | }
|
| |
732 | else if (bEscSequences)
|
| 672 | { |
733 | { |
| 673 | pReplaceWithEsc=pReplaceWithEsc.replace(/\\\\/g, "\0"); |
734 | pReplaceWithEsc=pReplaceWithEsc.replace(/\\\\/g, "\0"); |
| 674 | if (pReplaceWithEsc.search(/\\[^rnt]/g) != -1) |
735 | if (pReplaceWithEsc.search(/\\[^rnt]/g) != -1) |
| 675 | { |
736 | { |
| 676 | AkelPad.MessageBox(hWndDialog, GetLangString(17), pScriptName, 16 /*MB_ICONERROR*/); |
737 | AkelPad.MessageBox(hWndDialog, GetLangString(17), pScriptName, 16 /*MB_ICONERROR*/); |
| 677 | return 0; |
738 | return 0; |
| 678 | } |
739 | } |
| 679 | pReplaceWithEsc=pReplaceWithEsc.replace(/(?:\\r\\n|\\r|\\n)/g, "\r"); |
740 | pReplaceWithEsc=pReplaceWithEsc.replace(/(?:\\r\\n|\\r|\\n)/g, "\r"); |
| 680 | pReplaceWithEsc=pReplaceWithEsc.replace(/\\t/g, "\t"); |
741 | pReplaceWithEsc=pReplaceWithEsc.replace(/\\t/g, "\t"); |
| 681 | pReplaceWithEsc=pReplaceWithEsc.replace(/\0/g, "\\"); |
742 | pReplaceWithEsc=pReplaceWithEsc.replace(/\0/g, "\\"); |
| 682 | } |
743 | } |
| 683 | |
744 | |
| 684 | if (nButton == BT_REPLACEALL) |
745 | if (nButton == BT_REPLACEALL) |
| 685 | EnableWindow(hWndReplaceAll, false); |
746 | EnableWindow(hWndReplaceAll, false); |
| 686 | |
747 | |
| 687 | nSearchResult=SearchReplace(); |
748 | nSearchResult=SearchReplace(); |
| 688 | |
749 | |
| 689 | if (nButton == BT_REPLACEALL) |
750 | if (nButton == BT_REPLACEALL) |
| 690 | { |
751 | { |
| 691 | EnableWindow(hWndReplaceAll, true); |
752 | EnableWindow(hWndReplaceAll, true); |
| 692 | oFunction.AddParameter(hWndReplaceAll); |
753 | oFunction.AddParameter(hWndReplaceAll); |
| 693 | oFunction.Call("user32::SetFocus"); |
754 | oFunction.Call("user32::SetFocus"); |
| 694 | } |
755 | } |
| 695 | |
756 | |
| 696 | if (nSearchResult == -1) |
757 | if (nSearchResult == -1) |
| 697 | { |
758 | { |
| 698 | if (nDirection & DN_ALLFILES) |
759 | if (nDirection & DN_ALLFILES) |
| 699 | { |
760 | { |
| 700 | AkelPad.SendMessage(hWndAllFiles, 243 /*BM_SETSTATE*/, false, 0); |
761 | AkelPad.SendMessage(hWndAllFiles, 243 /*BM_SETSTATE*/, false, 0); |
| 701 | nDirection&=~DN_DOWN; |
762 | nDirection&=~DN_DOWN; |
| 702 | } |
763 | } |
| 703 | else if (nDirection & DN_BEGINNING) |
764 | else if (nDirection & DN_BEGINNING) |
| 704 | { |
765 | { |
| 705 | AkelPad.SendMessage(hWndBeginning, 243 /*BM_SETSTATE*/, false, 0); |
766 | AkelPad.SendMessage(hWndBeginning, 243 /*BM_SETSTATE*/, false, 0); |
| 706 | nDirection&=~DN_DOWN; |
767 | nDirection&=~DN_DOWN; |
| 707 | } |
768 | } |
| 708 | } |
769 | } |
| 709 | else |
770 | else |
| 710 | { |
771 | { |
| 711 | if (nDirection == DN_ALLFILES) |
772 | if (nDirection == DN_ALLFILES) |
| 712 | { |
773 | { |
| 713 | AkelPad.SendMessage(hWndAllFiles, 243 /*BM_SETSTATE*/, true, 0); |
774 | AkelPad.SendMessage(hWndAllFiles, 243 /*BM_SETSTATE*/, true, 0); |
| 714 | nDirection|=DN_DOWN; |
775 | nDirection|=DN_DOWN; |
| 715 | } |
776 | } |
| 716 | else if (nDirection == DN_BEGINNING) |
777 | else if (nDirection == DN_BEGINNING) |
| 717 | { |
778 | { |
| 718 | AkelPad.SendMessage(hWndBeginning, 243 /*BM_SETSTATE*/, true, 0); |
779 | AkelPad.SendMessage(hWndBeginning, 243 /*BM_SETSTATE*/, true, 0); |
| 719 | nDirection|=DN_DOWN; |
780 | nDirection|=DN_DOWN; |
| 720 | } |
781 | } |
| 721 | } |
782 | } |
| 722 | } |
783 | } |
| 723 | else if ((wParam & 0xffff) == 2) //"Cancel" |
784 | else if ((wParam & 0xffff) == 2) //"Cancel" |
| 724 | { |
785 | { |
| 725 | oFunction.AddParameter(hWndDialog); |
786 | oFunction.AddParameter(hWndDialog); |
| 726 | oFunction.AddParameter(16); //WM_CLOSE |
787 | oFunction.AddParameter(16); //WM_CLOSE |
| 727 | oFunction.AddParameter(0); |
788 | oFunction.AddParameter(0); |
| 728 | oFunction.AddParameter(0); |
789 | oFunction.AddParameter(0); |
| 729 | oFunction.Call("user32::PostMessage" + _TCHAR); |
790 | oFunction.Call("user32::PostMessage" + _TCHAR); |
| 730 | } |
791 | } |
| 731 | } |
792 | } |
| 732 | else if (uMsg == 16) //WM_CLOSE |
793 | else if (uMsg == 16) //WM_CLOSE |
| 733 | { |
794 | { |
| 734 | if (nDirection != DN_DOWN) nDirection&=~DN_DOWN; |
795 | if (nDirection != DN_DOWN) nDirection&=~DN_DOWN; |
| 735 | WshShell.RegWrite("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Find", pFindIt, "REG_SZ"); |
796 | WshShell.RegWrite("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Find", pFindIt, "REG_SZ"); |
| 736 | WshShell.RegWrite("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Replace", pReplaceWith, "REG_SZ"); |
797 | WshShell.RegWrite("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Replace", pReplaceWith, "REG_SZ"); |
| 737 | WshShell.RegWrite("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Sensitive", bSensitive, "REG_DWORD"); |
798 | WshShell.RegWrite("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Sensitive", bSensitive, "REG_DWORD"); |
| 738 | WshShell.RegWrite("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Multiline", bMultiline, "REG_DWORD"); |
799 | WshShell.RegWrite("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Multiline", bMultiline, "REG_DWORD"); |
| 739 | WshShell.RegWrite("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\EscSequences", bEscSequences, "REG_DWORD"); |
800 | WshShell.RegWrite("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\EscSequences", bEscSequences, "REG_DWORD"); |
| |
801 | WshShell.RegWrite("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\ReplaceFunction", bReplaceFunction, "REG_DWORD");
|
| 740 | WshShell.RegWrite("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Direction", nDirection, "REG_DWORD"); |
802 | WshShell.RegWrite("HKCU\\Software\\Akelsoft\\AkelPad\\Plugs\\Scripts\\SearchReplace\\Direction", nDirection, "REG_DWORD"); |
| 741 | |
803 | |
| 742 | //Destroy dialog |
804 | //Destroy dialog |
| 743 | oFunction.AddParameter(hWnd); |
805 | oFunction.AddParameter(hWnd); |
| 744 | oFunction.Call("user32::DestroyWindow"); |
806 | oFunction.Call("user32::DestroyWindow"); |
| 745 | } |
807 | } |
| 746 | else if (uMsg == 2) //WM_DESTROY |
808 | else if (uMsg == 2) //WM_DESTROY |
| 747 | { |
809 | { |
| 748 | //Exit message loop |
810 | //Exit message loop |
| 749 | oFunction.AddParameter(0); |
811 | oFunction.AddParameter(0); |
| 750 | oFunction.Call("user32::PostQuitMessage"); |
812 | oFunction.Call("user32::PostQuitMessage"); |
| 751 | } |
813 | } |
| 752 | return 0; |
814 | return 0; |
| 753 | } |
815 | } |
| 754 | |
816 | |
| 755 | function SearchReplace() |
817 | function SearchReplace() |
| 756 | { |
818 | { |
| 757 | var hWndInitialEdit; |
819 | var hWndInitialEdit; |
| 758 | var hWndCurrentEdit; |
820 | var hWndCurrentEdit; |
| 759 | var oPattern; |
821 | var oPattern; |
| 760 | var pSelText; |
822 | var pSelText; |
| 761 | var pArray; |
823 | var pArray; |
| 762 | var pResult; |
824 | var pResult; |
| 763 | var nInitialSelStart; |
825 | var nInitialSelStart; |
| 764 | var nInitialSelEnd; |
826 | var nInitialSelEnd; |
| 765 | var nSelStart; |
827 | var nSelStart; |
| 766 | var nSelEnd; |
828 | var nSelEnd; |
| 767 | var nError; |
829 | var nError; |
| 768 | var nResult=-1; |
830 | var nResult=-1; |
| 769 | var i; |
831 | var i; |
| 770 | |
832 | |
| |
833 | var replaceCount = 0, _m;
|
| |
834 |
|
| 771 | hWndInitialEdit=AkelPad.GetEditWnd(); |
835 | hWndInitialEdit=AkelPad.GetEditWnd(); |
| 772 | hWndCurrentEdit=hWndInitialEdit; |
836 | hWndCurrentEdit=hWndInitialEdit; |
| 773 | oPattern=new RegExp(pFindIt, (bSensitive?"":"i") + (nButton == BT_REPLACEALL || nDirection & DN_UP?"g":"") + (bMultiline?"m":"")); |
837 | oPattern=new RegExp(pFindIt, (bSensitive?"":"i") + (nButton == BT_REPLACEALL || nDirection & DN_UP?"g":"") + (bMultiline?"m":"")); |
| 774 | |
838 | |
| 775 | while (1) |
839 | while (1) |
| 776 | { |
840 | { |
| 777 | nInitialSelStart=AkelPad.GetSelStart(); |
841 | nInitialSelStart=AkelPad.GetSelStart(); |
| 778 | nInitialSelEnd=AkelPad.GetSelEnd(); |
842 | nInitialSelEnd=AkelPad.GetSelEnd(); |
| 779 | |
843 | |
| 780 | if (nButton == BT_REPLACE) |
844 | if (nButton == BT_REPLACE) |
| 781 | { |
845 | { |
| 782 | if (nInitialSelStart != nInitialSelEnd) |
846 | if (nInitialSelStart != nInitialSelEnd) |
| 783 | { |
847 | { |
| 784 | pSelText=AkelPad.GetSelText(); |
848 | pSelText=AkelPad.GetSelText(); |
| 785 | |
849 | |
| 786 | if (pArray=pSelText.match(oPattern)) |
850 | if (pArray=pSelText.match(oPattern)) |
| 787 | { |
851 | { |
| 788 | if (pArray.index == 0 && pArray[0].length == (nInitialSelEnd - nInitialSelStart)) |
852 | if (pArray.index == 0 && pArray[0].length == (nInitialSelEnd - nInitialSelStart)) |
| 789 | { |
853 | { |
| 790 | pResult=pSelText.replace(oPattern, pReplaceWithEsc); |
854 | pResult=pSelText.replace(oPattern, pReplaceWithEsc); |
| 791 | AkelPad.ReplaceSel(pResult); |
855 | AkelPad.ReplaceSel(pResult); |
| 792 | |
856 | |
| 793 | nInitialSelStart=AkelPad.GetSelStart(); |
857 | nInitialSelStart=AkelPad.GetSelStart(); |
| 794 | nInitialSelEnd=AkelPad.GetSelEnd(); |
858 | nInitialSelEnd=AkelPad.GetSelEnd(); |
| 795 | } |
859 | } |
| 796 | } |
860 | } |
| 797 | } |
861 | } |
| 798 | nButton=BT_FINDNEXT; |
862 | nButton=BT_FINDNEXT; |
| 799 | } |
863 | } |
| 800 | |
864 | |
| 801 | if (nDirection & DN_DOWN) |
865 | if (nDirection & DN_DOWN) |
| 802 | { |
866 | { |
| 803 | if (nButton == BT_FINDNEXT) |
867 | if (nButton == BT_FINDNEXT) |
| 804 | { |
868 | { |
| 805 | nSelStart=nInitialSelEnd; |
869 | nSelStart=nInitialSelEnd; |
| 806 | nSelEnd=-1; |
870 | nSelEnd=-1; |
| 807 | } |
871 | } |
| 808 | else |
872 | else |
| 809 | { |
873 | { |
| 810 | nSelStart=nInitialSelStart; |
874 | nSelStart=nInitialSelStart; |
| 811 | nSelEnd=-1; |
875 | nSelEnd=-1; |
| 812 | } |
876 | } |
| 813 | } |
877 | } |
| 814 | else if (nDirection & DN_UP) |
878 | else if (nDirection & DN_UP) |
| 815 | { |
879 | { |
| 816 | if (nButton == BT_FINDNEXT) |
880 | if (nButton == BT_FINDNEXT) |
| 817 | { |
881 | { |
| 818 | nSelStart=0; |
882 | nSelStart=0; |
| 819 | nSelEnd=nInitialSelStart; |
883 | nSelEnd=nInitialSelStart; |
| 820 | } |
884 | } |
| 821 | else |
885 | else |
| 822 | { |
886 | { |
| 823 | nSelStart=0; |
887 | nSelStart=0; |
| 824 | nSelEnd=nInitialSelEnd; |
888 | nSelEnd=nInitialSelEnd; |
| 825 | } |
889 | } |
| 826 | } |
890 | } |
| 827 | else if (nDirection & DN_BEGINNING) |
891 | else if (nDirection & DN_BEGINNING) |
| 828 | { |
892 | { |
| 829 | nSelStart=0; |
893 | nSelStart=0; |
| 830 | nSelEnd=-1; |
894 | nSelEnd=-1; |
| 831 | } |
895 | } |
| 832 | else if (nDirection & DN_SELECTION) |
896 | else if (nDirection & DN_SELECTION) |
| 833 | { |
897 | { |
| 834 | nSelStart=nInitialSelStart; |
898 | nSelStart=nInitialSelStart; |
| 835 | nSelEnd=nInitialSelEnd; |
899 | nSelEnd=nInitialSelEnd; |
| 836 | } |
900 | } |
| 837 | else if (nDirection & DN_ALLFILES) |
901 | else if (nDirection & DN_ALLFILES) |
| 838 | { |
902 | { |
| 839 | nSelStart=0; |
903 | nSelStart=0; |
| 840 | nSelEnd=-1; |
904 | nSelEnd=-1; |
| 841 | } |
905 | } |
| 842 | SetRedraw(hWndCurrentEdit, false); |
906 | SetRedraw(hWndCurrentEdit, false); |
| 843 | |
907 | |
| 844 | try |
908 | try |
| 845 | { |
909 | { |
| 846 | AkelPad.SetSel(nSelStart, nSelEnd); |
910 | AkelPad.SetSel(nSelStart, nSelEnd); |
| 847 | nSelStart=AkelPad.GetSelStart(); |
911 | nSelStart=AkelPad.GetSelStart(); |
| 848 | nSelEnd=AkelPad.GetSelEnd(); |
912 | nSelEnd=AkelPad.GetSelEnd(); |
| 849 | pSelText=AkelPad.GetSelText(); |
913 | pSelText=AkelPad.GetSelText(); |
| 850 | |
914 | |
| 851 | if (nButton == BT_FINDNEXT) |
915 | if (nButton == BT_FINDNEXT) |
| 852 | { |
916 | { |
| 853 | if (pArray=pSelText.match(oPattern)) |
917 | if (pArray=pSelText.match(oPattern)) |
| 854 | { |
918 | { |
| 855 | if (nDirection & DN_UP) |
919 | if (nDirection & DN_UP) |
| 856 | { |
920 | { |
| 857 | for (i=0; pArray[i]; ++i); |
921 | for (i=0; pArray[i]; ++i); |
| 858 | AkelPad.SetSel(nSelStart + (pArray.lastIndex - pArray[i - 1].length), nSelStart + pArray.lastIndex); |
922 | AkelPad.SetSel(nSelStart + (pArray.lastIndex - pArray[i - 1].length), nSelStart + pArray.lastIndex); |
| 859 | } |
923 | } |
| 860 | else |
924 | else |
| 861 | { |
925 | { |
| 862 | AkelPad.SetSel(nSelStart + pArray.index, nSelStart + pArray.index + pArray[0].length); |
926 | AkelPad.SetSel(nSelStart + pArray.index, nSelStart + pArray.index + pArray[0].length); |
| 863 | } |
927 | } |
| 864 | SetRedraw(hWndCurrentEdit, true); |
928 | SetRedraw(hWndCurrentEdit, true); |
| 865 | nResult=AkelPad.GetSelStart(); |
929 | nResult=AkelPad.GetSelStart(); |
| 866 | } |
930 | } |
| 867 | else |
931 | else |
| 868 | { |
932 | { |
| 869 | AkelPad.SetSel(nInitialSelStart, nInitialSelEnd); |
933 | AkelPad.SetSel(nInitialSelStart, nInitialSelEnd); |
| 870 | SetRedraw(hWndCurrentEdit, true); |
934 | SetRedraw(hWndCurrentEdit, true); |
| 871 | |
935 | |
| 872 | if (nDirection & DN_ALLFILES) |
936 | if (nDirection & DN_ALLFILES) |
| 873 | { |
937 | { |
| 874 | //Next MDI frame |
938 | //Next MDI frame |
| 875 | AkelPad.SendMessage(hMainWnd, 273 /*WM_COMMAND*/, 4404 /*IDM_NONMENU_MDINEXT*/, 0); |
939 | AkelPad.SendMessage(hMainWnd, 273 /*WM_COMMAND*/, 4404 /*IDM_NONMENU_MDINEXT*/, 0); |
| 876 | hWndCurrentEdit=AkelPad.GetEditWnd(); |
940 | hWndCurrentEdit=AkelPad.GetEditWnd(); |
| 877 | if (hWndCurrentEdit != hWndInitialEdit) |
941 | if (hWndCurrentEdit != hWndInitialEdit) |
| 878 | { |
942 | { |
| 879 | AkelPad.SetSel(0, 0); |
943 | AkelPad.SetSel(0, 0); |
| 880 | continue; |
944 | continue; |
| 881 | } |
945 | } |
| 882 | } |
946 | } |
| 883 | AkelPad.MessageBox(hWndDialog, GetLangString(18), pScriptName, 64 /*MB_ICONINFORMATION*/); |
947 | AkelPad.MessageBox(hWndDialog, GetLangString(18), pScriptName, 64 /*MB_ICONINFORMATION*/); |
| 884 | } |
948 | } |
| 885 | } |
949 | } |
| 886 | else if (nButton == BT_REPLACEALL) |
950 | else if (nButton == BT_REPLACEALL) |
| 887 | { |
951 | { |
| |
952 | _m = pSelText.match(oPattern);
|
| |
953 | replaceCount += _m ? _m.length : 0;
|
| |
954 |
|
| 888 | pResult=pSelText.replace(oPattern, pReplaceWithEsc); |
955 | pResult=pSelText.replace(oPattern, pReplaceWithEsc); |
| 889 | AkelPad.ReplaceSel(pResult); |
956 | AkelPad.ReplaceSel(pResult); |
| 890 | |
957 | |
| 891 | if (nDirection & DN_SELECTION) |
958 | if (nDirection & DN_SELECTION) |
| 892 | AkelPad.SetSel(nSelStart, nSelStart + pResult.length); |
959 | AkelPad.SetSel(nSelStart, nSelStart + pResult.length); |
| 893 | else |
960 | else |
| 894 | AkelPad.SetSel(nInitialSelStart, nInitialSelEnd); |
961 | AkelPad.SetSel(nInitialSelStart, nInitialSelEnd); |
| 895 | SetRedraw(hWndCurrentEdit, true); |
962 | SetRedraw(hWndCurrentEdit, true); |
| 896 | |
963 | |
| 897 | if (nDirection & DN_ALLFILES) |
964 | if (nDirection & DN_ALLFILES) |
| 898 | { |
965 | { |
| 899 | //Next MDI frame |
966 | //Next MDI frame |
| 900 | AkelPad.SendMessage(hMainWnd, 273 /*WM_COMMAND*/, 4404 /*IDM_NONMENU_MDINEXT*/, 0); |
967 | AkelPad.SendMessage(hMainWnd, 273 /*WM_COMMAND*/, 4404 /*IDM_NONMENU_MDINEXT*/, 0); |
| 901 | hWndCurrentEdit=AkelPad.GetEditWnd(); |
968 | hWndCurrentEdit=AkelPad.GetEditWnd(); |
| 902 | if (hWndCurrentEdit != hWndInitialEdit) |
969 | if (hWndCurrentEdit != hWndInitialEdit) |
| 903 | { |
970 | { |
| 904 | AkelPad.SetSel(0, 0); |
971 | AkelPad.SetSel(0, 0); |
| 905 | continue; |
972 | continue; |
| 906 | } |
973 | } |
| 907 | } |
974 | } |
| |
975 | AkelPad.MessageBox(hWndDialog, GetLangString(101) + replaceCount, pScriptName, 64 /*MB_ICONINFORMATION*/);
|
| 908 | } |
976 | } |
| 909 | } |
977 | } |
| 910 | catch (nError) |
978 | catch (nError) |
| 911 | { |
979 | { |
| 912 | SetRedraw(hWndCurrentEdit, true); |
980 | SetRedraw(hWndCurrentEdit, true); |
| 913 | AkelPad.MessageBox(hWndDialog, nError.description, pScriptName, 16 /*MB_ICONERROR*/); |
981 | AkelPad.MessageBox(hWndDialog, nError.description, pScriptName, 16 /*MB_ICONERROR*/); |
| 914 | } |
982 | } |
| 915 | break; |
983 | break; |
| 916 | } |
984 | } |
| 917 | return nResult; |
985 | return nResult; |
| 918 | } |
986 | } |
| 919 | |
987 | |
| 920 | |
988 | |
| 921 | //Functions |
989 | //Functions |
| 922 | function SetWindowFontAndText(hWnd, hFont, pText) |
990 | function SetWindowFontAndText(hWnd, hFont, pText) |
| 923 | { |
991 | { |
| 924 | var lpWindowText; |
992 | var lpWindowText; |
| 925 | |
993 | |
| 926 | AkelPad.SendMessage(hWnd, 48 /*WM_SETFONT*/, hFont, true); |
994 | AkelPad.SendMessage(hWnd, 48 /*WM_SETFONT*/, hFont, true); |
| 927 | |
995 | |
| 928 | if (lpWindowText=AkelPad.MemAlloc(256 * _TSIZE)) |
996 | if (lpWindowText=AkelPad.MemAlloc(256 * _TSIZE)) |
| 929 | { |
997 | { |
| 930 | AkelPad.MemCopy(lpWindowText, pText.substr(0, 255), _TSTR); |
998 | AkelPad.MemCopy(lpWindowText, pText.substr(0, 255), _TSTR); |
| 931 | oFunction.AddParameter(hWnd); |
999 | oFunction.AddParameter(hWnd); |
| 932 | oFunction.AddParameter(lpWindowText); |
1000 | oFunction.AddParameter(lpWindowText); |
| 933 | oFunction.Call("user32::SetWindowText" + _TCHAR); |
1001 | oFunction.Call("user32::SetWindowText" + _TCHAR); |
| 934 | |
1002 | |
| 935 | AkelPad.MemFree(lpWindowText); |
1003 | AkelPad.MemFree(lpWindowText); |
| 936 | } |
1004 | } |
| 937 | } |
1005 | } |
| 938 | |
1006 | |
| 939 | function SetRedraw(hWnd, bRedraw) |
1007 | function SetRedraw(hWnd, bRedraw) |
| 940 | { |
1008 | { |
| 941 | AkelPad.SendMessage(hWnd, 11 /*WM_SETREDRAW*/, bRedraw, 0); |
1009 | AkelPad.SendMessage(hWnd, 11 /*WM_SETREDRAW*/, bRedraw, 0); |
| 942 | |
1010 | |
| 943 | if (bRedraw) |
1011 | if (bRedraw) |
| 944 | { |
1012 | { |
| 945 | oFunction.AddParameter(hWnd); |
1013 | oFunction.AddParameter(hWnd); |
| 946 | oFunction.AddParameter(0); |
1014 | oFunction.AddParameter(0); |
| 947 | oFunction.AddParameter(true); |
1015 | oFunction.AddParameter(true); |
| 948 | oFunction.Call("user32::InvalidateRect"); |
1016 | oFunction.Call("user32::InvalidateRect"); |
| 949 | } |
1017 | } |
| 950 | } |
1018 | } |
| 951 | |
1019 | |
| 952 | function EnableWindow(hWnd, bEnable) |
1020 | function EnableWindow(hWnd, bEnable) |
| 953 | { |
1021 | { |
| 954 | oFunction.AddParameter(hWnd); |
1022 | oFunction.AddParameter(hWnd); |
| 955 | oFunction.AddParameter(bEnable); |
1023 | oFunction.AddParameter(bEnable); |
| 956 | oFunction.Call("user32::EnableWindow"); |
1024 | oFunction.Call("user32::EnableWindow"); |
| 957 | } |
1025 | } |
| 958 | |
1026 | |
| 959 | function CenterWindow(hWndParent, hWnd) |
1027 | function CenterWindow(hWndParent, hWnd) |
| 960 | { |
1028 | { |
| 961 | var lpRect; |
1029 | var lpRect; |
| 962 | var nLeftParent; |
1030 | var nLeftParent; |
| 963 | var nTopParent; |
1031 | var nTopParent; |
| 964 | var nRightParent; |
1032 | var nRightParent; |
| 965 | var nBottomParent; |
1033 | var nBottomParent; |
| 966 | var nLeft; |
1034 | var nLeft; |
| 967 | var nTop; |
1035 | var nTop; |
| 968 | var nRight; |
1036 | var nRight; |
| 969 | var nBottom; |
1037 | var nBottom; |
| 970 | var X; |
1038 | var X; |
| 971 | var Y; |
1039 | var Y; |
| 972 | |
1040 | |
| 973 | if (lpRect=AkelPad.MemAlloc(16)) //sizeof(RECT) |
1041 | if (lpRect=AkelPad.MemAlloc(16)) //sizeof(RECT) |
| 974 | { |
1042 | { |
| 975 | if (!hWndParent) |
1043 | if (!hWndParent) |
| 976 | hWndParent=oFunction.Call("user32::GetDesktopWindow"); |
1044 | hWndParent=oFunction.Call("user32::GetDesktopWindow"); |
| 977 | |
1045 | |
| 978 | //Get rect |
1046 | //Get rect |
| 979 | oFunction.AddParameter(hWndParent); |
1047 | oFunction.AddParameter(hWndParent); |
| 980 | oFunction.AddParameter(lpRect); |
1048 | oFunction.AddParameter(lpRect); |
| 981 | oFunction.Call("user32::GetWindowRect"); |
1049 | oFunction.Call("user32::GetWindowRect"); |
| 982 | |
1050 | |
| 983 | nLeftParent=AkelPad.MemRead(lpRect, 3 /*DT_DWORD*/); |
1051 | nLeftParent=AkelPad.MemRead(lpRect, 3 /*DT_DWORD*/); |
| 984 | nTopParent=AkelPad.MemRead(lpRect + 4, 3 /*DT_DWORD*/); |
1052 | nTopParent=AkelPad.MemRead(lpRect + 4, 3 /*DT_DWORD*/); |
| 985 | nRightParent=AkelPad.MemRead(lpRect + 8, 3 /*DT_DWORD*/); |
1053 | nRightParent=AkelPad.MemRead(lpRect + 8, 3 /*DT_DWORD*/); |
| 986 | nBottomParent=AkelPad.MemRead(lpRect + 12, 3 /*DT_DWORD*/); |
1054 | nBottomParent=AkelPad.MemRead(lpRect + 12, 3 /*DT_DWORD*/); |
| 987 | |
1055 | |
| 988 | //Get rect |
1056 | //Get rect |
| 989 | oFunction.AddParameter(hWnd); |
1057 | oFunction.AddParameter(hWnd); |
| 990 | oFunction.AddParameter(lpRect); |
1058 | oFunction.AddParameter(lpRect); |
| 991 | oFunction.Call("user32::GetWindowRect"); |
1059 | oFunction.Call("user32::GetWindowRect"); |
| 992 | |
1060 | |
| 993 | nLeft=AkelPad.MemRead(lpRect, 3 /*DT_DWORD*/); |
1061 | nLeft=AkelPad.MemRead(lpRect, 3 /*DT_DWORD*/); |
| 994 | nTop=AkelPad.MemRead(lpRect + 4, 3 /*DT_DWORD*/); |
1062 | nTop=AkelPad.MemRead(lpRect + 4, 3 /*DT_DWORD*/); |
| 995 | nRight=AkelPad.MemRead(lpRect + 8, 3 /*DT_DWORD*/); |
1063 | nRight=AkelPad.MemRead(lpRect + 8, 3 /*DT_DWORD*/); |
| 996 | nBottom=AkelPad.MemRead(lpRect + 12, 3 /*DT_DWORD*/); |
1064 | nBottom=AkelPad.MemRead(lpRect + 12, 3 /*DT_DWORD*/); |
| 997 | |
1065 | |
| 998 | //Center window |
1066 | //Center window |
| 999 | X=nLeftParent + ((nRightParent - nLeftParent) / 2 - (nRight - nLeft) / 2); |
1067 | X=nLeftParent + ((nRightParent - nLeftParent) / 2 - (nRight - nLeft) / 2); |
| 1000 | Y=nTopParent + ((nBottomParent - nTopParent) / 2 - (nBottom - nTop) / 2); |
1068 | Y=nTopParent + ((nBottomParent - nTopParent) / 2 - (nBottom - nTop) / 2); |
| 1001 | |
1069 | |
| 1002 | oFunction.AddParameter(hWnd); |
1070 | oFunction.AddParameter(hWnd); |
| 1003 | oFunction.AddParameter(0); |
1071 | oFunction.AddParameter(0); |
| 1004 | oFunction.AddParameter(X); |
1072 | oFunction.AddParameter(X); |
| 1005 | oFunction.AddParameter(Y); |
1073 | oFunction.AddParameter(Y); |
| 1006 | oFunction.AddParameter(0); |
1074 | oFunction.AddParameter(0); |
| 1007 | oFunction.AddParameter(0); |
1075 | oFunction.AddParameter(0); |
| 1008 | oFunction.AddParameter(0x15); //SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE |
1076 | oFunction.AddParameter(0x15); //SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE |
| 1009 | oFunction.Call("user32::SetWindowPos"); |
1077 | oFunction.Call("user32::SetWindowPos"); |
| 1010 | |
1078 | |
| 1011 | AkelPad.MemFree(lpRect); |
1079 | AkelPad.MemFree(lpRect); |
| 1012 | } |
1080 | } |
| 1013 | } |
1081 | } |
| 1014 | |
1082 | |
| 1015 | function GetParent(pFile) |
1083 | function GetParent(pFile) |
| 1016 | { |
1084 | { |
| 1017 | var i; |
1085 | var i; |
| 1018 | |
1086 | |
| 1019 | for (i=pFile.length - 1; i >= 0; --i) |
1087 | for (i=pFile.length - 1; i >= 0; --i) |
| 1020 | { |
1088 | { |
| 1021 | if (pFile.charAt(i) == '\\') |
1089 | if (pFile.charAt(i) == '\\') |
| 1022 | return pFile.substr(0, i); |
1090 | return pFile.substr(0, i); |
| 1023 | } |
1091 | } |
| 1024 | return ""; |
1092 | return ""; |
| 1025 | } |
1093 | } |
| 1026 | |
1094 | |
| 1027 | function GetLangString(nStringID) |
1095 | function GetLangString(nStringID) |
| 1028 | { |
1096 | { |
| 1029 | var nLangID; |
1097 | var nLangID; |
| 1030 | |
1098 | |
| 1031 | nLangID=oFunction.Call("kernel32::GetUserDefaultLangID"); |
1099 | nLangID=oFunction.Call("kernel32::GetUserDefaultLangID"); |
| 1032 | nLangID=nLangID & 0x3ff; //PRIMARYLANGID |
1100 | nLangID=nLangID & 0x3ff; //PRIMARYLANGID |
| 1033 | |
1101 | |
| 1034 | if (nLangID == 0x19) //LANG_RUSSIAN |
1102 | if (nLangID == 0x19) //LANG_RUSSIAN |
| 1035 | { |
1103 | { |
| 1036 | if (nStringID == 0) |
1104 | if (nStringID == 0) |
| 1037 | return "Версия JScript ниже, чем 5.5."; |
1105 | return "Версия JScript ниже, чем 5.5."; |
| 1038 | if (nStringID == 1) |
1106 | if (nStringID == 1) |
| 1039 | return "Отмена"; |
1107 | return "Отмена"; |
| 1040 | if (nStringID == 2) |
1108 | if (nStringID == 2) |
| 1041 | return "Что:"; |
1109 | return "Что:"; |
| 1042 | if (nStringID == 3) |
1110 | if (nStringID == 3) |
| 1043 | return "Чем:"; |
1111 | return "Чем:"; |
| 1044 | if (nStringID == 4) |
1112 | if (nStringID == 4) |
| 1045 | return "Учитывать регистр"; |
1113 | return "Учитывать регистр"; |
| 1046 | if (nStringID == 5) |
1114 | if (nStringID == 5) |
| 1047 | return "Глобально"; |
1115 | return "Глобально"; |
| 1048 | if (nStringID == 6) |
1116 | if (nStringID == 6) |
| 1049 | return "Многострочно"; |
1117 | return "Многострочно"; |
| 1050 | if (nStringID == 7) |
1118 | if (nStringID == 7) |
| 1051 | return "Esc-последовательности"; |
1119 | return "Esc-последовательности"; |
| 1052 | if (nStringID == 8) |
1120 | if (nStringID == 8) |
| 1053 | return "Направление"; |
1121 | return "Направление"; |
| 1054 | if (nStringID == 9) |
1122 | if (nStringID == 9) |
| 1055 | return "Вниз"; |
1123 | return "Вниз"; |
| 1056 | if (nStringID == 10) |
1124 | if (nStringID == 10) |
| 1057 | return "Вверх"; |
1125 | return "Вверх"; |
| 1058 | if (nStringID == 11) |
1126 | if (nStringID == 11) |
| 1059 | return "С начала"; |
1127 | return "С начала"; |
| 1060 | if (nStringID == 12) |
1128 | if (nStringID == 12) |
| 1061 | return "В выделении"; |
1129 | return "В выделении"; |
| 1062 | if (nStringID == 13) |
1130 | if (nStringID == 13) |
| 1063 | return "Все файлы"; |
1131 | return "Все файлы"; |
| 1064 | if (nStringID == 14) |
1132 | if (nStringID == 14) |
| 1065 | return "Найти далее"; |
1133 | return "Найти далее"; |
| 1066 | if (nStringID == 15) |
1134 | if (nStringID == 15) |
| 1067 | return "Заменить"; |
1135 | return "Заменить"; |
| 1068 | if (nStringID == 16) |
1136 | if (nStringID == 16) |
| 1069 | return "Заменить всё"; |
1137 | return "Заменить всё"; |
| 1070 | if (nStringID == 17) |
1138 | if (nStringID == 17) |
| 1071 | return "Синтаксическая ошибка:\n \\\\ - обратный слэш\n \\r - конец строки\n \\t - знак табуляции"; |
1139 | return "Синтаксическая ошибка:\n \\\\ - обратный слэш\n \\r - конец строки\n \\t - знак табуляции"; |
| 1072 | if (nStringID == 18) |
1140 | if (nStringID == 18) |
| 1073 | return "Поиск завершен."; |
1141 | return "Поиск завершен."; |
| |
1142 | if (nStringID == 100)
|
| |
1143 | return "Заменять на функцию";
|
| |
1144 | if (nStringID == 101)
|
| |
1145 | return "Количество замен: ";
|
| 1074 | } |
1146 | } |
| 1075 | else |
1147 | else |
| 1076 | { |
1148 | { |
| 1077 | if (nStringID == 0) |
1149 | if (nStringID == 0) |
| 1078 | return "JScript version is less than 5.5."; |
1150 | return "JScript version is less than 5.5."; |
| 1079 | if (nStringID == 1) |
1151 | if (nStringID == 1) |
| 1080 | return "Cancel"; |
1152 | return "Cancel"; |
| 1081 | if (nStringID == 2) |
1153 | if (nStringID == 2) |
| 1082 | return "What:"; |
1154 | return "What:"; |
| 1083 | if (nStringID == 3) |
1155 | if (nStringID == 3) |
| 1084 | return "With:"; |
1156 | return "With:"; |
| 1085 | if (nStringID == 4) |
1157 | if (nStringID == 4) |
| 1086 | return "Case sensitive"; |
1158 | return "Case sensitive"; |
| 1087 | if (nStringID == 5) |
1159 | if (nStringID == 5) |
| 1088 | return "Global"; |
1160 | return "Global"; |
| 1089 | if (nStringID == 6) |
1161 | if (nStringID == 6) |
| 1090 | return "Multiline"; |
1162 | return "Multiline"; |
| 1091 | if (nStringID == 7) |
1163 | if (nStringID == 7) |
| 1092 | return "Esc-sequences"; |
1164 | return "Esc-sequences"; |
| 1093 | if (nStringID == 8) |
1165 | if (nStringID == 8) |
| 1094 | return "Direction"; |
1166 | return "Direction"; |
| 1095 | if (nStringID == 9) |
1167 | if (nStringID == 9) |
| 1096 | return "Down"; |
1168 | return "Down"; |
| 1097 | if (nStringID == 10) |
1169 | if (nStringID == 10) |
| 1098 | return "Up"; |
1170 | return "Up"; |
| 1099 | if (nStringID == 11) |
1171 | if (nStringID == 11) |
| 1100 | return "Beginning"; |
1172 | return "Beginning"; |
| 1101 | if (nStringID == 12) |
1173 | if (nStringID == 12) |
| 1102 | return "In selection"; |
1174 | return "In selection"; |
| 1103 | if (nStringID == 13) |
1175 | if (nStringID == 13) |
| 1104 | return "All files"; |
1176 | return "All files"; |
| 1105 | if (nStringID == 14) |
1177 | if (nStringID == 14) |
| 1106 | return "Find next"; |
1178 | return "Find next"; |
| 1107 | if (nStringID == 15) |
1179 | if (nStringID == 15) |
| 1108 | return "Replace"; |
1180 | return "Replace"; |
| 1109 | if (nStringID == 16) |
1181 | if (nStringID == 16) |
| 1110 | return "Replace all"; |
1182 | return "Replace all"; |
| 1111 | if (nStringID == 17) |
1183 | if (nStringID == 17) |
| 1112 | return "Syntax error:\n \\\\ - backslash\n \\r - line feed\n \\t - tabulation"; |
1184 | return "Syntax error:\n \\\\ - backslash\n \\r - line feed\n \\t - tabulation"; |
| 1113 | if (nStringID == 18) |
1185 | if (nStringID == 18) |
| 1114 | return "Search finished."; |
1186 | return "Search finished."; |
| |
1187 | if (nStringID == 100)
|
| |
1188 | return "Replace with function";
|
| |
1189 | if (nStringID == 101)
|
| |
1190 | return "Count of changes: ";
|
| 1115 | } |
1191 | } |
| 1116 | return ""; |
1192 | return ""; |
| 1117 | }
|
1193 | } |
| 1118 | |
| |