1 | #include "Common.h"
|
---|
2 |
|
---|
3 |
|
---|
4 | void ScreenToClient(HWND hwnd,RECT *pRect){
|
---|
5 | ScreenToClient(hwnd,(POINT *)pRect);
|
---|
6 | ScreenToClient(hwnd,(POINT *)(((long)(void *)pRect)+sizeof(POINT)));
|
---|
7 | }
|
---|
8 | void ClientToScreen(HWND hwnd,RECT *pRect){
|
---|
9 | ClientToScreen(hwnd,(POINT *)pRect);
|
---|
10 | ClientToScreen(hwnd,(POINT *)(((long)(void *)pRect)+sizeof(POINT)));
|
---|
11 | }
|
---|
12 |
|
---|
13 |
|
---|
14 | typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE hProcess,PBOOL Wow64Process);
|
---|
15 | BOOL IsWow64(void){
|
---|
16 | ///////////////////////////////////////////////////////////
|
---|
17 | // ProjectEditor.exeがWOW64技術で動作しているのかどうか
|
---|
18 | ///////////////////////////////////////////////////////////
|
---|
19 | BOOL bIsWow64 = FALSE;
|
---|
20 | LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"),"IsWow64Process");
|
---|
21 |
|
---|
22 | if (NULL != fnIsWow64Process)
|
---|
23 | {
|
---|
24 | if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
|
---|
25 | {
|
---|
26 | // handle error
|
---|
27 | bIsWow64 = FALSE;
|
---|
28 | }
|
---|
29 | }
|
---|
30 | return bIsWow64;
|
---|
31 | }
|
---|
32 |
|
---|
33 | void URLEncode(LPSTR pszSrc){
|
---|
34 | char *temp;
|
---|
35 | temp=(char *)malloc(65535);
|
---|
36 |
|
---|
37 | int i,i2;
|
---|
38 | for (i = 0,i2=0; ; i++,i2++)
|
---|
39 | {
|
---|
40 | if(pszSrc[i]=='\0'){
|
---|
41 | temp[i2] = 0;
|
---|
42 | break;
|
---|
43 | }
|
---|
44 |
|
---|
45 | // 英数字 _ . - は変換しないでそのまま
|
---|
46 | if (isalnum((BYTE)pszSrc[i]) || pszSrc[i] == '_' || pszSrc[i] == '.' || pszSrc[i] == '-'){
|
---|
47 | temp[i2] = pszSrc[i];
|
---|
48 | }
|
---|
49 | // それ以外は %3B のような形式に変換
|
---|
50 | else{
|
---|
51 | sprintf(temp+i2,"%%%02X", (BYTE)pszSrc[i]);
|
---|
52 | i2+=lstrlen(temp+i2);
|
---|
53 | i2--;
|
---|
54 | }
|
---|
55 | }
|
---|
56 |
|
---|
57 | lstrcpy(pszSrc,temp);
|
---|
58 | free(temp);
|
---|
59 | }
|
---|
60 |
|
---|
61 | void Digit(int num,char *buffer){
|
---|
62 | char temporary[255];
|
---|
63 | int i,iPos;
|
---|
64 |
|
---|
65 | sprintf(temporary,"%d",abs(num));
|
---|
66 |
|
---|
67 | //カンマが不要の場合は抜ける
|
---|
68 | if(lstrlen(temporary)<=3){
|
---|
69 | wsprintf(buffer,"%d",num);
|
---|
70 | return;
|
---|
71 | }
|
---|
72 |
|
---|
73 | //合計の文字数からバッファを確保
|
---|
74 | if(num<0){
|
---|
75 | buffer[0]='-';
|
---|
76 | iPos=1;
|
---|
77 | }
|
---|
78 | else{
|
---|
79 | buffer[0]=0;
|
---|
80 | iPos=0;
|
---|
81 | }
|
---|
82 |
|
---|
83 | //3桁毎にカンマを加えながら文字列をコピーする
|
---|
84 | int iFirst;
|
---|
85 | iFirst=lstrlen(temporary)%3;
|
---|
86 | if(iFirst==0) iFirst=3;
|
---|
87 | memcpy(buffer+iPos,temporary,iFirst);
|
---|
88 | iPos+=iFirst;
|
---|
89 |
|
---|
90 | int i2;
|
---|
91 | i2=(lstrlen(temporary)-4)/3;
|
---|
92 |
|
---|
93 | for(i=0;i<=i2;i++){
|
---|
94 | buffer[iPos]=',';
|
---|
95 | iPos++;
|
---|
96 | memcpy(buffer+iPos,temporary+i*3+iFirst,3);
|
---|
97 | iPos+=3;
|
---|
98 | buffer[iPos]=0;
|
---|
99 | }
|
---|
100 | }
|
---|
101 |
|
---|
102 | void RectNaturalFormat(RECT *ReadRect,RECT *CopyRect){
|
---|
103 | if(ReadRect->left > ReadRect->right){
|
---|
104 | CopyRect->left=ReadRect->right;
|
---|
105 | CopyRect->right=ReadRect->left;
|
---|
106 | }
|
---|
107 | else{
|
---|
108 | CopyRect->left=ReadRect->left;
|
---|
109 | CopyRect->right=ReadRect->right;
|
---|
110 | }
|
---|
111 | if(ReadRect->top > ReadRect->bottom){
|
---|
112 | CopyRect->top=ReadRect->bottom;
|
---|
113 | CopyRect->bottom=ReadRect->top;
|
---|
114 | }
|
---|
115 | else{
|
---|
116 | CopyRect->top=ReadRect->top;
|
---|
117 | CopyRect->bottom=ReadRect->bottom;
|
---|
118 | }
|
---|
119 | }
|
---|
120 | void RectNaturalFormat(int *x1,int *y1,int *x2,int *y2){
|
---|
121 | int temp;
|
---|
122 | if(*x1>*x2){
|
---|
123 | temp=*x1;
|
---|
124 | *x1=*x2;
|
---|
125 | *x2=temp;
|
---|
126 | }
|
---|
127 | if(*y1>*y2){
|
---|
128 | temp=*y1;
|
---|
129 | *y1=*y2;
|
---|
130 | *y2=temp;
|
---|
131 | }
|
---|
132 | }
|
---|
133 | void KillSpaces(char *str1,char *str2){
|
---|
134 | int i,i2,IsStr;
|
---|
135 | for(i=0,i2=0,IsStr=0;;i++,i2++){
|
---|
136 | while((str1[i]==' '||str1[i]=='\t')&&IsStr==0&&str1[i]!='\0') i++;
|
---|
137 | if(str1[i]=='\"') IsStr^=1;
|
---|
138 | str2[i2]=str1[i];
|
---|
139 | if(str1[i]=='\0') break;
|
---|
140 | }
|
---|
141 | }
|
---|
142 | void RemoveStringQuotes(char *str){
|
---|
143 | int i;
|
---|
144 | if(str[0]!='\"') return;
|
---|
145 | for(i=0;;i++){
|
---|
146 | str[i]=str[i+1];
|
---|
147 | if(str[i]=='\"') break;
|
---|
148 | }
|
---|
149 | str[i]=0;
|
---|
150 | }
|
---|
151 | void SlideString(char *buffer, int slide){
|
---|
152 | char *temp;
|
---|
153 | temp=(char *)malloc(lstrlen(buffer)+1);
|
---|
154 | lstrcpy(temp,buffer);
|
---|
155 | lstrcpy(buffer+slide,temp);
|
---|
156 | free(temp);
|
---|
157 | }
|
---|
158 | void SlideBuffer(char *buffer,int length,int slide){
|
---|
159 | void *temp;
|
---|
160 | temp=malloc(length+1);
|
---|
161 | memcpy(temp,buffer,length);
|
---|
162 | memcpy(buffer+slide,temp,length);
|
---|
163 | free(temp);
|
---|
164 | }
|
---|
165 | BOOL IsVariableTopChar(char c){
|
---|
166 | if((c>='A'&&c<='Z')||(c>='a'&&c<='z')||c=='_') return 1;
|
---|
167 | return 0;
|
---|
168 | }
|
---|
169 | BOOL IsVariableChar(char c){
|
---|
170 | if((c>='A'&&c<='Z')||(c>='a'&&c<='z')||(c>='0'&&c<='9')||
|
---|
171 | c=='_'||c=='.'||c=='$') return 1;
|
---|
172 | return 0;
|
---|
173 | }
|
---|
174 |
|
---|
175 | BOOL IsCommandBackDelimitation(char *buffer,int pos){
|
---|
176 | if(buffer[pos]=='\n'||buffer[pos]==':') return 1;
|
---|
177 | return 0;
|
---|
178 | }
|
---|
179 | BOOL IsCommandDelimitation(char *buffer,int p){
|
---|
180 | if(buffer[p]=='\r'&&buffer[p+1]=='\n') return 2;
|
---|
181 | if(buffer[p]=='\n'||buffer[p]==':'||buffer[p]=='\0') return 1;
|
---|
182 | return 0;
|
---|
183 | }
|
---|
184 |
|
---|
185 | char *ComparisonString(char *str1,char *str2,BOOL bBigSmall){
|
---|
186 | int i,i2,i3,len1,len2;
|
---|
187 | len1=lstrlen(str1);
|
---|
188 | len2=lstrlen(str2);
|
---|
189 | for(i=0;i<len1-len2+1;i++){
|
---|
190 | for(i2=0,i3=i;i2<len2;i2++,i3++){
|
---|
191 | if(bBigSmall){
|
---|
192 | if(str1[i3]!=str2[i2]) break;
|
---|
193 | }
|
---|
194 | else{
|
---|
195 | if((char)CharUpper((LPTSTR)MAKELONG(str1[i3],0))!=(char)CharUpper((LPTSTR)MAKELONG(str2[i2],0))) break;
|
---|
196 | }
|
---|
197 | }
|
---|
198 | if(IsDBCSLeadByte(str1[i])) i++;
|
---|
199 | if(i2==len2) return str1+i3-i2;
|
---|
200 | }
|
---|
201 | return 0;
|
---|
202 | }
|
---|
203 | int GetOneParameter(char *Parameter,int pos,char *retAns){
|
---|
204 | int i,i2,IsStr,PareNum;
|
---|
205 | for(i=pos,i2=0,IsStr=0,PareNum=0;;i++,i2++){
|
---|
206 | if(IsDBCSLeadByte(Parameter[i])){
|
---|
207 | retAns[i2]=Parameter[i];
|
---|
208 | retAns[++i2]=Parameter[++i];
|
---|
209 | continue;
|
---|
210 | }
|
---|
211 | if(Parameter[i]=='\"') IsStr^=1;
|
---|
212 | if(Parameter[i]=='('&&IsStr==0) PareNum++;
|
---|
213 | if(Parameter[i]==')'&&IsStr==0) PareNum--;
|
---|
214 | if(Parameter[i]==','&&IsStr==0&&PareNum==0){
|
---|
215 | retAns[i2]=0;
|
---|
216 | break;
|
---|
217 | }
|
---|
218 | retAns[i2]=Parameter[i];
|
---|
219 | if(Parameter[i]=='\0'||Parameter[i]=='\r'&&Parameter[i+1]=='\n'){
|
---|
220 | retAns[i2]=0;
|
---|
221 | break;
|
---|
222 | }
|
---|
223 | }
|
---|
224 | if(Parameter[i]==',') i++;
|
---|
225 | return i;
|
---|
226 | }
|
---|
227 | int GetStringInPare(char *buffer,char *ReadBuffer){
|
---|
228 | int i,IsStr,PareNum;
|
---|
229 | for(i=0,IsStr=0,PareNum=0;;i++){
|
---|
230 | buffer[i]=ReadBuffer[i];
|
---|
231 | if(ReadBuffer[i]=='\"') IsStr^=1;
|
---|
232 | else if(ReadBuffer[i]=='('&&IsStr==0) PareNum++;
|
---|
233 | else if(ReadBuffer[i]==')'&&IsStr==0){
|
---|
234 | PareNum--;
|
---|
235 | if(PareNum==0){
|
---|
236 | i++;
|
---|
237 | buffer[i]=0;
|
---|
238 | break;
|
---|
239 | }
|
---|
240 | }
|
---|
241 | else if(ReadBuffer[i]=='\0') return 0;
|
---|
242 | }
|
---|
243 | return i;
|
---|
244 | }
|
---|
245 | int GetStringInBracket(char *buffer,char *ReadBuffer){
|
---|
246 | int i,IsStr,PareNum;
|
---|
247 | for(i=0,IsStr=0,PareNum=0;;i++){
|
---|
248 | buffer[i]=ReadBuffer[i];
|
---|
249 | if(IsDBCSLeadByte(ReadBuffer[i])){
|
---|
250 | i++;
|
---|
251 | buffer[i]=ReadBuffer[i];
|
---|
252 | continue;
|
---|
253 | }
|
---|
254 | if(ReadBuffer[i]=='\"') IsStr^=1;
|
---|
255 | else if(ReadBuffer[i]=='['&&IsStr==0) PareNum++;
|
---|
256 | else if(ReadBuffer[i]==']'&&IsStr==0){
|
---|
257 | PareNum--;
|
---|
258 | if(PareNum==0){
|
---|
259 | i++;
|
---|
260 | buffer[i]=0;
|
---|
261 | break;
|
---|
262 | }
|
---|
263 | }
|
---|
264 | else if(ReadBuffer[i]=='\0') return 0;
|
---|
265 | }
|
---|
266 | return i;
|
---|
267 | }
|
---|
268 | void JumpBlank(char *pBuf,int *piPos){
|
---|
269 | int i;
|
---|
270 | i=*piPos;
|
---|
271 |
|
---|
272 | while(1){
|
---|
273 | while(pBuf[i]==' '||pBuf[i]=='\t') i++;
|
---|
274 | if(pBuf[i]=='\0') break;
|
---|
275 | if(pBuf[i]=='\''){
|
---|
276 | //注釈文(一行)
|
---|
277 | for(i++;;i++){
|
---|
278 | if(pBuf[i]=='\0') break;
|
---|
279 | if(pBuf[i]=='\r'&&pBuf[i+1]=='\n'){
|
---|
280 | i+=2;
|
---|
281 | break;
|
---|
282 | }
|
---|
283 | }
|
---|
284 | while(pBuf[i]==' '||pBuf[i]=='\t') i++;
|
---|
285 | }
|
---|
286 | if(pBuf[i]=='/'&&pBuf[i+1]=='*'){
|
---|
287 | //注釈文(複数行)
|
---|
288 | i+=2;
|
---|
289 | while(!(pBuf[i]=='*'&&pBuf[i+1]=='/')){
|
---|
290 | i++;
|
---|
291 | if(pBuf[i]=='\0') break;
|
---|
292 | }
|
---|
293 | if(pBuf[i]){
|
---|
294 | i+=2;
|
---|
295 | }
|
---|
296 | }
|
---|
297 | while(pBuf[i]=='\r'&&pBuf[i+1]=='\n') i+=2;
|
---|
298 |
|
---|
299 | if(!(
|
---|
300 | pBuf[i]==' '||
|
---|
301 | pBuf[i]=='\t'||
|
---|
302 | pBuf[i]=='\''||
|
---|
303 | (pBuf[i]=='/'&&pBuf[i+1]=='*')
|
---|
304 | )) break;
|
---|
305 | }
|
---|
306 |
|
---|
307 | *piPos=i;
|
---|
308 | }
|
---|
309 |
|
---|
310 | BOOL CheckParenthesis(char *buffer){
|
---|
311 | int i,IsStr,PareNum,sw;
|
---|
312 | _int8 bracket[1024];
|
---|
313 |
|
---|
314 | for(i=0,IsStr=0,PareNum=0,sw=0;;i++){
|
---|
315 | if(buffer[i]=='\"'){
|
---|
316 | IsStr^=1;
|
---|
317 | continue;
|
---|
318 | }
|
---|
319 |
|
---|
320 | else if(buffer[i]=='('&&IsStr==0){
|
---|
321 | bracket[PareNum]=0;
|
---|
322 | PareNum++;
|
---|
323 | }
|
---|
324 | else if(buffer[i]=='['&&IsStr==0){
|
---|
325 | bracket[PareNum]=1;
|
---|
326 | PareNum++;
|
---|
327 | }
|
---|
328 |
|
---|
329 | else if(buffer[i]==')'&&IsStr==0){
|
---|
330 | PareNum--;
|
---|
331 | if(bracket[PareNum]!=0||PareNum<0){
|
---|
332 | //"カッコ \'( )\'"
|
---|
333 | return 0;
|
---|
334 | }
|
---|
335 | }
|
---|
336 | else if(buffer[i]==']'&&IsStr==0){
|
---|
337 | PareNum--;
|
---|
338 | if(bracket[PareNum]!=1||PareNum<0){
|
---|
339 | //"カッコ \'( )\'"
|
---|
340 | return 0;
|
---|
341 | }
|
---|
342 | }
|
---|
343 |
|
---|
344 | else if(buffer[i]=='\n'||buffer[i]=='\0'){
|
---|
345 |
|
---|
346 | //"カッコ \'( )\'"
|
---|
347 | if(buffer[i]=='\0'){
|
---|
348 | if(PareNum!=0){
|
---|
349 | return 0;
|
---|
350 | }
|
---|
351 |
|
---|
352 | if(IsStr!=0){
|
---|
353 | return 0;
|
---|
354 | }
|
---|
355 | }
|
---|
356 | if(buffer[i]=='\0') break;
|
---|
357 |
|
---|
358 | sw=0;
|
---|
359 | }
|
---|
360 | }
|
---|
361 | return 1;
|
---|
362 | }
|
---|
363 |
|
---|
364 | DWORD GetValue(char *value){
|
---|
365 | unsigned long ans;
|
---|
366 | if(value[0]=='&'){
|
---|
367 | if(value[1]=='o'||value[1]=='O') sscanf(value+2,"%o",&ans);
|
---|
368 | if(value[1]=='h'||value[1]=='H') sscanf(value+2,"%x",&ans);
|
---|
369 | }
|
---|
370 | else ans=atol(value);
|
---|
371 | return ans;
|
---|
372 | }
|
---|
373 | BOOL IsManagementCommand(int ComNum){
|
---|
374 | switch(ComNum){
|
---|
375 | case -1:
|
---|
376 | case COM_ABSTRACT:
|
---|
377 | case COM_CLASS:
|
---|
378 | case COM_CONST:
|
---|
379 | case COM_DEBUG:
|
---|
380 | case COM_DECLARE:
|
---|
381 | case COM_DEF:
|
---|
382 | case COM_DIM:
|
---|
383 | case COM_DO:
|
---|
384 | case COM_END:
|
---|
385 | case COM_ENUM:
|
---|
386 | case COM_FOR:
|
---|
387 | case COM_FUNCTION:
|
---|
388 | case COM_GOSUB:
|
---|
389 | case COM_GOTO:
|
---|
390 | case COM_IF:
|
---|
391 | case COM_INHERITS:
|
---|
392 | case COM_INTERFACE:
|
---|
393 | case COM_LOOP:
|
---|
394 | case COM_NEXT:
|
---|
395 | case COM_PRIVATE:
|
---|
396 | case COM_PROTECTED:
|
---|
397 | case COM_PUBLIC:
|
---|
398 | case COM_RETURN:
|
---|
399 | case COM_SELECT:
|
---|
400 | case COM_SUB:
|
---|
401 | case COM_TYPE:
|
---|
402 | case COM_TYPEDEF:
|
---|
403 | case COM_VIRTUAL:
|
---|
404 | case COM_OVERRIDE:
|
---|
405 | case COM_WEND:
|
---|
406 | case COM_WHILE:
|
---|
407 | case COM_WITH:
|
---|
408 | return 1;
|
---|
409 | default:
|
---|
410 | break;
|
---|
411 | }
|
---|
412 | return 0;
|
---|
413 | }
|
---|
414 | int IsBasicReservedWord(char *str){
|
---|
415 | if(str[0]=='a'||str[0]=='A'){
|
---|
416 | if(lstrcmpi(str,"Abstract")==0) return COM_ABSTRACT;
|
---|
417 | if(lstrcmpi(str,"As")==0) return -1;
|
---|
418 | }
|
---|
419 | else if(str[0]=='b'||str[0]=='B'){
|
---|
420 | if(lstrcmpi(str,"Beep")==0) return COM_BEEP;
|
---|
421 | if(lstrcmp(str,"Boolean")==0) return -1;
|
---|
422 | if(lstrcmpi(str,"ByRef")==0) return -1;
|
---|
423 | if(lstrcmpi(str,"ByVal")==0) return -1;
|
---|
424 | if(lstrcmp(str,"Byte")==0) return -1;
|
---|
425 | }
|
---|
426 | else if(str[0]=='c'||str[0]=='C'){
|
---|
427 | if(lstrcmpi(str,"Case")==0) return -1;
|
---|
428 | if(lstrcmp(str,"Char")==0) return -1;
|
---|
429 | if(lstrcmpi(str,"ChDir")==0) return COM_CHDIR;
|
---|
430 | if(lstrcmpi(str,"Circle")==0) return COM_CIRCLE;
|
---|
431 | if(lstrcmpi(str,"Class")==0) return COM_CLASS;
|
---|
432 | if(lstrcmpi(str,"Close")==0) return COM_CLOSE;
|
---|
433 | if(lstrcmpi(str,"Cls")==0) return COM_CLS;
|
---|
434 | if(lstrcmpi(str,"Color")==0) return COM_COLOR;
|
---|
435 | if(lstrcmpi(str,"Const")==0) return COM_CONST;
|
---|
436 | if(lstrcmpi(str,"Continue")==0) return -1;
|
---|
437 | }
|
---|
438 | else if(str[0]=='d'||str[0]=='D'){
|
---|
439 | if(lstrcmpi(str,"Debug")==0) return COM_DEBUG;
|
---|
440 | if(lstrcmpi(str,"Declare")==0) return COM_DECLARE;
|
---|
441 | if(lstrcmpi(str,"Def")==0) return COM_DEF;
|
---|
442 | if(lstrcmpi(str,"Delete")==0) return -1;
|
---|
443 | if(lstrcmpi(str,"DelWnd")==0) return COM_DELWND;
|
---|
444 | if(lstrcmpi(str,"Dim")==0) return COM_DIM;
|
---|
445 | if(lstrcmpi(str,"Do")==0) return COM_DO;
|
---|
446 | if(lstrcmp(str,"Double")==0) return -1;
|
---|
447 | if(lstrcmp(str,"DWord")==0) return -1;
|
---|
448 | }
|
---|
449 | else if(str[0]=='e'||str[0]=='E'){
|
---|
450 | if(lstrcmpi(str,"Else")==0) return -1;
|
---|
451 | if(lstrcmpi(str,"ElseIf")==0) return -1;
|
---|
452 | if(lstrcmpi(str,"End")==0) return COM_END;
|
---|
453 | if(lstrcmpi(str,"EndIf")==0) return -1;
|
---|
454 | if(lstrcmpi(str,"EndFunction")==0) return -1;
|
---|
455 | if(lstrcmpi(str,"EndSub")==0) return -1;
|
---|
456 | if(lstrcmpi(str,"EndType")==0) return -1;
|
---|
457 | if(lstrcmpi(str,"EndSelect")==0) return -1;
|
---|
458 | if(lstrcmpi(str,"EndWith")==0) return -1;
|
---|
459 | if(lstrcmpi(str,"Enum")==0) return COM_ENUM;
|
---|
460 | if(lstrcmpi(str,"Exit")==0) return -1;
|
---|
461 | if(lstrcmpi(str,"ExitDo")==0) return -1;
|
---|
462 | if(lstrcmpi(str,"ExitFor")==0) return -1;
|
---|
463 | if(lstrcmpi(str,"ExitFunction")==0) return -1;
|
---|
464 | if(lstrcmpi(str,"ExitSub")==0) return -1;
|
---|
465 | if(lstrcmpi(str,"ExitWhile")==0) return -1;
|
---|
466 | }
|
---|
467 | else if(str[0]=='f'||str[0]=='F'){
|
---|
468 | if(lstrcmp(str,"False")==0) return -1;
|
---|
469 | if(lstrcmpi(str,"Field")==0) return COM_FIELD;
|
---|
470 | if(lstrcmpi(str,"For")==0) return COM_FOR;
|
---|
471 | if(lstrcmpi(str,"Function")==0) return COM_FUNCTION;
|
---|
472 | }
|
---|
473 | else if(str[0]=='g'||str[0]=='G'){
|
---|
474 | if(lstrcmpi(str,"Get")==0) return COM_GET;
|
---|
475 | if(lstrcmpi(str,"GoSub")==0) return COM_GOSUB;
|
---|
476 | if(lstrcmpi(str,"Goto")==0) return COM_GOTO;
|
---|
477 | }
|
---|
478 | else if(str[0]=='i'||str[0]=='I'){
|
---|
479 | if(lstrcmpi(str,"If")==0) return COM_IF;
|
---|
480 | if(lstrcmpi(str,"Inherits")==0) return COM_INHERITS;
|
---|
481 | if(lstrcmpi(str,"Input")==0) return COM_INPUT;
|
---|
482 | if(lstrcmp(str,"Int64")==0) return -1;
|
---|
483 | if(lstrcmp(str,"Integer")==0) return -1;
|
---|
484 | if(lstrcmpi(str,"Interface")==0) return COM_INTERFACE;
|
---|
485 | }
|
---|
486 | else if(str[0]=='k'||str[0]=='K'){
|
---|
487 | if(lstrcmpi(str,"Kill")==0) return COM_KILL;
|
---|
488 | }
|
---|
489 | else if(str[0]=='l'||str[0]=='L'){
|
---|
490 | if(lstrcmpi(str,"Let")==0) return COM_LET;
|
---|
491 | if(lstrcmpi(str,"Line")==0) return COM_LINE;
|
---|
492 | if(lstrcmpi(str,"Locate")==0) return COM_LOCATE;
|
---|
493 | if(lstrcmp(str,"Long")==0) return -1;
|
---|
494 | if(lstrcmpi(str,"Loop")==0) return COM_LOOP;
|
---|
495 | }
|
---|
496 | else if(str[0]=='m'||str[0]=='M'){
|
---|
497 | if(lstrcmpi(str,"MkDir")==0) return COM_MKDIR;
|
---|
498 | if(lstrcmpi(str,"MsgBox")==0) return COM_MSGBOX;
|
---|
499 | }
|
---|
500 | else if(str[0]=='n'||str[0]=='N'){
|
---|
501 | if(lstrcmpi(str,"Next")==0) return COM_NEXT;
|
---|
502 | if(lstrcmpi(str,"New")==0) return -1;
|
---|
503 | if(lstrcmpi(str,"Nothing")==0) return -1;
|
---|
504 | }
|
---|
505 | else if(str[0]=='o'||str[0]=='O'){
|
---|
506 | if(lstrcmpi(str,"Open")==0) return COM_OPEN;
|
---|
507 | if(lstrcmpi(str,"Operator")==0) return -1;
|
---|
508 | if(lstrcmpi(str,"Override")==0) return COM_OVERRIDE;
|
---|
509 | }
|
---|
510 | else if(str[0]=='p'||str[0]=='P'){
|
---|
511 | if(lstrcmpi(str,"Paint")==0) return COM_PAINT;
|
---|
512 | if(lstrcmpi(str,"Print")==0) return COM_PRINT;
|
---|
513 | if(lstrcmpi(str,"Private")==0) return COM_PRIVATE;
|
---|
514 | if(lstrcmpi(str,"Protected")==0) return COM_PROTECTED;
|
---|
515 | if(lstrcmpi(str,"PSet")==0) return COM_PSET;
|
---|
516 | if(lstrcmpi(str,"Put")==0) return COM_PUT;
|
---|
517 | if(lstrcmpi(str,"Public")==0) return COM_PUBLIC;
|
---|
518 | }
|
---|
519 | else if(str[0]=='q'||str[0]=='Q'){
|
---|
520 | if(lstrcmp(str,"QWord")==0) return -1;
|
---|
521 | }
|
---|
522 | else if(str[0]=='r'||str[0]=='R'){
|
---|
523 | if(lstrcmpi(str,"Randomize")==0) return COM_RANDOMIZE;
|
---|
524 | if(lstrcmpi(str,"Rem")==0) return COM_REM;
|
---|
525 | if(lstrcmpi(str,"Return")==0) return COM_RETURN;
|
---|
526 | }
|
---|
527 | else if(str[0]=='s'||str[0]=='S'){
|
---|
528 | if(lstrcmp(str,"SByte")==0) return -1;
|
---|
529 | if(lstrcmpi(str,"Select")==0) return COM_SELECT;
|
---|
530 | if(lstrcmpi(str,"SelectCase")==0) return COM_SELECT;
|
---|
531 | if(lstrcmp(str,"Single")==0) return -1;
|
---|
532 | if(lstrcmpi(str,"Sleep")==0) return COM_SLEEP;
|
---|
533 | if(lstrcmpi(str,"Static")==0) return -1;
|
---|
534 | if(lstrcmpi(str,"Sub")==0) return COM_SUB;
|
---|
535 | if(lstrcmpi(str,"Super")==0) return -1;
|
---|
536 | }
|
---|
537 | else if(str[0]=='t'||str[0]=='T'){
|
---|
538 | if(lstrcmpi(str,"Then")==0) return -1;
|
---|
539 | if(lstrcmp(str,"True")==0) return -1;
|
---|
540 | if(lstrcmpi(str,"Type")==0) return COM_TYPE;
|
---|
541 | if(lstrcmpi(str,"TypeDef")==0) return COM_TYPEDEF;
|
---|
542 | }
|
---|
543 | else if(str[0]=='u'||str[0]=='U'){
|
---|
544 | if(lstrcmpi(str,"Until")==0) return -1;
|
---|
545 | }
|
---|
546 | else if(str[0]=='v'||str[0]=='V'){
|
---|
547 | if(lstrcmpi(str,"Virtual")==0) return COM_VIRTUAL;
|
---|
548 | }
|
---|
549 | else if(str[0]=='w'||str[0]=='W'){
|
---|
550 | if(lstrcmpi(str,"Wend")==0) return COM_WEND;
|
---|
551 | if(lstrcmpi(str,"While")==0) return COM_WHILE;
|
---|
552 | if(lstrcmpi(str,"Window")==0) return COM_WINDOW;
|
---|
553 | if(lstrcmpi(str,"With")==0) return COM_WITH;
|
---|
554 | if(lstrcmp(str,"Word")==0) return -1;
|
---|
555 | if(lstrcmpi(str,"Write")==0) return COM_WRITE;
|
---|
556 | }
|
---|
557 | else if(str[0]=='#'){
|
---|
558 | if(lstrcmpi(str,"#include")==0) return -1;
|
---|
559 | if(lstrcmpi(str,"#strict")==0) return -1;
|
---|
560 | if(lstrcmpi(str,"#console")==0) return -1;
|
---|
561 | if(lstrcmpi(str,"#prompt")==0) return -1;
|
---|
562 | if(lstrcmpi(str,"#N88BASIC")==0) return -1;
|
---|
563 | if(lstrcmpi(str,"#define")==0) return -1;
|
---|
564 | if(lstrcmpi(str,"#ifdef")==0) return -1;
|
---|
565 | if(lstrcmpi(str,"#ifndef")==0) return -1;
|
---|
566 | if(lstrcmpi(str,"#else")==0) return -1;
|
---|
567 | if(lstrcmpi(str,"#endif")==0) return -1;
|
---|
568 | }
|
---|
569 | return 0;
|
---|
570 | }
|
---|
571 |
|
---|
572 | HBITMAP CreateGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2){
|
---|
573 | //グラデーションビットマップを生成
|
---|
574 |
|
---|
575 | BITMAPINFO BitmapInfo;
|
---|
576 | memset(&BitmapInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER));
|
---|
577 | BitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
|
---|
578 | BitmapInfo.bmiHeader.biWidth=pSize->cx;
|
---|
579 | BitmapInfo.bmiHeader.biHeight=pSize->cy;
|
---|
580 | BitmapInfo.bmiHeader.biPlanes=1;
|
---|
581 | BitmapInfo.bmiHeader.biBitCount=24;
|
---|
582 |
|
---|
583 | HDC hdc;
|
---|
584 | hdc=GetDC(GetDesktopWindow());
|
---|
585 |
|
---|
586 | HBITMAP hBitmap;
|
---|
587 | BYTE *pByte;
|
---|
588 | hBitmap=CreateDIBSection(hdc,&BitmapInfo,DIB_RGB_COLORS,(void **)&pByte,0,0);
|
---|
589 |
|
---|
590 | int i,i2,x,y;
|
---|
591 | COLORREF rgb;
|
---|
592 | i=BitmapInfo.bmiHeader.biWidth*3;
|
---|
593 | if(i%sizeof(LONG)!=0) i+=sizeof(LONG)-(i%sizeof(LONG));
|
---|
594 | for(y=0;y<BitmapInfo.bmiHeader.biHeight;y++){
|
---|
595 | if(y<BitmapInfo.bmiHeader.biHeight/2-2) rgb=color2;
|
---|
596 | else if(y>BitmapInfo.bmiHeader.biHeight/2+2) rgb=color1;
|
---|
597 | else{
|
---|
598 | double ratio;
|
---|
599 | ratio=((double)y-((double)BitmapInfo.bmiHeader.biHeight/(double)2-(double)2))/(double)4;
|
---|
600 | //ratio=(double)y/(double)BitmapInfo.bmiHeader.biHeight;
|
---|
601 | rgb=RGB(
|
---|
602 | LOBYTE(LOWORD(color2))+(int)(double)(LOBYTE(LOWORD(color1))-LOBYTE(LOWORD(color2)))*(ratio), //赤要素
|
---|
603 | HIBYTE(LOWORD(color2))+(int)(double)(HIBYTE(LOWORD(color1))-HIBYTE(LOWORD(color2)))*(ratio), //緑要素
|
---|
604 | LOBYTE(HIWORD(color2))+(int)(double)(LOBYTE(HIWORD(color1))-LOBYTE(HIWORD(color2)))*(ratio) //青要素
|
---|
605 | );
|
---|
606 | }
|
---|
607 | for(x=0;x<BitmapInfo.bmiHeader.biWidth;x++){
|
---|
608 | i2=y*i+x*3;
|
---|
609 | pByte[i2+2]=LOBYTE(LOWORD(rgb));
|
---|
610 | pByte[i2+1]=HIBYTE(LOWORD(rgb));
|
---|
611 | pByte[i2]=LOBYTE(HIWORD(rgb));
|
---|
612 | }
|
---|
613 | }
|
---|
614 |
|
---|
615 | DeleteDC(hdc);
|
---|
616 |
|
---|
617 | return hBitmap;
|
---|
618 | }
|
---|
619 | HBITMAP CreateVertGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2){
|
---|
620 | //グラデーションビットマップを生成
|
---|
621 |
|
---|
622 | BITMAPINFO BitmapInfo;
|
---|
623 | memset(&BitmapInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER));
|
---|
624 | BitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
|
---|
625 | BitmapInfo.bmiHeader.biWidth=pSize->cx;
|
---|
626 | BitmapInfo.bmiHeader.biHeight=pSize->cy;
|
---|
627 | BitmapInfo.bmiHeader.biPlanes=1;
|
---|
628 | BitmapInfo.bmiHeader.biBitCount=24;
|
---|
629 |
|
---|
630 | HDC hdc;
|
---|
631 | hdc=GetDC(GetDesktopWindow());
|
---|
632 |
|
---|
633 | HBITMAP hBitmap;
|
---|
634 | BYTE *pByte;
|
---|
635 | hBitmap=CreateDIBSection(hdc,&BitmapInfo,DIB_RGB_COLORS,(void **)&pByte,0,0);
|
---|
636 |
|
---|
637 | int i,i2,x,y;
|
---|
638 | COLORREF rgb;
|
---|
639 | i=BitmapInfo.bmiHeader.biWidth*3;
|
---|
640 | if(i%sizeof(LONG)!=0) i+=sizeof(LONG)-(i%sizeof(LONG));
|
---|
641 | for(y=0;y<BitmapInfo.bmiHeader.biHeight;y++){
|
---|
642 | if(y<BitmapInfo.bmiHeader.biHeight/2-2) rgb=color2;
|
---|
643 | else if(y>BitmapInfo.bmiHeader.biHeight/2+2) rgb=color1;
|
---|
644 | else{
|
---|
645 | double ratio;
|
---|
646 | ratio=(double)y/(double)BitmapInfo.bmiHeader.biHeight;
|
---|
647 | rgb=RGB(
|
---|
648 | LOBYTE(LOWORD(color2))+(int)(double)(LOBYTE(LOWORD(color1))-LOBYTE(LOWORD(color2)))*(ratio), //赤要素
|
---|
649 | HIBYTE(LOWORD(color2))+(int)(double)(HIBYTE(LOWORD(color1))-HIBYTE(LOWORD(color2)))*(ratio), //緑要素
|
---|
650 | LOBYTE(HIWORD(color2))+(int)(double)(LOBYTE(HIWORD(color1))-LOBYTE(HIWORD(color2)))*(ratio) //青要素
|
---|
651 | );
|
---|
652 | }
|
---|
653 | for(x=0;x<BitmapInfo.bmiHeader.biWidth;x++){
|
---|
654 | i2=y*i+x*3;
|
---|
655 | pByte[i2+2]=LOBYTE(LOWORD(rgb));
|
---|
656 | pByte[i2+1]=HIBYTE(LOWORD(rgb));
|
---|
657 | pByte[i2]=LOBYTE(HIWORD(rgb));
|
---|
658 | }
|
---|
659 | }
|
---|
660 |
|
---|
661 | DeleteDC(hdc);
|
---|
662 |
|
---|
663 | return hBitmap;
|
---|
664 | }
|
---|
665 | HBITMAP CreateHorzGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2){
|
---|
666 | //グラデーションビットマップを生成
|
---|
667 |
|
---|
668 | BITMAPINFO BitmapInfo;
|
---|
669 | memset(&BitmapInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER));
|
---|
670 | BitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
|
---|
671 | BitmapInfo.bmiHeader.biWidth=pSize->cx;
|
---|
672 | BitmapInfo.bmiHeader.biHeight=pSize->cy;
|
---|
673 | BitmapInfo.bmiHeader.biPlanes=1;
|
---|
674 | BitmapInfo.bmiHeader.biBitCount=24;
|
---|
675 |
|
---|
676 | HDC hdc;
|
---|
677 | hdc=GetDC(GetDesktopWindow());
|
---|
678 |
|
---|
679 | HBITMAP hBitmap;
|
---|
680 | BYTE *pByte;
|
---|
681 | hBitmap=CreateDIBSection(hdc,&BitmapInfo,DIB_RGB_COLORS,(void **)&pByte,0,0);
|
---|
682 |
|
---|
683 | int i,i2,x,y;
|
---|
684 | COLORREF rgb;
|
---|
685 | i=BitmapInfo.bmiHeader.biWidth*3;
|
---|
686 | if(i%sizeof(LONG)!=0) i+=sizeof(LONG)-(i%sizeof(LONG));
|
---|
687 | for(x=0;x<BitmapInfo.bmiHeader.biWidth;x++){
|
---|
688 | double ratio;
|
---|
689 | ratio=(double)x/(double)BitmapInfo.bmiHeader.biWidth;
|
---|
690 | rgb=RGB(
|
---|
691 | LOBYTE(LOWORD(color1))+(int)(double)(LOBYTE(LOWORD(color2))-LOBYTE(LOWORD(color1)))*(ratio), //赤要素
|
---|
692 | HIBYTE(LOWORD(color1))+(int)(double)(HIBYTE(LOWORD(color2))-HIBYTE(LOWORD(color1)))*(ratio), //緑要素
|
---|
693 | LOBYTE(HIWORD(color1))+(int)(double)(LOBYTE(HIWORD(color2))-LOBYTE(HIWORD(color1)))*(ratio) //青要素
|
---|
694 | );
|
---|
695 | for(y=0;y<BitmapInfo.bmiHeader.biHeight;y++){
|
---|
696 | i2=y*i+x*3;
|
---|
697 | pByte[i2+2]=LOBYTE(LOWORD(rgb));
|
---|
698 | pByte[i2+1]=HIBYTE(LOWORD(rgb));
|
---|
699 | pByte[i2]=LOBYTE(HIWORD(rgb));
|
---|
700 | }
|
---|
701 | }
|
---|
702 |
|
---|
703 | DeleteDC(hdc);
|
---|
704 |
|
---|
705 | return hBitmap;
|
---|
706 | }
|
---|
707 | HICON CreateGrayIcon(HICON hBaseIcon){
|
---|
708 | ////////////////////////
|
---|
709 | // 淡色アイコンを生成
|
---|
710 | ////////////////////////
|
---|
711 |
|
---|
712 | HICON hGrayIcon;
|
---|
713 |
|
---|
714 | ICONINFO IconInfo;
|
---|
715 | GetIconInfo(hBaseIcon,&IconInfo);
|
---|
716 |
|
---|
717 |
|
---|
718 | //ビットマップを加工
|
---|
719 | BITMAP Bitmap;
|
---|
720 | GetObject(IconInfo.hbmColor,sizeof(Bitmap),&Bitmap);
|
---|
721 |
|
---|
722 | BITMAPINFO BitmapInfo;
|
---|
723 | memset(&BitmapInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER));
|
---|
724 | BitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
|
---|
725 | BitmapInfo.bmiHeader.biWidth=Bitmap.bmWidth;
|
---|
726 | BitmapInfo.bmiHeader.biHeight=Bitmap.bmHeight;
|
---|
727 | BitmapInfo.bmiHeader.biPlanes=1;
|
---|
728 | BitmapInfo.bmiHeader.biBitCount=24;
|
---|
729 | BitmapInfo.bmiHeader.biCompression=BI_RGB;
|
---|
730 |
|
---|
731 | HDC hdc;
|
---|
732 | hdc=GetDC(GetDesktopWindow());
|
---|
733 |
|
---|
734 | BYTE *pByte;
|
---|
735 | pByte=(BYTE *)HeapAlloc(hHeap,0,Bitmap.bmWidth*Bitmap.bmHeight*sizeof(COLORREF));
|
---|
736 | GetDIBits(hdc,
|
---|
737 | IconInfo.hbmColor,
|
---|
738 | 0,
|
---|
739 | Bitmap.bmHeight,
|
---|
740 | (void *)pByte,
|
---|
741 | &BitmapInfo,
|
---|
742 | DIB_RGB_COLORS);
|
---|
743 |
|
---|
744 | int i,i2,x,y;
|
---|
745 | i=BitmapInfo.bmiHeader.biWidth*3;
|
---|
746 | if(i%sizeof(LONG)!=0) i+=sizeof(LONG)-(i%sizeof(LONG));
|
---|
747 | for(x=0;x<BitmapInfo.bmiHeader.biWidth;x++){
|
---|
748 | for(y=0;y<BitmapInfo.bmiHeader.biHeight;y++){
|
---|
749 | i2=y*i+x*3;
|
---|
750 | if(pByte[i2+2]==0&&pByte[i2+1]==0&&pByte[i2]==0){
|
---|
751 | //透明色
|
---|
752 | //何もしない
|
---|
753 | }
|
---|
754 | else{
|
---|
755 | double ratio=0.5; //明るさ
|
---|
756 |
|
---|
757 | pByte[i2+2]+=(BYTE)((double)(255-pByte[i2+2])*ratio);
|
---|
758 | pByte[i2+1]+=(BYTE)((double)(255-pByte[i2+1])*ratio);
|
---|
759 | pByte[i2]+=(BYTE)((double)(255-pByte[i2])*ratio);
|
---|
760 |
|
---|
761 | pByte[i2+2]=(BYTE)(((int)pByte[i2+2]+(int)pByte[i2+1]+(int)pByte[i2])/3);
|
---|
762 | pByte[i2+1]=pByte[i2+2];
|
---|
763 | pByte[i2]=pByte[i2+2];
|
---|
764 | }
|
---|
765 | }
|
---|
766 | }
|
---|
767 |
|
---|
768 | SetDIBits(hdc,
|
---|
769 | IconInfo.hbmColor,
|
---|
770 | 0,
|
---|
771 | Bitmap.bmHeight,
|
---|
772 | (void *)pByte,
|
---|
773 | &BitmapInfo,
|
---|
774 | DIB_RGB_COLORS);
|
---|
775 |
|
---|
776 | HeapDefaultFree(pByte);
|
---|
777 |
|
---|
778 | DeleteDC(hdc);
|
---|
779 |
|
---|
780 |
|
---|
781 | hGrayIcon=CreateIconIndirect(&IconInfo);
|
---|
782 |
|
---|
783 | //不要なビットマップを破棄
|
---|
784 | DeleteObject(IconInfo.hbmMask);
|
---|
785 | DeleteObject(IconInfo.hbmColor);
|
---|
786 |
|
---|
787 | return hGrayIcon;
|
---|
788 | }
|
---|
789 | void GetSize(SIZE *pSize,RECT *pRect){
|
---|
790 | pSize->cx=pRect->right-pRect->left;
|
---|
791 | pSize->cy=pRect->bottom-pRect->top;
|
---|
792 | }
|
---|
793 | BOOL HitTest(RECT *pRect,POINT *pPos){
|
---|
794 | if(pRect->left<=pPos->x&&pPos->x<pRect->right&&
|
---|
795 | pRect->top<=pPos->y&&pPos->y<pRect->bottom) return 1;
|
---|
796 | return 0;
|
---|
797 | }
|
---|
798 | BOOL Rectangle(HDC hdc,RECT *pRect){
|
---|
799 | return Rectangle(hdc,pRect->left,pRect->top,pRect->right,pRect->bottom);
|
---|
800 | }
|
---|
801 |
|
---|
802 | void ComboBox_SetSelText(HWND hCombo,char *lpszText){
|
---|
803 | SendMessage(hCombo,CB_SETCURSEL,
|
---|
804 | SendMessage(hCombo,CB_FINDSTRINGEXACT,0,(LPARAM)lpszText),
|
---|
805 | 0);
|
---|
806 | }
|
---|
807 |
|
---|
808 | void SetCursorByState(int state){
|
---|
809 | if(state==FRAME_UPPER_LEFT||state==FRAME_LOWER_RIGHT) SetCursor(LoadCursor(0,IDC_SIZENWSE));
|
---|
810 | else if(state==FRAME_UPPER_RIGHT||state==FRAME_LOWER_LEFT) SetCursor(LoadCursor(0,IDC_SIZENESW));
|
---|
811 | else if(state==FRAME_LEFT||state==FRAME_RIGHT) SetCursor(LoadCursor(0,IDC_SIZEWE));
|
---|
812 | else if(state==FRAME_UPPER||state==FRAME_LOWER) SetCursor(LoadCursor(0,IDC_SIZENS));
|
---|
813 | else if(state==FRAME_INSIDE) SetCursor(LoadCursor(0,IDC_SIZEALL));
|
---|
814 | else SetCursor(LoadCursor(0,IDC_ARROW));
|
---|
815 | }
|
---|
816 |
|
---|
817 | void SetTextEditColorDesign(TEXTEDIT_COLOR_INFO *pColorInfo,CTheme *pobj_Theme,BOOL bRedraw){
|
---|
818 | pColorInfo->rgbDefault=pobj_Theme->TextColorInfo.rgbDefault;
|
---|
819 | pColorInfo->rgbComment=pobj_Theme->TextColorInfo.rgbComment;
|
---|
820 | pColorInfo->rgbStatement=pobj_Theme->TextColorInfo.rgbStatement;
|
---|
821 | pColorInfo->rgbString=pobj_Theme->TextColorInfo.rgbString;
|
---|
822 | pColorInfo->rgbCursorBack=pobj_Theme->TextColorInfo.rgbCursorBack;
|
---|
823 | pColorInfo->rgbBackground=pobj_Theme->TextColorInfo.rgbBackground;
|
---|
824 |
|
---|
825 | //アクティブテーマにセット
|
---|
826 | lstrcpy(pobj_nv->szActiveTheme,pobj_Theme->m_name);
|
---|
827 |
|
---|
828 | //テーマ依存の描画リソースを取得
|
---|
829 | pobj_DBTheme->unlock();
|
---|
830 | pobj_DBTheme->lock();
|
---|
831 |
|
---|
832 | if(bRedraw){
|
---|
833 | //再描画
|
---|
834 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
835 | int i;
|
---|
836 | for(i=0;i<MAX_WNDNUM;i++){
|
---|
837 | if(MdiInfo[i].hwnd){
|
---|
838 | if(IS_DOCUMENT_TEXT(MdiInfo[i].DocType)){
|
---|
839 | SetTextEditWordColor(i);
|
---|
840 | InvalidateRect(MdiInfo[i].pMdiTextEdit->hEdit,NULL,0);
|
---|
841 | }
|
---|
842 | }
|
---|
843 | }
|
---|
844 | }
|
---|
845 | }
|
---|
846 |
|
---|
847 | BOOL SetupProjectEditor(void){
|
---|
848 | extern HINSTANCE hInst;
|
---|
849 | int i;
|
---|
850 | char str[MAX_PATH],temporary[MAX_PATH];
|
---|
851 |
|
---|
852 |
|
---|
853 | //リソース用DLLをマッピング
|
---|
854 | #if defined(JPN)
|
---|
855 | //日本語リソース
|
---|
856 | sprintf(temporary,"%sSubOperation\\res.dll",pj_editor_Dir);
|
---|
857 | #else
|
---|
858 | //英語リソース
|
---|
859 | sprintf(temporary,"%sSubOperation\\res_e.dll",pj_editor_Dir);
|
---|
860 | #endif
|
---|
861 | hResInst=LoadLibrary(temporary);
|
---|
862 |
|
---|
863 | //アイコンリソースDLLをマッピング
|
---|
864 | sprintf(temporary,"%sSubOperation\\icon_res.dll",pj_editor_Dir);
|
---|
865 | hIconResInst=LoadLibrary(temporary);
|
---|
866 |
|
---|
867 | //LuxCtrl.dllをマッピング
|
---|
868 | sprintf(temporary,"%sSubOperation\\LuxCtrl.dll",pj_editor_Dir);
|
---|
869 | hLib_LuxCtrl=LoadLibrary(temporary);
|
---|
870 | if(!hLib_LuxCtrl){
|
---|
871 | MessageBox(0,"LuxCtrl.dllの読み込みに失敗しました。",APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
|
---|
872 | return 0;
|
---|
873 | }
|
---|
874 | LuxToolbar_CreateInstance=
|
---|
875 | (PROC_LuxToolbar_CreateInstance)GetProcAddress(hLib_LuxCtrl,"LuxToolbar_CreateInstance");
|
---|
876 |
|
---|
877 |
|
---|
878 | //モジュールディレクトリを取得
|
---|
879 | GetModuleFileName(hInst,temporary,MAX_PATH);
|
---|
880 | _splitpath(temporary,pj_editor_Dir,str,NULL,NULL);
|
---|
881 | lstrcat(pj_editor_Dir,str);
|
---|
882 |
|
---|
883 | //ヒープオブジェクトを作成
|
---|
884 | extern HANDLE hHeap;
|
---|
885 | hHeap=HeapCreate(HEAP_GENERATE_EXCEPTIONS,0,0);
|
---|
886 |
|
---|
887 |
|
---|
888 | //自動バックアップ用のディレクトリを生成
|
---|
889 | CreateBackupDir();
|
---|
890 |
|
---|
891 |
|
---|
892 | //COMを初期化
|
---|
893 | CoInitialize(0);
|
---|
894 |
|
---|
895 | //スクリーンサイズを取得
|
---|
896 | ScreenX=GetSystemMetrics(SM_CXSCREEN);
|
---|
897 | ScreenY=GetSystemMetrics(SM_CYSCREEN);
|
---|
898 |
|
---|
899 | //コンパイラ名をセット(デフォルトはWin32)
|
---|
900 | extern char *lpszCompilerName;
|
---|
901 | lpszCompilerName=WIN32_COMPILER_NAME;
|
---|
902 |
|
---|
903 | //不揮発性のデータを取得
|
---|
904 | pobj_nv=new CNonVolatile;
|
---|
905 | pobj_nv->load();
|
---|
906 |
|
---|
907 |
|
---|
908 | //アルファブレンド用のAPIを取得
|
---|
909 | extern FWINLAYER SetLayeredWindowAttributes;
|
---|
910 | extern HINSTANCE hUser32Lib;
|
---|
911 | hUser32Lib=LoadLibrary("user32.dll");
|
---|
912 | SetLayeredWindowAttributes=(FWINLAYER)GetProcAddress(hUser32Lib,"SetLayeredWindowAttributes");
|
---|
913 |
|
---|
914 |
|
---|
915 |
|
---|
916 |
|
---|
917 | /////////////////////
|
---|
918 | // フォントを定義
|
---|
919 | /////////////////////
|
---|
920 |
|
---|
921 | //パラメータ ヒント フォント
|
---|
922 | extern METHODCHECKINFO MethodCheckInfo;
|
---|
923 | MethodCheckInfo.hFont=CreateFontIndirect(&MethodCheckInfo.LogFont);
|
---|
924 | i=MethodCheckInfo.LogFont.lfWeight;
|
---|
925 | MethodCheckInfo.LogFont.lfWeight=FW_BOLD;
|
---|
926 | MethodCheckInfo.hBoldFont=CreateFontIndirect(&MethodCheckInfo.LogFont);
|
---|
927 | MethodCheckInfo.LogFont.lfWeight=i;
|
---|
928 |
|
---|
929 | //ステータスバー フォント
|
---|
930 | LOGFONT LogFont;
|
---|
931 | extern HFONT hStatusFont;
|
---|
932 | LogFont.lfHeight=-12;
|
---|
933 | LogFont.lfWidth=0;
|
---|
934 | LogFont.lfEscapement=0;
|
---|
935 | LogFont.lfOrientation=0;
|
---|
936 | LogFont.lfWeight=FW_REGULAR;
|
---|
937 | LogFont.lfItalic=NULL;
|
---|
938 | LogFont.lfUnderline=NULL;
|
---|
939 | LogFont.lfStrikeOut=NULL;
|
---|
940 | LogFont.lfCharSet=SHIFTJIS_CHARSET;
|
---|
941 | LogFont.lfOutPrecision=OUT_STRING_PRECIS;
|
---|
942 | LogFont.lfClipPrecision=CLIP_STROKE_PRECIS;
|
---|
943 | LogFont.lfQuality=DRAFT_QUALITY;
|
---|
944 | LogFont.lfPitchAndFamily=VARIABLE_PITCH;
|
---|
945 | sprintf(LogFont.lfFaceName,"MS Pゴシック");
|
---|
946 | hStatusFont=CreateFontIndirect(&LogFont);
|
---|
947 |
|
---|
948 | //ハイパーリンク フォント
|
---|
949 | extern HFONT hHyperLinkFont;
|
---|
950 | LogFont.lfHeight=-12;
|
---|
951 | LogFont.lfWidth=0;
|
---|
952 | LogFont.lfEscapement=0;
|
---|
953 | LogFont.lfOrientation=0;
|
---|
954 | LogFont.lfWeight=FW_REGULAR;
|
---|
955 | LogFont.lfItalic=NULL;
|
---|
956 | LogFont.lfUnderline=TRUE;
|
---|
957 | LogFont.lfStrikeOut=NULL;
|
---|
958 | LogFont.lfCharSet=SHIFTJIS_CHARSET;
|
---|
959 | LogFont.lfOutPrecision=OUT_STRING_PRECIS;
|
---|
960 | LogFont.lfClipPrecision=CLIP_STROKE_PRECIS;
|
---|
961 | LogFont.lfQuality=DRAFT_QUALITY;
|
---|
962 | LogFont.lfPitchAndFamily=VARIABLE_PITCH;
|
---|
963 | sprintf(LogFont.lfFaceName,"MS Pゴシック");
|
---|
964 | hHyperLinkFont=CreateFontIndirect(&LogFont);
|
---|
965 |
|
---|
966 | //ルーラー フォント
|
---|
967 | extern HFONT hRulerFont;
|
---|
968 | LogFont.lfHeight=-10;
|
---|
969 | LogFont.lfWidth=0;
|
---|
970 | LogFont.lfEscapement=0;
|
---|
971 | LogFont.lfOrientation=0;
|
---|
972 | LogFont.lfWeight=FW_REGULAR;
|
---|
973 | LogFont.lfItalic=NULL;
|
---|
974 | LogFont.lfUnderline=0;
|
---|
975 | LogFont.lfStrikeOut=NULL;
|
---|
976 | LogFont.lfCharSet=SHIFTJIS_CHARSET;
|
---|
977 | LogFont.lfOutPrecision=OUT_STRING_PRECIS;
|
---|
978 | LogFont.lfClipPrecision=CLIP_STROKE_PRECIS;
|
---|
979 | LogFont.lfQuality=DRAFT_QUALITY;
|
---|
980 | LogFont.lfPitchAndFamily=VARIABLE_PITCH;
|
---|
981 | sprintf(LogFont.lfFaceName,"MS ゴシック");
|
---|
982 | hRulerFont=CreateFontIndirect(&LogFont);
|
---|
983 |
|
---|
984 | //行番号の描画用
|
---|
985 | extern HFONT hFont_LineNumber;
|
---|
986 | LogFont.lfHeight=-11;
|
---|
987 | LogFont.lfWidth=0;
|
---|
988 | LogFont.lfEscapement=0;
|
---|
989 | LogFont.lfOrientation=0;
|
---|
990 | LogFont.lfWeight=FW_BOLD;
|
---|
991 | LogFont.lfItalic=NULL;
|
---|
992 | LogFont.lfUnderline=NULL;
|
---|
993 | LogFont.lfStrikeOut=NULL;
|
---|
994 | LogFont.lfCharSet=ANSI_CHARSET;
|
---|
995 | LogFont.lfOutPrecision=OUT_STRING_PRECIS;
|
---|
996 | LogFont.lfClipPrecision=CLIP_STROKE_PRECIS;
|
---|
997 | LogFont.lfQuality=DRAFT_QUALITY;
|
---|
998 | LogFont.lfPitchAndFamily=VARIABLE_PITCH;
|
---|
999 | sprintf(LogFont.lfFaceName,"Courier New");
|
---|
1000 | hFont_LineNumber=CreateFontIndirect(&LogFont);
|
---|
1001 |
|
---|
1002 | //メニューフォント
|
---|
1003 | NONCLIENTMETRICS NCMetrics;
|
---|
1004 | NCMetrics.cbSize = sizeof( NONCLIENTMETRICS );
|
---|
1005 | SystemParametersInfo( SPI_GETNONCLIENTMETRICS, sizeof( NONCLIENTMETRICS ), &NCMetrics, 0 );
|
---|
1006 | hMenuFont=CreateFontIndirect(&NCMetrics.lfMenuFont);
|
---|
1007 |
|
---|
1008 |
|
---|
1009 |
|
---|
1010 | //背景ブラシ
|
---|
1011 | extern HBRUSH h3DFaceBackBrush;
|
---|
1012 | h3DFaceBackBrush=CreateSolidBrush(GetSysColor(COLOR_3DFACE));
|
---|
1013 |
|
---|
1014 | //アイコン
|
---|
1015 | extern HICON hOwnerIcon,hBasicProgramIcon,hTextDocumentIcon,hWindowDocumentIcon;
|
---|
1016 | hOwnerIcon=(HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_MAIN),IMAGE_ICON,16,16,LR_DEFAULTCOLOR);
|
---|
1017 | hBasicProgramIcon=(HICON)LoadImage(hResInst,MAKEINTRESOURCE(IDI_BASICPROGRAM),IMAGE_ICON,16,16,LR_DEFAULTCOLOR);
|
---|
1018 | hTextDocumentIcon=(HICON)LoadImage(hResInst,MAKEINTRESOURCE(IDI_TEXTDOCUMENT),IMAGE_ICON,16,16,LR_DEFAULTCOLOR);
|
---|
1019 | hWindowDocumentIcon=(HICON)LoadImage(hResInst,MAKEINTRESOURCE(IDI_WINDOW),IMAGE_ICON,16,16,LR_DEFAULTCOLOR);
|
---|
1020 |
|
---|
1021 |
|
---|
1022 |
|
---|
1023 |
|
---|
1024 | //メインメニュー
|
---|
1025 | pobj_MainMenu=new CMenuEx(LoadMenu(hResInst,MAKEINTRESOURCE(IDR_MAINMENU)));
|
---|
1026 |
|
---|
1027 | pobj_MainMenu->InitOwnerDraw(1); //オーナー描画の初期化
|
---|
1028 |
|
---|
1029 | CSubMenuEx *pobj_FileMenu;
|
---|
1030 | pobj_FileMenu=pobj_MainMenu->ppobj_MenuItemData[0]->pobj_SubMenu;
|
---|
1031 |
|
---|
1032 | //未完成
|
---|
1033 | extern HMENU hFirstMainMenu;
|
---|
1034 | hFirstMainMenu=0;
|
---|
1035 |
|
---|
1036 | //「最近使ったファイル」サブメニューを取得(と同時にも正規のメニュー文字列を指定)
|
---|
1037 | for(i=0;i<pobj_FileMenu->iMenuItemNum;i++){
|
---|
1038 | if(pobj_FileMenu->ppobj_MenuItemData[i]->str){
|
---|
1039 | if(lstrcmp(pobj_FileMenu->ppobj_MenuItemData[i]->str,"FileHistory")==0){
|
---|
1040 | pobj_FileMenu->RenameMenuItem(i,"最近使ったファイル(&F)");
|
---|
1041 |
|
---|
1042 | extern CSubMenuEx *pobj_FileHistoryMenu;
|
---|
1043 | pobj_FileHistoryMenu=pobj_FileMenu->ppobj_MenuItemData[i]->pobj_SubMenu;
|
---|
1044 | }
|
---|
1045 |
|
---|
1046 | #ifndef THETEXT
|
---|
1047 | //「最近使ったプロジェクト」サブメニューを取得(と同時にも正規のメニュー文字列を指定)
|
---|
1048 | //※ProjectEditorのみ
|
---|
1049 | if(lstrcmp(pobj_FileMenu->ppobj_MenuItemData[i]->str,"ProjectHistory")==0){
|
---|
1050 | pobj_FileMenu->RenameMenuItem(i,"最近使ったプロジェクト(&J)");
|
---|
1051 |
|
---|
1052 | extern CSubMenuEx *pobj_ProjectHistoryMenu;
|
---|
1053 | pobj_ProjectHistoryMenu=pobj_FileMenu->ppobj_MenuItemData[i]->pobj_SubMenu;
|
---|
1054 | }
|
---|
1055 | #endif
|
---|
1056 | }
|
---|
1057 | }
|
---|
1058 |
|
---|
1059 | #define ICONSET(itemID,iconID) pobj_MainMenu->SetIcon(itemID,(HICON)LoadImage(hIconResInst,MAKEINTRESOURCE(iconID),IMAGE_ICON,16,16,0));
|
---|
1060 | //メニューアイコンをセット
|
---|
1061 |
|
---|
1062 | //ファイル
|
---|
1063 | ICONSET(IDM_NEW,IDI_NEW);
|
---|
1064 | ICONSET(IDM_OPEN,IDI_OPEN);
|
---|
1065 | ICONSET(IDM_SAVE,IDI_SAVE);
|
---|
1066 | ICONSET(IDM_ALLSAVE,IDI_ALLSAVE);
|
---|
1067 | ICONSET(IDM_PREVIEW,IDI_PREVIEW);
|
---|
1068 | ICONSET(IDM_PRINTOUT,IDI_PRINT);
|
---|
1069 |
|
---|
1070 | //編集
|
---|
1071 | ICONSET(IDM_CUT,IDI_CUT);
|
---|
1072 | ICONSET(IDM_COPY,IDI_COPY);
|
---|
1073 | ICONSET(IDM_PASTE,IDI_PASTE);
|
---|
1074 | ICONSET(IDM_UNDO,IDI_UNDO);
|
---|
1075 | ICONSET(IDM_REDO,IDI_REDO);
|
---|
1076 | ICONSET(IDM_FIND,IDI_FIND);
|
---|
1077 |
|
---|
1078 | //表示
|
---|
1079 | ICONSET(IDM_SET,IDI_OPTION);
|
---|
1080 |
|
---|
1081 | //変換
|
---|
1082 | ICONSET(IDM_CONV_ALPHA_SMALL,IDI_CONV_ALPHA_SMALL);
|
---|
1083 | ICONSET(IDM_CONV_ALPHA_BIG,IDI_CONV_ALPHA_BIG);
|
---|
1084 | ICONSET(IDM_CONV_HALF,IDI_CONV_HALF);
|
---|
1085 | ICONSET(IDM_CONV_MULTI,IDI_CONV_MULTI);
|
---|
1086 | ICONSET(IDM_CONV_KATAKANA,IDI_CONV_KATAKANA);
|
---|
1087 | ICONSET(IDM_CONV_HIRAGANA,IDI_CONV_HIRAGANA);
|
---|
1088 |
|
---|
1089 | //ヘルプ
|
---|
1090 | ICONSET(IDM_TOPIC,IDI_HELP);
|
---|
1091 |
|
---|
1092 | #ifdef THETEXT
|
---|
1093 | //TheTextのみの機能
|
---|
1094 | ICONSET(IDM_STRING_COUNT,IDI_STRINGCOUNT);
|
---|
1095 | #else
|
---|
1096 | //ProjectEditorのみの機能
|
---|
1097 |
|
---|
1098 | //リリース
|
---|
1099 | ICONSET(IDM_RELEASECOMPILE,IDI_RELEASECOMPILE);
|
---|
1100 | ICONSET(IDM_RELEASERUN,IDI_RELEASERUN);
|
---|
1101 |
|
---|
1102 | //デバッグ
|
---|
1103 | ICONSET(IDM_ATTACH,IDI_ATTACH);
|
---|
1104 | ICONSET(IDM_DEBUGCOMPILE,IDI_DEBUGCOMPILE);
|
---|
1105 | ICONSET(IDM_DEBUG,IDI_DEBUGRUN);
|
---|
1106 | ICONSET(IDM_BREAKPOINT,IDI_BREAKPOINT);
|
---|
1107 | ICONSET(IDM_STEP_IN,IDI_STEPIN);
|
---|
1108 | ICONSET(IDM_STEP_OVER,IDI_STEPOVER);
|
---|
1109 | ICONSET(IDM_STEP_CURSOR,IDI_STEPTOCURSOR);
|
---|
1110 | ICONSET(IDM_DEBUG_PAUSE,IDI_DEBUGPAUSE);
|
---|
1111 | ICONSET(IDM_DEBUG_STOP,IDI_DEBUGSTOP);
|
---|
1112 |
|
---|
1113 | //コミュニティ
|
---|
1114 | ICONSET(IDM_COMMUNITY,IDI_COMMUNITY_MAIN);
|
---|
1115 | ICONSET(IDM_COMMU_SEARCH,IDI_COMMUNITY_FIND);
|
---|
1116 | ICONSET(IDM_COMMU_PM,IDI_COMMUNITY_PRIVATEMSG);
|
---|
1117 | ICONSET(ID_COMMU_FORUM1,IDI_COMMUNITY_FORUM);
|
---|
1118 | ICONSET(ID_COMMU_FORUM2,IDI_COMMUNITY_FORUM);
|
---|
1119 | ICONSET(ID_COMMU_FORUM3,IDI_COMMUNITY_FORUM);
|
---|
1120 | ICONSET(ID_COMMU_FORUM4,IDI_COMMUNITY_FORUM);
|
---|
1121 | ICONSET(ID_COMMU_FORUM5,IDI_COMMUNITY_FORUM);
|
---|
1122 | ICONSET(ID_COMMU_FORUM6,IDI_COMMUNITY_FORUM_SECRET);
|
---|
1123 | ICONSET(ID_COMMU_FORUM7,IDI_COMMUNITY_FORUM);
|
---|
1124 | ICONSET(ID_COMMU_FORUM8,IDI_COMMUNITY_FORUM);
|
---|
1125 | #endif
|
---|
1126 |
|
---|
1127 | #undef ICONSET
|
---|
1128 |
|
---|
1129 |
|
---|
1130 |
|
---|
1131 |
|
---|
1132 | extern HMENU hEditMenuBase,hEditMenu;
|
---|
1133 | hEditMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_EDITMENU));
|
---|
1134 | hEditMenu=GetSubMenu(hEditMenuBase,0);
|
---|
1135 |
|
---|
1136 | extern HMENU hRebarMenuBase,hRebarMenu;
|
---|
1137 | hRebarMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_REBARMENU));
|
---|
1138 | hRebarMenu=GetSubMenu(hRebarMenuBase,0);
|
---|
1139 |
|
---|
1140 | extern HMENU hTabMenuBase,hTabMenu,hTabColorMenu;
|
---|
1141 | hTabMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_TABMENU));
|
---|
1142 | hTabMenu=GetSubMenu(hTabMenuBase,0);
|
---|
1143 | hTabColorMenu=GetSubMenu(hTabMenu,0);
|
---|
1144 |
|
---|
1145 | extern HMENU hFileTreeMenuBase;
|
---|
1146 | hFileTreeMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_PROJECTVIEW_FILETREEMENU));
|
---|
1147 |
|
---|
1148 | extern HMENU hProcedureTreeMenuBase;
|
---|
1149 | hProcedureTreeMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_PROJECTVIEW_PROCEDURETREEMENU));
|
---|
1150 |
|
---|
1151 | extern HMENU hMaterialTreeMenuBase;
|
---|
1152 | hMaterialTreeMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_PROJECTVIEW_MATERIALTREEMENU));
|
---|
1153 |
|
---|
1154 | extern HMENU hRadMenuBase;
|
---|
1155 | hRadMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_RADCONTEXTMENU));
|
---|
1156 |
|
---|
1157 | //クリップボードのデータ形式(RAD用)を新規登録
|
---|
1158 | extern DWORD dwRadClipboardID;
|
---|
1159 | dwRadClipboardID=RegisterClipboardFormat("ProjectEditor-RAD");
|
---|
1160 |
|
---|
1161 | //256色の標準パレットを読み込む
|
---|
1162 | extern RGBQUAD DefaultColorTable256[256];
|
---|
1163 | HANDLE hFile;
|
---|
1164 | DWORD dw;
|
---|
1165 | sprintf(temporary,"%sSubOperation\\8bit.plt",pj_editor_Dir);
|
---|
1166 | hFile=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
|
---|
1167 | if(hFile==INVALID_HANDLE_VALUE){
|
---|
1168 | //"\"%s\" ファイルの読み込みに失敗しました。"
|
---|
1169 | sprintf(str,STRING_ERROR_CANT_FILEOPEN,temporary);
|
---|
1170 | MessageBox(NULL,str,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
|
---|
1171 | return 0;
|
---|
1172 | }
|
---|
1173 | ReadFile(hFile,DefaultColorTable256,sizeof(RGBQUAD)*256,&dw,NULL);
|
---|
1174 | CloseHandle(hFile);
|
---|
1175 |
|
---|
1176 |
|
---|
1177 |
|
---|
1178 | //デザインテーマオブジェクトを生成
|
---|
1179 | pobj_DBTheme=new CDBTheme();
|
---|
1180 |
|
---|
1181 |
|
---|
1182 | /////////////////////////
|
---|
1183 | // カラーデザインを設定
|
---|
1184 | CTheme *pobj_Theme;
|
---|
1185 | pobj_Theme=pobj_DBTheme->GetActiveTheme();
|
---|
1186 | if(!pobj_Theme) pobj_Theme=pobj_DBTheme->ppobj_Theme[0];
|
---|
1187 |
|
---|
1188 | SetTextEditColorDesign(&tci,pobj_Theme,0);
|
---|
1189 |
|
---|
1190 |
|
---|
1191 | #ifndef THETEXT
|
---|
1192 | /////////////////////////////////////////////////////
|
---|
1193 | // ProjectEditorのみ
|
---|
1194 | /////////////////////////////////////////////////////
|
---|
1195 |
|
---|
1196 |
|
---|
1197 | //クラスビュー管理オブジェクトを生成
|
---|
1198 | pobj_ClassTreeView=new CClassTreeView();
|
---|
1199 |
|
---|
1200 |
|
---|
1201 | /////////////////////////
|
---|
1202 | // basic.sbpの内容を取得
|
---|
1203 | /////////////////////////
|
---|
1204 |
|
---|
1205 | extern char *pHeaderBuf;
|
---|
1206 | sprintf(temporary,"%sInclude\\basic.sbp",pj_editor_Dir);
|
---|
1207 | pHeaderBuf=ReadBuffer(temporary);
|
---|
1208 |
|
---|
1209 | //ファイルをインクルード
|
---|
1210 | pHeaderBuf=IncludeFiles(pHeaderBuf);
|
---|
1211 |
|
---|
1212 |
|
---|
1213 | //デバッガ管理オブジェクトを生成
|
---|
1214 | pobj_Debugger=new CDebugger();
|
---|
1215 | #endif
|
---|
1216 |
|
---|
1217 |
|
---|
1218 | //ブレークポイント管理オブジェクトを生成
|
---|
1219 | extern CDBBreakPoint *pobj_DBBreakPoint;
|
---|
1220 | pobj_DBBreakPoint=new CDBBreakPoint();
|
---|
1221 |
|
---|
1222 |
|
---|
1223 | return 1;
|
---|
1224 | }
|
---|
1225 | void EndProjectEditor(void){
|
---|
1226 |
|
---|
1227 | #ifndef THETEXT
|
---|
1228 | /////////////////////////////////////////////////////
|
---|
1229 | // ProjectEditorのみ
|
---|
1230 | /////////////////////////////////////////////////////
|
---|
1231 |
|
---|
1232 |
|
---|
1233 | //クラスビュー管理オブジェクトを破棄
|
---|
1234 | delete pobj_ClassTreeView;
|
---|
1235 | pobj_ClassTreeView=0;
|
---|
1236 |
|
---|
1237 | //basic.sbpのソースコードバッファを解放
|
---|
1238 | extern char *pHeaderBuf;
|
---|
1239 | HeapDefaultFree(pHeaderBuf);
|
---|
1240 |
|
---|
1241 | //デバッガ管理オブジェクトを破棄
|
---|
1242 | delete pobj_Debugger;
|
---|
1243 | #endif
|
---|
1244 |
|
---|
1245 | //ブレークポイント管理オブジェクトを破棄
|
---|
1246 | extern CDBBreakPoint *pobj_DBBreakPoint;
|
---|
1247 | delete pobj_DBBreakPoint;
|
---|
1248 |
|
---|
1249 | //デザインテーマオブジェクトを破棄
|
---|
1250 | delete pobj_DBTheme;
|
---|
1251 |
|
---|
1252 | //不揮発性のデータを保存
|
---|
1253 | pobj_nv->save();
|
---|
1254 | delete pobj_nv;
|
---|
1255 | pobj_nv=0;
|
---|
1256 |
|
---|
1257 | //メインメニューオブジェクトを破棄
|
---|
1258 | delete pobj_MainMenu;
|
---|
1259 | pobj_MainMenu=0;
|
---|
1260 |
|
---|
1261 | extern HFONT hStatusFont;
|
---|
1262 | DeleteObject(hStatusFont);
|
---|
1263 | extern HFONT hHyperLinkFont;
|
---|
1264 | DeleteObject(hHyperLinkFont);
|
---|
1265 | extern HFONT hRulerFont;
|
---|
1266 | DeleteObject(hRulerFont);
|
---|
1267 | extern HFONT hFont_LineNumber;
|
---|
1268 | DeleteObject(hFont_LineNumber);
|
---|
1269 | extern METHODCHECKINFO MethodCheckInfo;
|
---|
1270 | DeleteObject(MethodCheckInfo.hFont);
|
---|
1271 | DeleteObject(MethodCheckInfo.hBoldFont);
|
---|
1272 | extern HICON hOwnerIcon,hBasicProgramIcon,hTextDocumentIcon,hWindowDocumentIcon;
|
---|
1273 | DestroyIcon(hOwnerIcon);
|
---|
1274 | DestroyIcon(hBasicProgramIcon);
|
---|
1275 | DestroyIcon(hTextDocumentIcon);
|
---|
1276 | DestroyIcon(hWindowDocumentIcon);
|
---|
1277 | extern HMENU hEditMenuBase,hRebarMenuBase,hTabMenuBase;
|
---|
1278 | DestroyMenu(hEditMenuBase);
|
---|
1279 | DestroyMenu(hRebarMenuBase);
|
---|
1280 | DestroyMenu(hTabMenuBase);
|
---|
1281 | extern HMENU hFileTreeMenuBase;
|
---|
1282 | DestroyMenu(hFileTreeMenuBase);
|
---|
1283 | extern HMENU hProcedureTreeMenuBase;
|
---|
1284 | DestroyMenu(hProcedureTreeMenuBase);
|
---|
1285 | extern HMENU hMaterialTreeMenuBase;
|
---|
1286 | DestroyMenu(hMaterialTreeMenuBase);
|
---|
1287 | extern HMENU hRadMenuBase;
|
---|
1288 | DestroyMenu(hRadMenuBase);
|
---|
1289 |
|
---|
1290 | //背景ブラシ
|
---|
1291 | extern HBRUSH h3DFaceBackBrush;
|
---|
1292 | DeleteObject(h3DFaceBackBrush);
|
---|
1293 |
|
---|
1294 | //スタンダードツールバーを破棄
|
---|
1295 | if(pobj_StandardToolbar){
|
---|
1296 | pobj_StandardToolbar->Release();
|
---|
1297 | pobj_StandardToolbar=0;
|
---|
1298 | }
|
---|
1299 |
|
---|
1300 | //ビルドツールバーを破棄
|
---|
1301 | if(pobj_ReleaseToolbar){
|
---|
1302 | pobj_ReleaseToolbar->Release();
|
---|
1303 | pobj_ReleaseToolbar=0;
|
---|
1304 | }
|
---|
1305 |
|
---|
1306 | //デバッガ用ツールバーを破棄
|
---|
1307 | if(pobj_DebuggerToolbar){
|
---|
1308 | pobj_DebuggerToolbar->Release();
|
---|
1309 | pobj_DebuggerToolbar=0;
|
---|
1310 | }
|
---|
1311 |
|
---|
1312 | //ヒープオブジェクトを解放
|
---|
1313 | extern HANDLE hHeap;
|
---|
1314 | HeapDestroy(hHeap);
|
---|
1315 |
|
---|
1316 | //DLLを解放
|
---|
1317 | FreeLibrary(hResInst);
|
---|
1318 | FreeLibrary(hIconResInst);
|
---|
1319 | FreeLibrary(hLib_LuxCtrl);
|
---|
1320 |
|
---|
1321 | //アルファブレンド用のAPIを解放
|
---|
1322 | extern HINSTANCE hUser32Lib;
|
---|
1323 | FreeLibrary(hUser32Lib);
|
---|
1324 |
|
---|
1325 |
|
---|
1326 |
|
---|
1327 |
|
---|
1328 | //////////////////////////////////////
|
---|
1329 | // バックアップ用ファイルを削除
|
---|
1330 | //////////////////////////////////////
|
---|
1331 | extern char szBackupDirPath[MAX_PATH];
|
---|
1332 | RemoveDirectoryStrong(szBackupDirPath);
|
---|
1333 |
|
---|
1334 | }
|
---|
1335 |
|
---|
1336 | //各ウィンドウ生成
|
---|
1337 | void SetupWindow(HWND hwnd){
|
---|
1338 | extern HINSTANCE hInst;
|
---|
1339 | extern HMENU hFirstMainMenu;
|
---|
1340 | RECT rect;
|
---|
1341 | CLIENTCREATESTRUCT ccs;
|
---|
1342 |
|
---|
1343 | INITCOMMONCONTROLSEX InitCommCtrl;
|
---|
1344 | InitCommCtrl.dwSize=sizeof(INITCOMMONCONTROLSEX);
|
---|
1345 | InitCommCtrl.dwICC=ICC_COOL_CLASSES|ICC_PAGESCROLLER_CLASS|ICC_WIN95_CLASSES|ICC_TAB_CLASSES;
|
---|
1346 | InitCommonControlsEx(&InitCommCtrl);
|
---|
1347 |
|
---|
1348 | //タブウィンドウ
|
---|
1349 | pobj_MainTab=new CMainTab(hwnd);
|
---|
1350 |
|
---|
1351 | //MDIの親ウィンドウ(クライアントウィンドウ)を作成
|
---|
1352 | ccs.hWindowMenu=hFirstMainMenu;
|
---|
1353 | ccs.idFirstChild=ID_FIRSTCHILD;
|
---|
1354 | GetClientRect(hwnd,&rect);
|
---|
1355 | hClient=CreateWindowEx(WS_EX_CLIENTEDGE,"MDICLIENT",NULL,
|
---|
1356 | WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_VISIBLE,
|
---|
1357 | 0,0,0,0,
|
---|
1358 | hwnd,(HMENU)1,hInst,(LPSTR)&ccs);
|
---|
1359 |
|
---|
1360 | //レバーオブジェクトを生成
|
---|
1361 | pobj_Rebar=new CMainRebar(hwnd);
|
---|
1362 |
|
---|
1363 | //ステータスバー
|
---|
1364 | extern HWND hStatusBar;
|
---|
1365 | extern HFONT hStatusFont;
|
---|
1366 | hStatusBar=CreateStatusWindow(
|
---|
1367 | WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBARS_SIZEGRIP|CCS_BOTTOM,
|
---|
1368 | NULL,hwnd,NULL);
|
---|
1369 | SendMessage(hStatusBar,WM_SETFONT,(long)hStatusFont,0);
|
---|
1370 |
|
---|
1371 | //プロジェクト ビュー
|
---|
1372 | extern HWND hProjectView;
|
---|
1373 | extern HWND hProjectView_ToolWindow;
|
---|
1374 | RECT *prc;
|
---|
1375 | prc=&pobj_nv->rectProjectView;
|
---|
1376 | hProjectView_ToolWindow=CreateWindowEx(WS_EX_TOOLWINDOW,"ProjectView_ToolWindow","ProjectView",
|
---|
1377 | WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_CLIPCHILDREN,
|
---|
1378 | prc->left,prc->top,prc->right-prc->left,prc->bottom-prc->top,
|
---|
1379 | hwnd,0,hInst,0);
|
---|
1380 | hProjectView=CreateWindowEx(WS_EX_STATICEDGE,"ProjectView","ProjectView",
|
---|
1381 | WS_CHILD|WS_CLIPCHILDREN,
|
---|
1382 | 0,0,0,0,
|
---|
1383 | hwnd,0,hInst,0);
|
---|
1384 | if(pobj_nv->bClipProjectView==0){
|
---|
1385 | SetWindowLong(hProjectView,GWL_EXSTYLE,0);
|
---|
1386 | SetParent(hProjectView,hProjectView_ToolWindow);
|
---|
1387 | ResizeProjectView_ToolWindow();
|
---|
1388 | }
|
---|
1389 |
|
---|
1390 | //メニュー状態を設定
|
---|
1391 | ResetState_DocMenu();
|
---|
1392 |
|
---|
1393 |
|
---|
1394 | //SideWebを生成
|
---|
1395 | pobj_SideWeb=new CSideWeb(hwnd);
|
---|
1396 | }
|
---|
1397 |
|
---|
1398 | //実行コマンド
|
---|
1399 | BOOL SetRunning(HWND hChild){
|
---|
1400 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
1401 | extern LPSTR DefFileFilter;
|
---|
1402 | int WndNum;
|
---|
1403 | char temporary[MAX_PATH],temp2[MAX_PATH];
|
---|
1404 | HANDLE hFind;
|
---|
1405 | WIN32_FIND_DATA wfd;
|
---|
1406 |
|
---|
1407 | extern char *lpszCompilerName;
|
---|
1408 | sprintf(temporary,"%s%s",pj_editor_Dir,lpszCompilerName);
|
---|
1409 | hFind=FindFirstFile(temporary,&wfd);
|
---|
1410 | if(hFind==INVALID_HANDLE_VALUE){
|
---|
1411 | //"BasicCompiler.exe が見つかりません"
|
---|
1412 | MessageBox(hOwner,STRING_ERROR_NOBASICCOMPILER,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
|
---|
1413 | return FALSE;
|
---|
1414 | }
|
---|
1415 | FindClose(hFind);
|
---|
1416 |
|
---|
1417 | WndNum=GetWndNum(hChild);
|
---|
1418 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){
|
---|
1419 | if(MdiInfo[WndNum].path[0]=='\0'){
|
---|
1420 | //"保存先のファイルを指定してください"
|
---|
1421 | if(!GetFilePathDialog(hOwner,temp2,DefFileFilter,STRING_FILESAVETITLE_DEFAULT,0)) return FALSE;
|
---|
1422 |
|
---|
1423 | if(!SaveDocument(hChild,temp2)) return 0;
|
---|
1424 | }
|
---|
1425 | else{
|
---|
1426 | if( MdiInfo[WndNum].pMdiTextEdit->IsModified() ){
|
---|
1427 | if(!SaveDocument(hChild,NULL)) return 0;
|
---|
1428 | }
|
---|
1429 | else{
|
---|
1430 | if(hFind=FindFirstFile(MdiInfo[WndNum].path,&wfd)){
|
---|
1431 | if(hFind==INVALID_HANDLE_VALUE){
|
---|
1432 | if(!SaveDocument(hChild,NULL)) return 0;
|
---|
1433 | }
|
---|
1434 | else FindClose(hFind);
|
---|
1435 | }
|
---|
1436 | }
|
---|
1437 | }
|
---|
1438 | }
|
---|
1439 | return 1;
|
---|
1440 | }
|
---|
1441 |
|
---|
1442 | BOOL IsNeedCompile(char *FileName,BOOL bDebug){
|
---|
1443 | char temporary[MAX_PATH],temp2[MAX_PATH],temp3[MAX_PATH];
|
---|
1444 | HANDLE hFind,hFile;
|
---|
1445 | WIN32_FIND_DATA wfd;
|
---|
1446 | FILETIME SourceTime,ExeTime;
|
---|
1447 |
|
---|
1448 | _splitpath(FileName,temporary,temp2,temp3,NULL);
|
---|
1449 | lstrcat(temporary,temp2);
|
---|
1450 | lstrcat(temporary,temp3);
|
---|
1451 | if(bDebug) lstrcat(temporary,"_debug.exe");
|
---|
1452 | else lstrcat(temporary,".exe");
|
---|
1453 |
|
---|
1454 | hFind=FindFirstFile(temporary,&wfd);
|
---|
1455 | if(hFind==INVALID_HANDLE_VALUE) return 1;
|
---|
1456 | FindClose(hFind);
|
---|
1457 |
|
---|
1458 | hFile=CreateFile(FileName,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
|
---|
1459 | GetFileTime(hFile,NULL,NULL,&SourceTime);
|
---|
1460 | CloseHandle(hFile);
|
---|
1461 |
|
---|
1462 | hFile=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
|
---|
1463 | GetFileTime(hFile,NULL,NULL,&ExeTime);
|
---|
1464 | CloseHandle(hFile);
|
---|
1465 |
|
---|
1466 | if(SourceTime.dwHighDateTime<ExeTime.dwHighDateTime) return 0;
|
---|
1467 | else if(SourceTime.dwHighDateTime==ExeTime.dwHighDateTime&&
|
---|
1468 | SourceTime.dwLowDateTime<=ExeTime.dwLowDateTime) return 0;
|
---|
1469 | return 1;
|
---|
1470 | }
|
---|