source: dev/trunk/abdev/ProjectEditor/ParameterHint.cpp@ 238

Last change on this file since 238 was 118, checked in by dai_9181, 18 years ago

Namespace名前空間のコード補間機能に対応。

File size: 34.0 KB
Line 
1#include "common.h"
2
3void ShowCommandMessage(void);
4
5BOOL CheckGrammar(char *buffer){
6 int i,IsStr,PareNum;
7
8 for(i=0,IsStr=0,PareNum=0;;i++){
9 if(buffer[i]=='\"') IsStr^=1;
10 else if(buffer[i]=='(') PareNum++;
11 else if(buffer[i]==')') PareNum--;
12 else if(buffer[i]=='\0'||(buffer[i]=='\r'&&buffer[i+1]=='\n')){
13 if(IsStr||PareNum) return 0;
14 if(buffer[i]=='\0') break;
15 i++;
16 continue;
17 }
18 else if(buffer[i]=='\''&&IsStr==0){
19 while(!(buffer[i]=='\0'||(buffer[i]=='\r'&&buffer[i+1]=='\n'))) i++;
20 i--;
21 continue;
22 }
23 }
24 return 1;
25}
26
27char *GetUserSourceCode(void){
28 //単体ファイルのときはそのファイルを、プロジェクトのときはpjname.abの内容を取得
29 extern HANDLE hHeap;
30 extern PROJECTINFO ProjectInfo;
31 int i;
32 char temporary[MAX_PATH],*pBuf;
33
34 if(ProjectInfo.name[0]){
35 //プロジェクトが開かれているとき
36 lstrcpy(temporary,ProjectInfo.pobj_DBFileInfo->ppobj_FileInfo[0]->m_path);
37 GetFullPath(temporary,ProjectInfo.dir);
38
39 extern MDIINFO MdiInfo[MAX_WNDNUM];
40 for(i=0;i<MAX_WNDNUM;i++){
41 if(MdiInfo[i].hwnd){
42 if(lstrcmpi(MdiInfo[i].path,temporary)==0) break;
43 }
44 }
45 if(i==MAX_WNDNUM){
46 //ファイルから開く
47 pBuf=ReadBuffer(temporary);
48 }
49 else{
50 //エディタから読み込む
51 pBuf=(char *)HeapAlloc(hHeap,0,lstrlen(MdiInfo[i].pMdiTextEdit->buffer)+1);
52 lstrcpy(pBuf,MdiInfo[i].pMdiTextEdit->buffer);
53 }
54 }
55 else{
56 //単体ソースコードのとき
57 extern MDIINFO MdiInfo[MAX_WNDNUM];
58 int WndNum;
59
60 WndNum=GetWndNum(GetWindow(hClient,GW_CHILD));
61
62 pBuf=(char *)HeapAlloc(hHeap,0,lstrlen(MdiInfo[WndNum].pMdiTextEdit->buffer)+1);
63 lstrcpy(pBuf,MdiInfo[WndNum].pMdiTextEdit->buffer);
64 }
65
66 //ファイルをインクルード
67 pBuf=IncludeFiles(pBuf);
68
69 return pBuf;
70}
71
72BOOL SetCommandMessageToMethodCheck(char *Command){
73 extern METHODCHECKINFO MethodCheckInfo;
74 int CmdValue;
75
76 CmdValue=IsBasicReservedWord(Command);
77 if(CmdValue==COM_ABSTRACT) lstrcpy(MethodCheckInfo.msg,"Abstract Sub/Function ([arglist]) [As type]]");
78 else if(CmdValue==COM_BEEP) lstrcpy(MethodCheckInfo.msg,"Beep");
79 else if(CmdValue==COM_CHDIR) lstrcpy(MethodCheckInfo.msg,"ChDir directory$");
80 else if(CmdValue==COM_CIRCLE) lstrcpy(MethodCheckInfo.msg,"Circle (x, y), radius, [color], [start], [end], [aspect], [f], [brushcolor]");
81 else if(CmdValue==COM_CLOSE) lstrcpy(MethodCheckInfo.msg,"Close [filenumber]");
82 else if(CmdValue==COM_CLASS) lstrcpy(MethodCheckInfo.msg,"Class name");
83 else if(CmdValue==COM_CLS) lstrcpy(MethodCheckInfo.msg,"Cls [number]");
84 else if(CmdValue==COM_COLOR) lstrcpy(MethodCheckInfo.msg,"Color color, [backcolor]");
85 else if(CmdValue==COM_CONST) lstrcpy(MethodCheckInfo.msg,"Const constname = expression");
86 else if(CmdValue==COM_DEBUG) lstrcpy(MethodCheckInfo.msg,"Debug");
87 else if(CmdValue==COM_DECLARE) lstrcpy(MethodCheckInfo.msg,"Declare Sub/Function name Lib \"libname\" [Alias \"aliasname\"] ([arglist]) [As type]]");
88 else if(CmdValue==COM_DEF) lstrcpy(MethodCheckInfo.msg,"Def func([parms] [,parms2])=expression");
89 else if(CmdValue==COM_DIM) lstrcpy(MethodCheckInfo.msg,"Dim variable [(subscripts)] As type, ...");
90 else if(CmdValue==COM_END) lstrcpy(MethodCheckInfo.msg,"End [type]");
91 else if(CmdValue==COM_ENUM) lstrcpy(MethodCheckInfo.msg,"Enum name");
92 else if(CmdValue==COM_FIELD) lstrcpy(MethodCheckInfo.msg,"Field #filenumber, fieldbyte");
93 else if(CmdValue==COM_FOR) lstrcpy(MethodCheckInfo.msg,"For variable=start To end [Step step]");
94 else if(CmdValue==COM_FUNCTION) lstrcpy(MethodCheckInfo.msg,"Function name ([arglist]) [As type]");
95 else if(CmdValue==COM_GET) lstrcpy(MethodCheckInfo.msg,"Get #filenumber, recode, StrBuffer");
96 else if(CmdValue==COM_GOSUB) lstrcpy(MethodCheckInfo.msg,"GoSub label");
97 else if(CmdValue==COM_GOTO) lstrcpy(MethodCheckInfo.msg,"Goto label");
98 else if(CmdValue==COM_IF) lstrcpy(MethodCheckInfo.msg,"If judgment Then truecommand [Else falsecommand]");
99 else if(CmdValue==COM_INHERITS) lstrcpy(MethodCheckInfo.msg,"Inherits BaseClass");
100 else if(CmdValue==COM_INPUT) lstrcpy(MethodCheckInfo.msg,"Input [# filenumber, ] variable, [...]");
101 else if(CmdValue==COM_INTERFACE) lstrcpy(MethodCheckInfo.msg,"Interface name");
102 else if(CmdValue==COM_KILL) lstrcpy(MethodCheckInfo.msg,"Kill filename$");
103 else if(CmdValue==COM_LET) lstrcpy(MethodCheckInfo.msg,"[Let] variable = expression");
104 else if(CmdValue==COM_LINE) lstrcpy(MethodCheckInfo.msg,"Line [(sx, sy)] -[Step] (ex, ey), [color], [B/Bf], [color2]");
105 else if(CmdValue==COM_LOCATE) lstrcpy(MethodCheckInfo.msg,"Locate x, y");
106 else if(CmdValue==COM_LOOP) lstrcpy(MethodCheckInfo.msg,"Loop while/until judgment");
107 else if(CmdValue==COM_MKDIR) lstrcpy(MethodCheckInfo.msg,"MkDir directory$");
108 else if(CmdValue==COM_MSGBOX) lstrcpy(MethodCheckInfo.msg,"MsgBox hWnd, String$, [Title$], [BoxType], [retAns]");
109 else if(CmdValue==COM_NAMESPACE) lstrcpy(MethodCheckInfo.msg,"Namespace namespaceStr");
110 else if(CmdValue==COM_NEXT) lstrcpy(MethodCheckInfo.msg,"Next");
111 else if(CmdValue==COM_OPEN) lstrcpy(MethodCheckInfo.msg,"Open filename$ [For Input/Output/Append] As number");
112 else if(CmdValue==COM_PAINT) lstrcpy(MethodCheckInfo.msg,"Paint (x, y), brushcolor, [linecolor]");
113 else if(CmdValue==COM_PRINT) lstrcpy(MethodCheckInfo.msg,"Print outdata, [...]");
114 else if(CmdValue==COM_PRIVATE) lstrcpy(MethodCheckInfo.msg,"Private");
115 else if(CmdValue==COM_PROTECTED) lstrcpy(MethodCheckInfo.msg,"Protected");
116 else if(CmdValue==COM_PSET) lstrcpy(MethodCheckInfo.msg,"PSet (x, y), [color]");
117 else if(CmdValue==COM_PUBLIC) lstrcpy(MethodCheckInfo.msg,"Public");
118 else if(CmdValue==COM_PUT) lstrcpy(MethodCheckInfo.msg,"Put #filenumber, recode, StrBuffer");
119 else if(CmdValue==COM_RANDOMIZE) lstrcpy(MethodCheckInfo.msg,"Randomize [number]");
120 else if(CmdValue==COM_REM) lstrcpy(MethodCheckInfo.msg,"Rem [comment]");
121 else if(CmdValue==COM_RETURN) lstrcpy(MethodCheckInfo.msg,"Return");
122 else if(CmdValue==COM_SELECT) lstrcpy(MethodCheckInfo.msg,"Select Case testexpression");
123 else if(CmdValue==COM_SUB) lstrcpy(MethodCheckInfo.msg,"Sub name ([arglist])");
124 else if(CmdValue==COM_TYPE) lstrcpy(MethodCheckInfo.msg,"Type name");
125 else if(CmdValue==COM_TYPEDEF) lstrcpy(MethodCheckInfo.msg,"TypeDef newtype = basetype");
126 else if(CmdValue==COM_VIRTUAL) lstrcpy(MethodCheckInfo.msg,"Virtual Sub/Function ([arglist]) [As type]]");
127 else if(CmdValue==COM_OVERRIDE) lstrcpy(MethodCheckInfo.msg,"Override Sub/Function ([arglist]) [As type]]");
128 else if(CmdValue==COM_WEND) lstrcpy(MethodCheckInfo.msg,"Wend");
129 else if(CmdValue==COM_WHILE) lstrcpy(MethodCheckInfo.msg,"While judgment");
130 else if(CmdValue==COM_WINDOW) lstrcpy(MethodCheckInfo.msg,"Window hWnd, OwnerWnd, x, y, width, height, title$, style, [class$], [ID], [callbackfunction], [ExStyle]");
131 else if(CmdValue==COM_WITH) lstrcpy(MethodCheckInfo.msg,"With object");
132 else if(CmdValue==COM_WRITE) lstrcpy(MethodCheckInfo.msg,"Write [data, ...]");
133 else return 0;
134 return 1;
135}
136
137void ChangeReturnCode(char *buffer){
138 //改行コードのCRLFをLFに変換
139 int i,i2;
140 for(i=0,i2=0;;i++,i2++){
141 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i++;
142 buffer[i2]=buffer[i];
143 if(buffer[i]=='\0') break;
144 }
145}
146void DeleteComment(char *buffer){ //注釈「'」の取り除き
147 int i,i2,i3,IsStr;
148 char *temporary;
149 temporary=(char *)GlobalAlloc(GMEM_FIXED,lstrlen(buffer)+1);
150 for(i=0,i2=0,i3=0,IsStr=0;;i++,i2++){
151 if(buffer[i]=='\"') IsStr^=1;
152 if(buffer[i]=='\n'||buffer[i]=='\0'){
153 i2--;
154 while(temporary[i2]==' '||temporary[i2]=='\t') i2--;
155 i2++;
156
157 if(i3){
158 //複数行に渡る注釈文の中に改行が存在するとき
159 memset(temporary+i2,'\n',i3);
160 i2+=i3;
161 i3=0;
162 }
163 }
164 if(buffer[i]=='\''&&IsStr==0){
165 //注釈文
166 i2--;
167 while(temporary[i2]==' '||temporary[i2]=='\t') i2--;
168 i2++;
169 while(buffer[i]!='\n'&&buffer[i]!='\0') i++;
170 }
171 if(buffer[i]=='/'&&buffer[i+1]=='*'&&IsStr==0){
172 //注釈文(複数行)
173 i+=2;
174 i3=0;
175 while(!(buffer[i]=='*'&&buffer[i+1]=='/')){
176 if(buffer[i]=='\n') i3++;
177 if(buffer[i]=='\0') break;
178 i++;
179 }
180 if(buffer[i]){
181 i+=2;
182 }
183 i--;
184 i2--;
185 continue;
186 }
187 temporary[i2]=buffer[i];
188 if(buffer[i]=='\0') break;
189 }
190 lstrcpy(buffer,temporary);
191 GlobalFree(temporary);
192}
193
194BOOL GetDefualtFunctionParameter(char *pBuf,char *FuncName,char *Parameter){
195 int i,i2;
196 char temporary[VN_SIZE];
197
198 /////////////////////////////////////////
199 // ソースコードから関数定義位置を取得
200 /////////////////////////////////////////
201
202 for(i=0;;i++){
203 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
204
205 if(memicmp(pBuf+i,"Class",5)==0&&(pBuf[i+5]==' '||pBuf[i+5]=='\t')||
206 memicmp(pBuf+i,"Interface",9)==0&&(pBuf[i+9]==' '||pBuf[i+9]=='\t')||
207 memicmp(pBuf+i,"Type",4)==0&&(pBuf[i+4]==' '||pBuf[i+4]=='\t')){
208 /* Class ~ End Class
209 Interface ~ End Interface
210 Type ~ End Type
211 は飛び越す */
212
213 while(1){
214 if(pBuf[i]=='\0'){
215 i2=0;
216 break;
217 }
218
219 if(memicmp(pBuf+i,"End",3)==0){
220 /* End Class
221 End Interface
222 End Type
223 の検出 */
224 i+=3;
225 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
226
227 if(memicmp(pBuf+i,"Class",5)==0&&(!IsVariableChar(pBuf[i+5]))||
228 memicmp(pBuf+i,"Interface",9)==0&&(!IsVariableChar(pBuf[i+9]))||
229 memicmp(pBuf+i,"Type",4)==0&&(!IsVariableChar(pBuf[i+4]))){
230 i2=0;
231 break;
232 }
233 }
234
235 //次の行をサーチ
236 for(;;i++){
237 if(pBuf[i]=='\0') break;
238 i2=IsCommandDelimitation(pBuf,i);
239 if(i2){
240 i+=i2;
241 break;
242 }
243 }
244 JumpBlank(pBuf,&i);
245 }
246 }
247
248 if(memicmp(pBuf+i,"Declare",7)==0&&(pBuf[i+7]==' '||pBuf[i+7]=='\t')){
249 i+=8;
250 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
251
252 if(memicmp(pBuf+i,"Function",8)==0&&(pBuf[i+8]==' '||pBuf[i+8]=='\t')) i+=9;
253 else if(memicmp(pBuf+i,"Sub",3)==0&&(pBuf[i+3]==' '||pBuf[i+3]=='\t')) i+=4;
254 else goto NextCommand;
255
256 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
257
258 for(i2=0;;i++,i2++){
259 if(!IsVariableChar(pBuf[i])){
260 temporary[i2]=0;
261 break;
262 }
263 temporary[i2]=pBuf[i];
264 }
265 if(lstrcmp(temporary,FuncName)==0){
266 //関数名が一致したとき
267 break;
268 }
269 }
270 if(memicmp(pBuf+i,"Function",8)==0&&(pBuf[i+8]==' '||pBuf[i+8]=='\t')||
271 memicmp(pBuf+i,"Sub",3)==0&&(pBuf[i+3]==' '||pBuf[i+3]=='\t')){
272 if(pBuf[i]=='f'||pBuf[i]=='F') i+=9;
273 else i+=4;
274
275 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
276 for(i2=0;;i++,i2++){
277 if(!IsVariableChar(pBuf[i])){
278 temporary[i2]=0;
279 break;
280 }
281 temporary[i2]=pBuf[i];
282 }
283 if(lstrcmpi(temporary,"Export")==0){
284 //"Export"を飛び越す
285 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
286 for(i2=0;;i++,i2++){
287 if(!IsVariableChar(pBuf[i])){
288 temporary[i2]=0;
289 break;
290 }
291 temporary[i2]=pBuf[i];
292 }
293 }
294 if(lstrcmp(temporary,FuncName)==0){
295 //関数名が一致したとき
296 break;
297 }
298
299 }
300
301NextCommand:
302 for(;;i++){
303 i2=IsCommandDelimitation(pBuf,i);
304 if(i2){
305 if(i2==2) i++;
306 break;
307 }
308 }
309
310 if(pBuf[i]=='\0') return 0;
311 }
312
313 for(;;i++){
314 if(pBuf[i]=='(') break;
315 if(IsCommandDelimitation(pBuf,i)) return 0;
316 }
317
318 //関数名をコピー
319 lstrcpy(Parameter,FuncName);
320 i2=lstrlen(Parameter);
321
322
323 //////////////////////////////////////////////////////
324 //パラメータをコピー
325 //(コメントの挿入、途中改行などの状況を考慮する)
326 //////////////////////////////////////////////////////
327
328 for(;;i++,i2++){
329 if(IsVariableChar(pBuf[i-1])==0&&pBuf[i-1]!=')'&&IS_BLANK(pBuf[i])||
330 pBuf[i]=='\''||
331 pBuf[i]=='/'&&pBuf[i+1]=='*')
332 JumpBlank(pBuf,&i);
333
334 if(IsCommandDelimitation(pBuf,i)){
335 if(IS_RETURN(pBuf,i)&&
336 pBuf[i-1]=='_'||pBuf[i-1]=='('||pBuf[i-1]==','){
337 //改行を許可
338 i2--;
339 if(Parameter[i2]=='_') i2--;
340
341 i+=2;
342 continue;
343 }
344
345 Parameter[i2]=0;
346 break;
347 }
348 Parameter[i2]=pBuf[i];
349 }
350
351
352 //文法チェック
353 if(!CheckGrammar(Parameter)) return 0;
354
355
356 return 1;
357}
358BOOL GetClassMemberFunctionParameter(char *pBuf,char *ClassName,char *nest,char *Parameter){
359 extern HANDLE hHeap;
360 extern char *pHeaderBuf;
361 extern char *pUserSource;
362 int i,i2;
363 char temporary[8192];
364 DWORD dwClassType;
365 BOOL bRet;
366
367
368 /////////////////////////////////////////
369 // ソースコードからクラス定義位置を取得
370 /////////////////////////////////////////
371 i=GetClassPos(pBuf,ClassName,&dwClassType);
372 if(pBuf[i]=='\0') return 0;
373
374 //クラス、配列の構成要素を解析する
375 char VarName[VN_SIZE]; //変数名
376 char array[VN_SIZE]; //第1次配列
377 char lpPtrOffset[VN_SIZE]; //第2次配列
378 char NestMember[VN_SIZE]; //入れ子メンバ
379 int RefType; //"."参照のときは0、"->"参照のときは1
380 lstrcpy(VarName,nest);
381 if(!GetVarFormatString(VarName,array,lpPtrOffset,NestMember,&RefType)) return 0;
382
383 if(RefType){
384 ////////////////////
385 // 入れ子構造の場合
386 ////////////////////
387
388 //メンバ変数の型であるクラスの名前を取得
389 char ClassName[VN_SIZE];
390 BOOL bArray;
391 if(!GetClassNameFromClassMember(pBuf,i,VarName,ClassName,&bArray)) return 0;
392
393 //TypeDef宣言を考慮してオリジナルなクラス名を取得
394 GetOriginalClassName(ClassName);
395
396 if(!CheckReferType(ClassName,bArray,array,RefType)) return 0;
397
398 //ユーザーのソースコードをサーチ
399 bRet=GetClassMemberFunctionParameter(pUserSource,ClassName,NestMember,Parameter);
400 if(!bRet){
401 //失敗したときはbasic.sbpをサーチ
402 bRet=GetClassMemberFunctionParameter(pHeaderBuf,ClassName,NestMember,Parameter);
403 }
404 return bRet;
405 }
406
407
408 ////////////////////////
409 // メンバ情報を取得
410 ////////////////////////
411 DWORD dwProc;
412
413 if(memicmp(pBuf+i,"Inherits",8)==0&&(pBuf[i+8]==' '||pBuf[i+8]=='\t')){
414 i+=9;
415 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
416
417 ////////////////////////
418 // 継承先クラスをサーチ
419 ////////////////////////
420
421 for(i2=0;;i++,i2++){
422 if(!IsVariableChar(pBuf[i])){
423 temporary[i2]=0;
424 break;
425 }
426 temporary[i2]=pBuf[i];
427 }
428
429 //ユーザーのソースコードをサーチ
430 bRet=GetClassMemberFunctionParameter(pUserSource,temporary,nest,Parameter);
431 if(!bRet){
432 //失敗したときはbasic.sbpをサーチ
433 bRet=GetClassMemberFunctionParameter(pHeaderBuf,temporary,nest,Parameter);
434 }
435 if(bRet) return 1;
436 }
437
438 //メンバ変数、関数を取得
439 while(1){
440 if(pBuf[i]=='\0') break;
441 if(memicmp(pBuf+i,"End",3)==0){
442 /* End Class
443 End Interface
444 End Type
445 の検出 */
446 i2=i+3;
447 while(pBuf[i2]==' '||pBuf[i2]=='\t') i2++;
448
449 if(memicmp(pBuf+i2,"Class",5)==0&&(!IsVariableChar(pBuf[i2+5]))||
450 memicmp(pBuf+i2,"Interface",9)==0&&(!IsVariableChar(pBuf[i2+9]))||
451 memicmp(pBuf+i2,"Type",4)==0&&(!IsVariableChar(pBuf[i2+4]))) break;
452 }
453
454 if(memicmp(pBuf+i,"Abstract",8)==0&&(pBuf[i+8]==' '||pBuf[i+8]=='\t')||
455 memicmp(pBuf+i,"Virtual",7)==0&&(pBuf[i+7]==' '||pBuf[i+7]=='\t')||
456 memicmp(pBuf+i,"Override",8)==0&&(pBuf[i+8]==' '||pBuf[i+8]=='\t')||
457 memicmp(pBuf+i,"Function",8)==0&&(pBuf[i+8]==' '||pBuf[i+8]=='\t')||
458 memicmp(pBuf+i,"Sub",3)==0&&(pBuf[i+3]==' '||pBuf[i+3]=='\t')){
459 //メンバ関数のとき
460 if(pBuf[i]=='a'||pBuf[i]=='A'){
461 i+=9;
462 dwProc=ESC_ABSTRACT;
463
464 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
465 if(memicmp(pBuf+i,"Function",8)==0&&(pBuf[i+8]==' '||pBuf[i+8]=='\t')) i+=9;
466 else if(memicmp(pBuf+i,"Sub",3)==0&&(pBuf[i+3]==' '||pBuf[i+3]=='\t')) i+=4;
467 }
468 else if(pBuf[i]=='v'||pBuf[i]=='V'){
469 i+=8;
470
471 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
472 if(memicmp(pBuf+i,"Function",8)==0&&(pBuf[i+8]==' '||pBuf[i+8]=='\t')){
473 i+=9;
474 dwProc=ESC_FUNCTION;
475 }
476 else if(memicmp(pBuf+i,"Sub",3)==0&&(pBuf[i+3]==' '||pBuf[i+3]=='\t')){
477 i+=4;
478 dwProc=ESC_SUB;
479 }
480 }
481 else if(pBuf[i]=='o'||pBuf[i]=='O'){
482 i+=9;
483
484 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
485 if(memicmp(pBuf+i,"Function",8)==0&&(pBuf[i+8]==' '||pBuf[i+8]=='\t')){
486 i+=9;
487 dwProc=ESC_FUNCTION;
488 }
489 else if(memicmp(pBuf+i,"Sub",3)==0&&(pBuf[i+3]==' '||pBuf[i+3]=='\t')){
490 i+=4;
491 dwProc=ESC_SUB;
492 }
493 }
494 else if(pBuf[i]=='f'||pBuf[i]=='F'){
495 i+=9;
496 dwProc=ESC_FUNCTION;
497 }
498 else if(pBuf[i]=='s'||pBuf[i]=='S'){
499 i+=4;
500 dwProc=ESC_SUB;
501 }
502
503 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
504 }
505 else{
506 //メンバ変数のとき
507 dwProc=0;
508 }
509
510 if(dwProc){
511 //変数名または関数名を取得
512 for(i2=0;;i++,i2++){
513 if(!IsVariableChar(pBuf[i])){
514 temporary[i2]=0;
515 break;
516 }
517 temporary[i2]=pBuf[i];
518 }
519
520 if(lstrcmp(temporary,nest)==0){
521 //ターゲットとなるメンバ関数が見つかったとき
522 for(;;i++){
523 if(pBuf[i]=='(') break;
524 if(IsCommandDelimitation(pBuf,i)) return 0;
525 }
526
527 lstrcpy(Parameter,nest);
528 i2=lstrlen(Parameter);
529 for(;;i++,i2++){
530 if(IsCommandDelimitation(pBuf,i)){
531 Parameter[i2]=0;
532 break;
533 }
534 Parameter[i2]=pBuf[i];
535 }
536
537 if(!CheckGrammar(Parameter)) return 0;
538
539 return 1;
540 }
541 }
542
543 //次の行をサーチ
544 for(;;i++){
545 if(pBuf[i]=='\0') break;
546 i2=IsCommandDelimitation(pBuf,i);
547 if(i2){
548 i+=i2;
549 break;
550 }
551 }
552 JumpBlank(pBuf,&i);
553
554 if((dwProc==ESC_SUB||dwProc==ESC_FUNCTION)&&dwClassType!=ESC_INTERFACE){
555 //End Sub、End Functionまでジャンプする
556
557 while(1){
558 if(pBuf[i]=='\0'){
559 i2=0;
560 break;
561 }
562
563 if(memicmp(pBuf+i,"End",3)==0){
564 /* End Sub
565 End Function
566 の検出 */
567 i+=3;
568 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
569
570 if(memicmp(pBuf+i,"Sub",3)==0&&(!IsVariableChar(pBuf[i+3]))||
571 memicmp(pBuf+i,"Function",8)==0&&(!IsVariableChar(pBuf[i+8]))){
572 i2=1;
573 break;
574 }
575
576 if(memicmp(pBuf+i,"Class",5)==0&&(!IsVariableChar(pBuf[i+5]))||
577 memicmp(pBuf+i,"Interface",9)==0&&(!IsVariableChar(pBuf[i+9]))||
578 memicmp(pBuf+i,"Type",4)==0&&(!IsVariableChar(pBuf[i+4]))){
579 i2=0;
580 break;
581 }
582 }
583
584 //次の行をサーチ
585 for(;;i++){
586 if(pBuf[i]=='\0') break;
587 i2=IsCommandDelimitation(pBuf,i);
588 if(i2){
589 i+=i2;
590 break;
591 }
592 }
593 JumpBlank(pBuf,&i);
594 }
595
596 if(i2==0){
597 //コード解析が不正に終了
598 return 1;
599 }
600
601 //次の行をサーチ
602 for(;;i++){
603 if(pBuf[i]=='\0') break;
604 i2=IsCommandDelimitation(pBuf,i);
605 if(i2){
606 i+=i2;
607 break;
608 }
609 }
610 JumpBlank(pBuf,&i);
611 }
612 }
613
614 return 0;
615}
616BOOL GetParameterString(char *pEditBuf,int iPos,char *FuncName,char *Parameter){
617 extern char *pHeaderBuf;
618 extern char *pUserSource;
619 BOOL bRet;
620
621 //ユーザーソースコードを取得
622 if(pUserSource==0)
623 pUserSource=GetUserSourceCode();
624
625
626 //クラス、配列の構成要素を解析する
627 char VarName[VN_SIZE]; //変数名
628 char array[VN_SIZE]; //第1次配列
629 char lpPtrOffset[VN_SIZE]; //第2次配列
630 char NestMember[VN_SIZE]; //入れ子メンバ
631 int RefType; //"."参照のときは0、"->"参照のときは1
632 lstrcpy(VarName,FuncName);
633 if(!GetVarFormatString(VarName,array,lpPtrOffset,NestMember,&RefType)) return 0;
634
635 if(RefType==0){
636 // キャレット位置のコード領域を判定(クラス/ローカル/グローバル)
637 int iProcPos;
638 char NowClass[VN_SIZE];
639 GetCodeAreaType(pEditBuf,iPos,&iProcPos,NowClass);
640
641 if(NowClass[0]&&iProcPos!=-1){
642 //クラスメンバ関数領域
643 bRet=GetClassMemberFunctionParameter(pUserSource,NowClass,FuncName,Parameter);
644 if(!bRet){
645 bRet=GetClassMemberFunctionParameter(pHeaderBuf,NowClass,FuncName,Parameter);
646 }
647
648 if(bRet) return 1;
649 }
650
651 //通常関数
652 bRet=GetDefualtFunctionParameter(pUserSource,FuncName,Parameter);
653 if(!bRet){
654 bRet=GetDefualtFunctionParameter(pHeaderBuf,FuncName,Parameter);
655 }
656 }
657 else{
658 //メンバ関数
659 char ClassName[VN_SIZE];
660 BOOL bArray;
661
662 //オブジェクトのクラス名を取得
663 if(!GetVariableClassName(pEditBuf,iPos,VarName,ClassName,&bArray)) return 0;
664
665 //TypeDef宣言を考慮してオリジナルなクラス名を取得
666 GetOriginalClassName(ClassName);
667
668 if(!CheckReferType(ClassName,bArray,array,RefType)) return 0;
669
670 bRet=GetClassMemberFunctionParameter(pUserSource,ClassName,NestMember,Parameter);
671 if(!bRet){
672 bRet=GetClassMemberFunctionParameter(pHeaderBuf,ClassName,NestMember,Parameter);
673 }
674 }
675
676 DeleteComment(Parameter);
677
678 return bRet;
679}
680
681void ShowParameterHint(int WndNum){
682 extern HANDLE hHeap;
683 extern MDIINFO MdiInfo[MAX_WNDNUM];
684 extern METHODCHECKINFO MethodCheckInfo;
685 int i,i2,i3,IsStr,IsComment,PareNum,iPos;
686 char *pBuf;
687 char temp2[8192];
688
689 pBuf=MdiInfo[WndNum].pMdiTextEdit->buffer;
690
691 //キャレットが示すバッファインデックスを取得
692 iPos=GetBufferIndexFromCaretPos(
693 pBuf,
694 MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x,
695 MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y);
696
697 static int Before_StartCaretY;
698 BOOL Before_StartCaretSwitch=0;
699 if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y!=Before_StartCaretY){
700 Before_StartCaretY=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y;
701 Before_StartCaretSwitch=1;
702 }
703
704 if(!MethodCheckInfo.hWnd){
705 ////////////////////////////////////////////////
706 // 新規の場合は選択されている行の先頭位置を取得
707 ////////////////////////////////////////////////
708
709 for(i=iPos;i>0;i--){
710 if(pBuf[i-1]=='\r'&&pBuf[i]=='\n'){
711 i++;
712 break;
713 }
714 }
715 MethodCheckInfo.HeadPos=i;
716
717 //注釈中かどうかを判定
718 for(i2=0,IsStr=0,IsComment=0;i2<MethodCheckInfo.HeadPos;i2++){
719 if(pBuf[i2]=='\"'){
720 i3=i2;
721 IsStr^=1;
722 }
723
724 //注釈(複数行)
725 if(pBuf[i2]=='/'&&pBuf[i2+1]=='*'&&IsStr==0&&IsComment==0){
726 i2+=2;
727 while(!(pBuf[i2]=='*'&&pBuf[i2+1]=='/')){
728 if(pBuf[i2]=='\0'){
729 i2--;
730 break;
731 }
732 i2++;
733 if(i2>=MethodCheckInfo.HeadPos) break;
734 }
735 if(i2>=MethodCheckInfo.HeadPos){
736 IsComment=1;
737 break;
738 }
739 continue;
740 }
741
742 //注釈(単行)
743 if(pBuf[i2]=='\''&&IsStr==0){
744 while(!(pBuf[i2]=='\r'&&pBuf[i2+1]=='\n')){
745 if(pBuf[i2]=='\0'){
746 i2--;
747 break;
748 }
749 i2++;
750 if(i2>=MethodCheckInfo.HeadPos) break;
751 }
752 if(i2>=MethodCheckInfo.HeadPos){
753 IsComment=1;
754 break;
755 }
756 continue;
757 }
758
759 if(pBuf[i2]=='\r'&&pBuf[i2+1]=='\n'){
760 IsComment=0;
761 IsStr=0;
762 }
763 }
764
765 if(IsComment){
766 //注釈文の位置のときは抜け出す
767 return;
768 }
769 }
770 else{
771 /*既存のパラメータヒントが存在し、
772 以前の先頭位置よりも手前にカーソルが移動されたときは破棄する*/
773 if(iPos<=MethodCheckInfo.HeadPos){
774 DestroyWindow(MethodCheckInfo.hWnd);
775 MethodCheckInfo.hWnd=0;
776 }
777 }
778
779
780 ////////////////////////////////////////
781 // ダブルクォートの中かどうかを判別する
782 ////////////////////////////////////////
783
784 IsStr=0;
785 IsComment=0;
786 PareNum=0;
787 for(i2=MethodCheckInfo.HeadPos;i2<iPos;i2++){
788 if(pBuf[i2]=='\"'){
789 i3=i2;
790 IsStr^=1;
791 }
792
793 if(pBuf[i2]=='('&&IsStr==0&&IsComment==0) PareNum++;
794 if(pBuf[i2]==')'&&IsStr==0&&IsComment==0) PareNum--;
795
796 //注釈(複数行)
797 if(pBuf[i2]=='/'&&pBuf[i2+1]=='*'&&IsStr==0&&IsComment==0){
798 i2+=2;
799 while(!(pBuf[i2]=='*'&&pBuf[i2+1]=='/')){
800 if(pBuf[i2]=='\0'){
801 i2--;
802 break;
803 }
804 i2++;
805 if(i2>=iPos) break;
806 }
807 if(i2>=iPos){
808 IsComment=1;
809 break;
810 }
811 continue;
812 }
813
814 //注釈(単行)
815 if(pBuf[i2]=='\''&&IsStr==0){
816 while(!(pBuf[i2]=='\r'&&pBuf[i2+1]=='\n')){
817 if(pBuf[i2]=='\0'){
818 i2--;
819 break;
820 }
821 i2++;
822 if(i2>=iPos) break;
823 }
824 if(i2>=iPos){
825 IsComment=1;
826 break;
827 }
828 continue;
829 }
830
831 if(pBuf[i2]=='\r'&&pBuf[i2+1]=='\n'){
832 if(PareNum==0){
833 //複数行にパラメータ記述がなされないとき
834 DestroyWindow(MethodCheckInfo.hWnd);
835 MethodCheckInfo.hWnd=0;
836 return;
837 }
838 IsComment=0;
839 IsStr=0;
840 }
841
842 }
843 if(IsStr){
844 if(!MethodCheckInfo.hWnd){
845 return;
846 }
847 i=i3-1;
848 }
849 else i=iPos-1;
850
851
852 for(PareNum=0;i>=MethodCheckInfo.HeadPos;i--){
853 if(pBuf[i]=='\"'){
854 i--;
855 while(pBuf[i]!='\"'){
856 i--;
857 if(i<MethodCheckInfo.HeadPos) break;
858 }
859 if(i<MethodCheckInfo.HeadPos) break;
860 continue;
861 }
862
863 //文の第一パラメータ時に表示する(すでに表示されている場合は無関係)
864 if((!MethodCheckInfo.hWnd)&&pBuf[i]==',') break;
865
866 if(pBuf[i]==')') PareNum--;
867 if(pBuf[i]=='('){
868 PareNum++;
869 if(PareNum>0){
870 i3=i+1;
871 i--;
872 while(pBuf[i]==' '||pBuf[i]=='\t') i--;
873 for(i2=0;i>=0;i--,i2++){
874 if(!IsVariableChar(pBuf[i])){
875 if(pBuf[i-1]=='-'&&pBuf[i]=='>'){
876 // "->" を含ませる
877 i--;
878 i2++;
879 continue;
880 }
881 break;
882 }
883 }
884 i++;
885 memcpy(temp2,pBuf+i,i2);
886 temp2[i2]=0;
887 if(i3<=iPos){
888 for(i2=0,IsStr=0,PareNum=0;i3<iPos;i3++){
889 if(pBuf[i3]=='\"') IsStr^=1;
890 if(pBuf[i3]=='('&&IsStr==0) PareNum++;
891 if(pBuf[i3]==')'&&IsStr==0){
892 PareNum--;
893 if(PareNum<0) break;
894 }
895 if(pBuf[i3]==','&&IsStr==0&&PareNum==0) i2++;
896 }
897 if(PareNum<0) i2=0x7FFFFFFF;
898 }
899 else i2=0x7FFFFFFF;
900
901 if(temp2[0]==0){
902 PareNum=0;
903 iPos=i;
904 continue;
905 }
906
907 if(lstrcmp(MethodCheckInfo.BeforeMethodName,temp2)!=0){
908 //新規の場合はパラメータ文字列を取得
909 if(!GetParameterString(pBuf,iPos,temp2,MethodCheckInfo.msg)){
910 PareNum=0;
911 iPos=i;
912 continue;
913 }
914 }
915 else if(MethodCheckInfo.ParmNum==i2&&Before_StartCaretSwitch==0){
916 //表示中のパラメータヒントに変更がないとき
917 //※行移動が行われた場合を除く
918 break;
919 }
920
921 //第何パラメータを太字にするかを示す
922 MethodCheckInfo.ParmNum=i2;
923
924 //パラメータヒントを表示
925 ShowCommandMessage();
926
927 lstrcpy(MethodCheckInfo.BeforeMethodName,temp2);
928 break;
929 }
930 }
931 if(i==MethodCheckInfo.HeadPos){
932
933 //行番号を飛び越す
934 while(pBuf[i]>='0'&&pBuf[i]<='9') i++;
935
936 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
937 for(i2=0;;i++,i2++){
938 if(!IsVariableChar(pBuf[i])){
939 temp2[i2]=0;
940 break;
941 }
942 temp2[i2]=pBuf[i];
943 }
944 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
945 if(pBuf[i]=='(') i++;
946 if(i<=iPos){
947 for(i2=0,IsStr=0,PareNum=0;i<iPos;i++){
948 if(pBuf[i]=='\"') IsStr^=1;
949 if(pBuf[i]=='('&&IsStr==0) PareNum++;
950 if(pBuf[i]==')'&&IsStr==0){
951 PareNum--;
952 if(PareNum<0) break;
953 }
954 if(pBuf[i]==','&&IsStr==0&&PareNum==0) i2++;
955 }
956 if(PareNum<0) temp2[0]=0;
957 }
958 else i2=0x7FFFFFFF;
959 if(SetCommandMessageToMethodCheck(temp2)){
960 //第何パラメータを太字にするかを示す
961 MethodCheckInfo.ParmNum=i2;
962
963 //パラメータヒントを表示
964 ShowCommandMessage();
965
966 lstrcpy(MethodCheckInfo.BeforeMethodName,temp2);
967 }
968 else{
969 if(MethodCheckInfo.hWnd){
970 UpdateWindow(MdiInfo[WndNum].pMdiTextEdit->hEdit); //ちらつき防止
971
972 DestroyWindow(MethodCheckInfo.hWnd);
973 MethodCheckInfo.hWnd=0;
974 }
975 }
976 break;
977 }
978 }
979
980 extern char *pUserSource;
981 if(pUserSource){
982 HeapDefaultFree(pUserSource);
983 pUserSource=0;
984 }
985}
986
987
988//////////////////////////////////////
989// パラメータヒントのインターフェイス
990//////////////////////////////////////
991
992int DrawParam_StartScreenPosX;
993int DrawParam_PosY;
994int DrawParam_TextHeight;
995int DrawParam_MaxX;
996void TextOut_ToParmHint(HDC hdc,HFONT hFont,char *buffer,SIZE *pSize){
997 int i,i2;
998 HFONT hOldFont;
999
1000 i=lstrlen(buffer);
1001 hOldFont=(HFONT)SelectObject(hdc,hFont);
1002
1003 i2=pSize->cx;
1004 GetTextExtentPoint32(hdc,buffer,i,pSize);
1005 if(DrawParam_StartScreenPosX+i2+pSize->cx >= ScreenX){
1006 DrawParam_PosY+=DrawParam_TextHeight;
1007 i2=10;
1008 }
1009 TextOut(hdc,i2,DrawParam_PosY,buffer,i);
1010 pSize->cx+=i2;
1011
1012 if(DrawParam_MaxX<pSize->cx) DrawParam_MaxX=pSize->cx;
1013
1014 SelectObject(hdc,hOldFont);
1015}
1016void DrawParameterHint(HDC hdc,SIZE *pSize){
1017 extern METHODCHECKINFO MethodCheckInfo;
1018 int i,i2,i3,counter;
1019 char temporary[8192];
1020 HFONT hOldFont;
1021
1022 SetBkMode(hdc,TRANSPARENT);
1023
1024 DrawParam_PosY=2;
1025
1026 //命令語、関数の識別名
1027 for(i=0;;i++){
1028 temporary[i]=MethodCheckInfo.msg[i];
1029 if(MethodCheckInfo.msg[i]=='\0') break;
1030 if(MethodCheckInfo.msg[i]==' '||MethodCheckInfo.msg[i]=='('){
1031 i++;
1032 temporary[i]=0;
1033 break;
1034 }
1035 }
1036 hOldFont=(HFONT)SelectObject(hdc,MethodCheckInfo.hFont);
1037 TextOut(hdc,2,2,temporary,lstrlen(temporary));
1038 GetTextExtentPoint32(hdc,temporary,lstrlen(temporary),pSize);
1039 SelectObject(hdc,hOldFont);
1040 pSize->cx+=2;
1041 DrawParam_TextHeight=pSize->cy;
1042
1043 DrawParam_MaxX=pSize->cx;
1044
1045 for(i2=0,counter=0;;i++,i2++){
1046 if(MethodCheckInfo.msg[i]=='('){
1047 i3=GetStringInPare(temporary+i2,MethodCheckInfo.msg+i);
1048 i+=i3-1;
1049 i2+=i3-1;
1050 }
1051 if(MethodCheckInfo.msg[i]==','||
1052 MethodCheckInfo.msg[i]==')'||
1053 MethodCheckInfo.msg[i]=='\0'){
1054 temporary[i2]=0;
1055 if(MethodCheckInfo.ParmNum==counter){
1056 //太字フォントパラメータ
1057 TextOut_ToParmHint(hdc,MethodCheckInfo.hBoldFont,temporary,pSize);
1058 }
1059 else{
1060 //通常フォントパラメータ
1061 TextOut_ToParmHint(hdc,MethodCheckInfo.hFont,temporary,pSize);
1062 }
1063 counter++;
1064
1065 if(MethodCheckInfo.msg[i]==','){
1066 temporary[0]=',';
1067 temporary[1]=' ';
1068 temporary[2]=0;
1069
1070 TextOut_ToParmHint(hdc,MethodCheckInfo.hFont,temporary,pSize);
1071
1072 i++;
1073 while(MethodCheckInfo.msg[i]==' '||MethodCheckInfo.msg[i]=='\t') i++;
1074 i--;
1075 }
1076 else if(MethodCheckInfo.msg[i]==')'){
1077 lstrcpy(temporary,MethodCheckInfo.msg+i);
1078
1079 TextOut_ToParmHint(hdc,MethodCheckInfo.hFont,temporary,pSize);
1080
1081 break;
1082 }
1083 else if(MethodCheckInfo.msg[i]=='\0') break;
1084
1085 i2=-1;
1086 continue;
1087 }
1088 temporary[i2]=MethodCheckInfo.msg[i];
1089 }
1090
1091 pSize->cx=DrawParam_MaxX+20;
1092 pSize->cy=DrawParam_PosY+DrawParam_TextHeight+2;
1093}
1094void ShowHelp_FromParamHint(void){
1095 extern METHODCHECKINFO MethodCheckInfo;
1096 int i;
1097 char temporary[MAX_PATH],temp2[255];
1098 HH_AKLINK ak;
1099
1100 for(i=0;;i++){
1101 if(MethodCheckInfo.msg[i]=='('||MethodCheckInfo.msg[i]==' '||
1102 MethodCheckInfo.msg[i]=='\0'){
1103 temp2[i]=0;
1104 break;
1105 }
1106 temp2[i]=MethodCheckInfo.msg[i];
1107 }
1108
1109 memset(&ak, 0, sizeof(HH_AKLINK));
1110 ak.cbStruct = sizeof(HH_AKLINK);
1111 ak.pszKeywords = temp2;
1112 ak.fIndexOnFail=1;
1113
1114 sprintf(temporary,"%sBasicHelp.chm",pj_editor_Dir);
1115 HtmlHelp(NULL,temporary,HH_KEYWORD_LOOKUP,(DWORD)&ak);
1116}
1117LRESULT CALLBACK MethodCheckWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
1118 extern METHODCHECKINFO MethodCheckInfo;
1119 HDC hdc;
1120 HPEN hOldPen;
1121 HBRUSH hBrush,hOldBrush;
1122 PAINTSTRUCT ps;
1123 SIZE size;
1124 RECT rect;
1125 POINT pos;
1126
1127 switch(message){
1128 case WM_CREATE:
1129 GetCaretPos(&pos);
1130 ClientToScreen(GetWindow(hClient,GW_CHILD),&pos);
1131 DrawParam_StartScreenPosX=pos.x;
1132
1133 SetTimer(hwnd,1,50,0);
1134 return 0;
1135 case WM_PAINT:
1136 hdc=BeginPaint(hwnd,&ps);
1137
1138 //枠を描画
1139 GetClientRect(hwnd,&rect);
1140 hBrush=CreateSolidBrush(RGB(255,255,180));
1141 hOldPen=(HPEN)SelectObject(hdc,GetStockObject(BLACK_PEN));
1142 hOldBrush=(HBRUSH)SelectObject(hdc,hBrush);
1143 Rectangle(hdc,0,0,rect.right,rect.bottom);
1144 SelectObject(hdc,hOldPen);
1145 SelectObject(hdc,hOldBrush);
1146 DeleteObject(hBrush);
1147
1148 //パラメータヒントを描画
1149 DrawParameterHint(hdc,&size);
1150
1151 //[?]マークを描画
1152 HBITMAP hBmp,hOldBmp;
1153 HDC memdc;
1154 hBmp=(HBITMAP)LoadImage(hResInst,MAKEINTRESOURCE(IDB_PARAMHINT_QUESTION),IMAGE_BITMAP,0,0,LR_DEFAULTSIZE);
1155 memdc=CreateCompatibleDC(hdc);
1156 hOldBmp=(HBITMAP)SelectObject(memdc,hBmp);
1157 GetClientRect(hwnd,&rect);
1158 BitBlt(hdc,rect.right-14,rect.bottom-14,13,13,memdc,0,0,SRCCOPY);
1159 SelectObject(memdc,hOldBmp);
1160 DeleteDC(memdc);
1161 DeleteObject(hBmp);
1162
1163 EndPaint(hwnd,&ps);
1164 return 0;
1165 case WM_TIMER:
1166 //[?]マークを描画
1167 static BOOL bOnMouse;
1168 GetClientRect(hwnd,&rect);
1169 GetCursorPos(&pos);
1170 ScreenToClient(hwnd,&pos);
1171 if(rect.right-14<=pos.x&&pos.x<=rect.right-1&&
1172 rect.bottom-14<=pos.y&&pos.y<=rect.bottom-1){
1173 if(bOnMouse) return 0;
1174
1175 hdc=GetDC(hwnd);
1176
1177 hBmp=(HBITMAP)LoadImage(hResInst,MAKEINTRESOURCE(IDB_PARAMHINT_QUESTION2),IMAGE_BITMAP,0,0,LR_DEFAULTSIZE);
1178 memdc=CreateCompatibleDC(hdc);
1179 hOldBmp=(HBITMAP)SelectObject(memdc,hBmp);
1180 GetClientRect(hwnd,&rect);
1181 BitBlt(hdc,rect.right-14,rect.bottom-14,13,13,memdc,0,0,SRCCOPY);
1182 SelectObject(memdc,hOldBmp);
1183 DeleteDC(memdc);
1184 DeleteObject(hBmp);
1185
1186 ReleaseDC(hwnd,hdc);
1187
1188 bOnMouse=1;
1189 }
1190 else{
1191 if(!bOnMouse) return 0;
1192
1193 hdc=GetDC(hwnd);
1194
1195 hBmp=(HBITMAP)LoadImage(hResInst,MAKEINTRESOURCE(IDB_PARAMHINT_QUESTION),IMAGE_BITMAP,0,0,LR_DEFAULTSIZE);
1196 memdc=CreateCompatibleDC(hdc);
1197 hOldBmp=(HBITMAP)SelectObject(memdc,hBmp);
1198 GetClientRect(hwnd,&rect);
1199 BitBlt(hdc,rect.right-14,rect.bottom-14,13,13,memdc,0,0,SRCCOPY);
1200 SelectObject(memdc,hOldBmp);
1201 DeleteDC(memdc);
1202 DeleteObject(hBmp);
1203
1204 ReleaseDC(hwnd,hdc);
1205 bOnMouse=0;
1206 }
1207 return 0;
1208 case WM_ACTIVATE:
1209 if(LOWORD(wParam)==WA_ACTIVE||LOWORD(wParam)==WA_CLICKACTIVE){
1210 SetFocus(GetWindow(hClient,GW_CHILD));
1211
1212 if(LOWORD(wParam)==WA_CLICKACTIVE){
1213 GetClientRect(hwnd,&rect);
1214 GetCursorPos(&pos);
1215 ScreenToClient(hwnd,&pos);
1216 if(rect.right-14<=pos.x&&pos.x<=rect.right-1&&
1217 rect.bottom-14<=pos.y&&pos.y<=rect.bottom-1){
1218 ShowHelp_FromParamHint();
1219 }
1220 }
1221 }
1222 return 0;
1223 case WM_DESTROY:
1224 MethodCheckInfo.BeforeMethodName[0]=0;
1225 return 0;
1226 }
1227 return DefWindowProc(hwnd,message,wParam,lParam);
1228}
1229void ShowCommandMessage(void){
1230 extern METHODCHECKINFO MethodCheckInfo;
1231 int i;
1232 int sw;
1233
1234 if(pobj_nv->dwParameterHint==1){
1235 //ポップアップ表示
1236
1237 extern HINSTANCE hInst;
1238 extern METHODCHECKINFO MethodCheckInfo;
1239 extern MDIINFO MdiInfo[MAX_WNDNUM];
1240 HDC hdc,memdc;
1241 RECT rect,rc2;
1242 SIZE size;
1243 POINT pos;
1244 if(!MethodCheckInfo.hWnd){
1245 MethodCheckInfo.hWnd=CreateWindow("MethodCheckWindow",NULL,WS_POPUP,
1246 0,0,0,0,
1247 hOwner,NULL,hInst,0);
1248 sw=1;
1249 }
1250 else sw=0;
1251 i=GetWndNum(GetWindow(hClient,GW_CHILD));
1252
1253 hdc=GetDC(MethodCheckInfo.hWnd);
1254 memdc=CreateCompatibleDC(hdc);
1255 DrawParameterHint(memdc,&size);
1256 DeleteDC(memdc);
1257 ReleaseDC(MethodCheckInfo.hWnd,hdc);
1258
1259 GetWindowRect(MdiInfo[i].hwnd,&rect);
1260 GetCaretPos(&pos);
1261 ClientToScreen(MdiInfo[i].pMdiTextEdit->hEdit,&pos);
1262 rect.left=pos.x-20;
1263 rect.top=pos.y-pobj_nv->lf.lfHeight;
1264 if(sw){
1265 MoveWindow(MethodCheckInfo.hWnd,rect.left,rect.top,size.cx,size.cy,1);
1266 ShowWindow(MethodCheckInfo.hWnd,SW_SHOWNOACTIVATE);
1267 }
1268 else{
1269 GetWindowRect(MethodCheckInfo.hWnd,&rc2);
1270
1271 MoveWindow(MethodCheckInfo.hWnd,
1272 rc2.left,
1273 rect.top,
1274 size.cx,
1275 size.cy,
1276 1);
1277
1278 InvalidateRect(MethodCheckInfo.hWnd,NULL,0);
1279 }
1280 }
1281
1282 //ステータスバーに表示
1283 else if(pobj_nv->dwParameterHint==2)
1284 SetStatusText(MethodCheckInfo.msg);
1285}
Note: See TracBrowser for help on using the repository browser.