source: dev/ProjectEditor/ParameterHint.cpp@ 7

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