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 | }
|
---|
418 | else if(str[0]=='b'||str[0]=='B'){
|
---|
419 | if(lstrcmpi(str,"Beep")==0) return COM_BEEP;
|
---|
420 | }
|
---|
421 | else if(str[0]=='c'||str[0]=='C'){
|
---|
422 | if(lstrcmpi(str,"Case")==0) return -1;
|
---|
423 | if(lstrcmpi(str,"ChDir")==0) return COM_CHDIR;
|
---|
424 | if(lstrcmpi(str,"Circle")==0) return COM_CIRCLE;
|
---|
425 | if(lstrcmpi(str,"Class")==0) return COM_CLASS;
|
---|
426 | if(lstrcmpi(str,"Close")==0) return COM_CLOSE;
|
---|
427 | if(lstrcmpi(str,"Cls")==0) return COM_CLS;
|
---|
428 | if(lstrcmpi(str,"Color")==0) return COM_COLOR;
|
---|
429 | if(lstrcmpi(str,"Const")==0) return COM_CONST;
|
---|
430 | if(lstrcmpi(str,"Continue")==0) return -1;
|
---|
431 | }
|
---|
432 | else if(str[0]=='d'||str[0]=='D'){
|
---|
433 | if(lstrcmpi(str,"Debug")==0) return COM_DEBUG;
|
---|
434 | if(lstrcmpi(str,"Declare")==0) return COM_DECLARE;
|
---|
435 | if(lstrcmpi(str,"Def")==0) return COM_DEF;
|
---|
436 | if(lstrcmpi(str,"Delete")==0) return -1;
|
---|
437 | if(lstrcmpi(str,"DelWnd")==0) return COM_DELWND;
|
---|
438 | if(lstrcmpi(str,"Dim")==0) return COM_DIM;
|
---|
439 | if(lstrcmpi(str,"Do")==0) return COM_DO;
|
---|
440 | }
|
---|
441 | else if(str[0]=='e'||str[0]=='E'){
|
---|
442 | if(lstrcmpi(str,"Else")==0) return -1;
|
---|
443 | if(lstrcmpi(str,"ElseIf")==0) return -1;
|
---|
444 | if(lstrcmpi(str,"End")==0) return COM_END;
|
---|
445 | if(lstrcmpi(str,"EndIf")==0) return -1;
|
---|
446 | if(lstrcmpi(str,"EndFunction")==0) return -1;
|
---|
447 | if(lstrcmpi(str,"EndSub")==0) return -1;
|
---|
448 | if(lstrcmpi(str,"EndType")==0) return -1;
|
---|
449 | if(lstrcmpi(str,"EndSelect")==0) return -1;
|
---|
450 | if(lstrcmpi(str,"EndWith")==0) return -1;
|
---|
451 | if(lstrcmpi(str,"Enum")==0) return COM_ENUM;
|
---|
452 | if(lstrcmpi(str,"Exit")==0) return -1;
|
---|
453 | if(lstrcmpi(str,"ExitDo")==0) return -1;
|
---|
454 | if(lstrcmpi(str,"ExitFor")==0) return -1;
|
---|
455 | if(lstrcmpi(str,"ExitFunction")==0) return -1;
|
---|
456 | if(lstrcmpi(str,"ExitSub")==0) return -1;
|
---|
457 | if(lstrcmpi(str,"ExitWhile")==0) return -1;
|
---|
458 | }
|
---|
459 | else if(str[0]=='f'||str[0]=='F'){
|
---|
460 | if(lstrcmpi(str,"Field")==0) return COM_FIELD;
|
---|
461 | if(lstrcmpi(str,"For")==0) return COM_FOR;
|
---|
462 | if(lstrcmpi(str,"Function")==0) return COM_FUNCTION;
|
---|
463 | }
|
---|
464 | else if(str[0]=='g'||str[0]=='G'){
|
---|
465 | if(lstrcmpi(str,"Get")==0) return COM_GET;
|
---|
466 | if(lstrcmpi(str,"GoSub")==0) return COM_GOSUB;
|
---|
467 | if(lstrcmpi(str,"Goto")==0) return COM_GOTO;
|
---|
468 | }
|
---|
469 | else if(str[0]=='i'||str[0]=='I'){
|
---|
470 | if(lstrcmpi(str,"If")==0) return COM_IF;
|
---|
471 | if(lstrcmpi(str,"Inherits")==0) return COM_INHERITS;
|
---|
472 | if(lstrcmpi(str,"Input")==0) return COM_INPUT;
|
---|
473 | if(lstrcmpi(str,"Interface")==0) return COM_INTERFACE;
|
---|
474 | }
|
---|
475 | else if(str[0]=='k'||str[0]=='K'){
|
---|
476 | if(lstrcmpi(str,"Kill")==0) return COM_KILL;
|
---|
477 | }
|
---|
478 | else if(str[0]=='l'||str[0]=='L'){
|
---|
479 | if(lstrcmpi(str,"Let")==0) return COM_LET;
|
---|
480 | if(lstrcmpi(str,"Line")==0) return COM_LINE;
|
---|
481 | if(lstrcmpi(str,"Locate")==0) return COM_LOCATE;
|
---|
482 | if(lstrcmpi(str,"Loop")==0) return COM_LOOP;
|
---|
483 | }
|
---|
484 | else if(str[0]=='m'||str[0]=='M'){
|
---|
485 | if(lstrcmpi(str,"MkDir")==0) return COM_MKDIR;
|
---|
486 | if(lstrcmpi(str,"MsgBox")==0) return COM_MSGBOX;
|
---|
487 | }
|
---|
488 | else if(str[0]=='n'||str[0]=='N'){
|
---|
489 | if(lstrcmpi(str,"Next")==0) return COM_NEXT;
|
---|
490 | if(lstrcmpi(str,"New")==0) return -1;
|
---|
491 | }
|
---|
492 | else if(str[0]=='o'||str[0]=='O'){
|
---|
493 | if(lstrcmpi(str,"Open")==0) return COM_OPEN;
|
---|
494 | if(lstrcmpi(str,"Override")==0) return COM_OVERRIDE;
|
---|
495 | }
|
---|
496 | else if(str[0]=='p'||str[0]=='P'){
|
---|
497 | if(lstrcmpi(str,"Paint")==0) return COM_PAINT;
|
---|
498 | if(lstrcmpi(str,"Print")==0) return COM_PRINT;
|
---|
499 | if(lstrcmpi(str,"Private")==0) return COM_PRIVATE;
|
---|
500 | if(lstrcmpi(str,"Protected")==0) return COM_PROTECTED;
|
---|
501 | if(lstrcmpi(str,"PSet")==0) return COM_PSET;
|
---|
502 | if(lstrcmpi(str,"Put")==0) return COM_PUT;
|
---|
503 | if(lstrcmpi(str,"Public")==0) return COM_PUBLIC;
|
---|
504 | }
|
---|
505 | else if(str[0]=='r'||str[0]=='R'){
|
---|
506 | if(lstrcmpi(str,"Randomize")==0) return COM_RANDOMIZE;
|
---|
507 | if(lstrcmpi(str,"Rem")==0) return COM_REM;
|
---|
508 | if(lstrcmpi(str,"Return")==0) return COM_RETURN;
|
---|
509 | }
|
---|
510 | else if(str[0]=='s'||str[0]=='S'){
|
---|
511 | if(lstrcmpi(str,"Select")==0) return COM_SELECT;
|
---|
512 | if(lstrcmpi(str,"SelectCase")==0) return COM_SELECT;
|
---|
513 | if(lstrcmpi(str,"Sleep")==0) return COM_SLEEP;
|
---|
514 | if(lstrcmpi(str,"Static")==0) return -1;
|
---|
515 | if(lstrcmpi(str,"Sub")==0) return COM_SUB;
|
---|
516 | if(lstrcmpi(str,"Super")==0) return -1;
|
---|
517 | }
|
---|
518 | else if(str[0]=='t'||str[0]=='T'){
|
---|
519 | if(lstrcmpi(str,"Then")==0) return -1;
|
---|
520 | if(lstrcmpi(str,"Type")==0) return COM_TYPE;
|
---|
521 | if(lstrcmpi(str,"TypeDef")==0) return COM_TYPEDEF;
|
---|
522 | }
|
---|
523 | else if(str[0]=='u'||str[0]=='U'){
|
---|
524 | if(lstrcmpi(str,"Until")==0) return -1;
|
---|
525 | }
|
---|
526 | else if(str[0]=='v'||str[0]=='V'){
|
---|
527 | if(lstrcmpi(str,"Virtual")==0) return COM_VIRTUAL;
|
---|
528 | }
|
---|
529 | else if(str[0]=='w'||str[0]=='W'){
|
---|
530 | if(lstrcmpi(str,"Wend")==0) return COM_WEND;
|
---|
531 | if(lstrcmpi(str,"While")==0) return COM_WHILE;
|
---|
532 | if(lstrcmpi(str,"Window")==0) return COM_WINDOW;
|
---|
533 | if(lstrcmpi(str,"With")==0) return COM_WITH;
|
---|
534 | if(lstrcmpi(str,"Write")==0) return COM_WRITE;
|
---|
535 | }
|
---|
536 | else if(str[0]=='#'){
|
---|
537 | if(lstrcmpi(str,"#include")==0) return -1;
|
---|
538 | if(lstrcmpi(str,"#strict")==0) return -1;
|
---|
539 | if(lstrcmpi(str,"#console")==0) return -1;
|
---|
540 | if(lstrcmpi(str,"#prompt")==0) return -1;
|
---|
541 | if(lstrcmpi(str,"#N88BASIC")==0) return -1;
|
---|
542 | if(lstrcmpi(str,"#define")==0) return -1;
|
---|
543 | if(lstrcmpi(str,"#ifdef")==0) return -1;
|
---|
544 | if(lstrcmpi(str,"#ifndef")==0) return -1;
|
---|
545 | if(lstrcmpi(str,"#else")==0) return -1;
|
---|
546 | if(lstrcmpi(str,"#endif")==0) return -1;
|
---|
547 | }
|
---|
548 | return 0;
|
---|
549 | }
|
---|
550 |
|
---|
551 | HBITMAP CreateGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2){
|
---|
552 | //グラデーションビットマップを生成
|
---|
553 |
|
---|
554 | BITMAPINFO BitmapInfo;
|
---|
555 | memset(&BitmapInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER));
|
---|
556 | BitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
|
---|
557 | BitmapInfo.bmiHeader.biWidth=pSize->cx;
|
---|
558 | BitmapInfo.bmiHeader.biHeight=pSize->cy;
|
---|
559 | BitmapInfo.bmiHeader.biPlanes=1;
|
---|
560 | BitmapInfo.bmiHeader.biBitCount=24;
|
---|
561 |
|
---|
562 | HDC hdc;
|
---|
563 | hdc=GetDC(GetDesktopWindow());
|
---|
564 |
|
---|
565 | HBITMAP hBitmap;
|
---|
566 | BYTE *pByte;
|
---|
567 | hBitmap=CreateDIBSection(hdc,&BitmapInfo,DIB_RGB_COLORS,(void **)&pByte,0,0);
|
---|
568 |
|
---|
569 | int i,i2,x,y;
|
---|
570 | COLORREF rgb;
|
---|
571 | i=BitmapInfo.bmiHeader.biWidth*3;
|
---|
572 | if(i%sizeof(LONG)!=0) i+=sizeof(LONG)-(i%sizeof(LONG));
|
---|
573 | for(y=0;y<BitmapInfo.bmiHeader.biHeight;y++){
|
---|
574 | if(y<BitmapInfo.bmiHeader.biHeight/2-2) rgb=color2;
|
---|
575 | else if(y>BitmapInfo.bmiHeader.biHeight/2+2) rgb=color1;
|
---|
576 | else{
|
---|
577 | double ratio;
|
---|
578 | ratio=((double)y-((double)BitmapInfo.bmiHeader.biHeight/(double)2-(double)2))/(double)4;
|
---|
579 | //ratio=(double)y/(double)BitmapInfo.bmiHeader.biHeight;
|
---|
580 | rgb=RGB(
|
---|
581 | LOBYTE(LOWORD(color2))+(int)(double)(LOBYTE(LOWORD(color1))-LOBYTE(LOWORD(color2)))*(ratio), //赤要素
|
---|
582 | HIBYTE(LOWORD(color2))+(int)(double)(HIBYTE(LOWORD(color1))-HIBYTE(LOWORD(color2)))*(ratio), //緑要素
|
---|
583 | LOBYTE(HIWORD(color2))+(int)(double)(LOBYTE(HIWORD(color1))-LOBYTE(HIWORD(color2)))*(ratio) //青要素
|
---|
584 | );
|
---|
585 | }
|
---|
586 | for(x=0;x<BitmapInfo.bmiHeader.biWidth;x++){
|
---|
587 | i2=y*i+x*3;
|
---|
588 | pByte[i2+2]=LOBYTE(LOWORD(rgb));
|
---|
589 | pByte[i2+1]=HIBYTE(LOWORD(rgb));
|
---|
590 | pByte[i2]=LOBYTE(HIWORD(rgb));
|
---|
591 | }
|
---|
592 | }
|
---|
593 |
|
---|
594 | DeleteDC(hdc);
|
---|
595 |
|
---|
596 | return hBitmap;
|
---|
597 | }
|
---|
598 | HBITMAP CreateVertGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2){
|
---|
599 | //グラデーションビットマップを生成
|
---|
600 |
|
---|
601 | BITMAPINFO BitmapInfo;
|
---|
602 | memset(&BitmapInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER));
|
---|
603 | BitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
|
---|
604 | BitmapInfo.bmiHeader.biWidth=pSize->cx;
|
---|
605 | BitmapInfo.bmiHeader.biHeight=pSize->cy;
|
---|
606 | BitmapInfo.bmiHeader.biPlanes=1;
|
---|
607 | BitmapInfo.bmiHeader.biBitCount=24;
|
---|
608 |
|
---|
609 | HDC hdc;
|
---|
610 | hdc=GetDC(GetDesktopWindow());
|
---|
611 |
|
---|
612 | HBITMAP hBitmap;
|
---|
613 | BYTE *pByte;
|
---|
614 | hBitmap=CreateDIBSection(hdc,&BitmapInfo,DIB_RGB_COLORS,(void **)&pByte,0,0);
|
---|
615 |
|
---|
616 | int i,i2,x,y;
|
---|
617 | COLORREF rgb;
|
---|
618 | i=BitmapInfo.bmiHeader.biWidth*3;
|
---|
619 | if(i%sizeof(LONG)!=0) i+=sizeof(LONG)-(i%sizeof(LONG));
|
---|
620 | for(y=0;y<BitmapInfo.bmiHeader.biHeight;y++){
|
---|
621 | if(y<BitmapInfo.bmiHeader.biHeight/2-2) rgb=color2;
|
---|
622 | else if(y>BitmapInfo.bmiHeader.biHeight/2+2) rgb=color1;
|
---|
623 | else{
|
---|
624 | double ratio;
|
---|
625 | ratio=(double)y/(double)BitmapInfo.bmiHeader.biHeight;
|
---|
626 | rgb=RGB(
|
---|
627 | LOBYTE(LOWORD(color2))+(int)(double)(LOBYTE(LOWORD(color1))-LOBYTE(LOWORD(color2)))*(ratio), //赤要素
|
---|
628 | HIBYTE(LOWORD(color2))+(int)(double)(HIBYTE(LOWORD(color1))-HIBYTE(LOWORD(color2)))*(ratio), //緑要素
|
---|
629 | LOBYTE(HIWORD(color2))+(int)(double)(LOBYTE(HIWORD(color1))-LOBYTE(HIWORD(color2)))*(ratio) //青要素
|
---|
630 | );
|
---|
631 | }
|
---|
632 | for(x=0;x<BitmapInfo.bmiHeader.biWidth;x++){
|
---|
633 | i2=y*i+x*3;
|
---|
634 | pByte[i2+2]=LOBYTE(LOWORD(rgb));
|
---|
635 | pByte[i2+1]=HIBYTE(LOWORD(rgb));
|
---|
636 | pByte[i2]=LOBYTE(HIWORD(rgb));
|
---|
637 | }
|
---|
638 | }
|
---|
639 |
|
---|
640 | DeleteDC(hdc);
|
---|
641 |
|
---|
642 | return hBitmap;
|
---|
643 | }
|
---|
644 | HBITMAP CreateHorzGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2){
|
---|
645 | //グラデーションビットマップを生成
|
---|
646 |
|
---|
647 | BITMAPINFO BitmapInfo;
|
---|
648 | memset(&BitmapInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER));
|
---|
649 | BitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
|
---|
650 | BitmapInfo.bmiHeader.biWidth=pSize->cx;
|
---|
651 | BitmapInfo.bmiHeader.biHeight=pSize->cy;
|
---|
652 | BitmapInfo.bmiHeader.biPlanes=1;
|
---|
653 | BitmapInfo.bmiHeader.biBitCount=24;
|
---|
654 |
|
---|
655 | HDC hdc;
|
---|
656 | hdc=GetDC(GetDesktopWindow());
|
---|
657 |
|
---|
658 | HBITMAP hBitmap;
|
---|
659 | BYTE *pByte;
|
---|
660 | hBitmap=CreateDIBSection(hdc,&BitmapInfo,DIB_RGB_COLORS,(void **)&pByte,0,0);
|
---|
661 |
|
---|
662 | int i,i2,x,y;
|
---|
663 | COLORREF rgb;
|
---|
664 | i=BitmapInfo.bmiHeader.biWidth*3;
|
---|
665 | if(i%sizeof(LONG)!=0) i+=sizeof(LONG)-(i%sizeof(LONG));
|
---|
666 | for(x=0;x<BitmapInfo.bmiHeader.biWidth;x++){
|
---|
667 | double ratio;
|
---|
668 | ratio=(double)x/(double)BitmapInfo.bmiHeader.biWidth;
|
---|
669 | rgb=RGB(
|
---|
670 | LOBYTE(LOWORD(color1))+(int)(double)(LOBYTE(LOWORD(color2))-LOBYTE(LOWORD(color1)))*(ratio), //赤要素
|
---|
671 | HIBYTE(LOWORD(color1))+(int)(double)(HIBYTE(LOWORD(color2))-HIBYTE(LOWORD(color1)))*(ratio), //緑要素
|
---|
672 | LOBYTE(HIWORD(color1))+(int)(double)(LOBYTE(HIWORD(color2))-LOBYTE(HIWORD(color1)))*(ratio) //青要素
|
---|
673 | );
|
---|
674 | for(y=0;y<BitmapInfo.bmiHeader.biHeight;y++){
|
---|
675 | i2=y*i+x*3;
|
---|
676 | pByte[i2+2]=LOBYTE(LOWORD(rgb));
|
---|
677 | pByte[i2+1]=HIBYTE(LOWORD(rgb));
|
---|
678 | pByte[i2]=LOBYTE(HIWORD(rgb));
|
---|
679 | }
|
---|
680 | }
|
---|
681 |
|
---|
682 | DeleteDC(hdc);
|
---|
683 |
|
---|
684 | return hBitmap;
|
---|
685 | }
|
---|
686 | HICON CreateGrayIcon(HICON hBaseIcon){
|
---|
687 | ////////////////////////
|
---|
688 | // 淡色アイコンを生成
|
---|
689 | ////////////////////////
|
---|
690 |
|
---|
691 | HICON hGrayIcon;
|
---|
692 |
|
---|
693 | ICONINFO IconInfo;
|
---|
694 | GetIconInfo(hBaseIcon,&IconInfo);
|
---|
695 |
|
---|
696 |
|
---|
697 | //ビットマップを加工
|
---|
698 | BITMAP Bitmap;
|
---|
699 | GetObject(IconInfo.hbmColor,sizeof(Bitmap),&Bitmap);
|
---|
700 |
|
---|
701 | BITMAPINFO BitmapInfo;
|
---|
702 | memset(&BitmapInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER));
|
---|
703 | BitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
|
---|
704 | BitmapInfo.bmiHeader.biWidth=Bitmap.bmWidth;
|
---|
705 | BitmapInfo.bmiHeader.biHeight=Bitmap.bmHeight;
|
---|
706 | BitmapInfo.bmiHeader.biPlanes=1;
|
---|
707 | BitmapInfo.bmiHeader.biBitCount=24;
|
---|
708 | BitmapInfo.bmiHeader.biCompression=BI_RGB;
|
---|
709 |
|
---|
710 | HDC hdc;
|
---|
711 | hdc=GetDC(GetDesktopWindow());
|
---|
712 |
|
---|
713 | BYTE *pByte;
|
---|
714 | pByte=(BYTE *)HeapAlloc(hHeap,0,Bitmap.bmWidth*Bitmap.bmHeight*sizeof(COLORREF));
|
---|
715 | GetDIBits(hdc,
|
---|
716 | IconInfo.hbmColor,
|
---|
717 | 0,
|
---|
718 | Bitmap.bmHeight,
|
---|
719 | (void *)pByte,
|
---|
720 | &BitmapInfo,
|
---|
721 | DIB_RGB_COLORS);
|
---|
722 |
|
---|
723 | int i,i2,x,y;
|
---|
724 | i=BitmapInfo.bmiHeader.biWidth*3;
|
---|
725 | if(i%sizeof(LONG)!=0) i+=sizeof(LONG)-(i%sizeof(LONG));
|
---|
726 | for(x=0;x<BitmapInfo.bmiHeader.biWidth;x++){
|
---|
727 | for(y=0;y<BitmapInfo.bmiHeader.biHeight;y++){
|
---|
728 | i2=y*i+x*3;
|
---|
729 | if(pByte[i2+2]==0&&pByte[i2+1]==0&&pByte[i2]==0){
|
---|
730 | //透明色
|
---|
731 | //何もしない
|
---|
732 | }
|
---|
733 | else{
|
---|
734 | double ratio=0.5; //明るさ
|
---|
735 |
|
---|
736 | pByte[i2+2]+=(BYTE)((double)(255-pByte[i2+2])*ratio);
|
---|
737 | pByte[i2+1]+=(BYTE)((double)(255-pByte[i2+1])*ratio);
|
---|
738 | pByte[i2]+=(BYTE)((double)(255-pByte[i2])*ratio);
|
---|
739 |
|
---|
740 | pByte[i2+2]=(BYTE)(((int)pByte[i2+2]+(int)pByte[i2+1]+(int)pByte[i2])/3);
|
---|
741 | pByte[i2+1]=pByte[i2+2];
|
---|
742 | pByte[i2]=pByte[i2+2];
|
---|
743 | }
|
---|
744 | }
|
---|
745 | }
|
---|
746 |
|
---|
747 | SetDIBits(hdc,
|
---|
748 | IconInfo.hbmColor,
|
---|
749 | 0,
|
---|
750 | Bitmap.bmHeight,
|
---|
751 | (void *)pByte,
|
---|
752 | &BitmapInfo,
|
---|
753 | DIB_RGB_COLORS);
|
---|
754 |
|
---|
755 | HeapDefaultFree(pByte);
|
---|
756 |
|
---|
757 | DeleteDC(hdc);
|
---|
758 |
|
---|
759 |
|
---|
760 | hGrayIcon=CreateIconIndirect(&IconInfo);
|
---|
761 |
|
---|
762 | //不要なビットマップを破棄
|
---|
763 | DeleteObject(IconInfo.hbmMask);
|
---|
764 | DeleteObject(IconInfo.hbmColor);
|
---|
765 |
|
---|
766 | return hGrayIcon;
|
---|
767 | }
|
---|
768 | void GetSize(SIZE *pSize,RECT *pRect){
|
---|
769 | pSize->cx=pRect->right-pRect->left;
|
---|
770 | pSize->cy=pRect->bottom-pRect->top;
|
---|
771 | }
|
---|
772 | BOOL HitTest(RECT *pRect,POINT *pPos){
|
---|
773 | if(pRect->left<=pPos->x&&pPos->x<pRect->right&&
|
---|
774 | pRect->top<=pPos->y&&pPos->y<pRect->bottom) return 1;
|
---|
775 | return 0;
|
---|
776 | }
|
---|
777 | BOOL Rectangle(HDC hdc,RECT *pRect){
|
---|
778 | return Rectangle(hdc,pRect->left,pRect->top,pRect->right,pRect->bottom);
|
---|
779 | }
|
---|
780 |
|
---|
781 | void ComboBox_SetSelText(HWND hCombo,char *lpszText){
|
---|
782 | SendMessage(hCombo,CB_SETCURSEL,
|
---|
783 | SendMessage(hCombo,CB_FINDSTRINGEXACT,0,(LPARAM)lpszText),
|
---|
784 | 0);
|
---|
785 | }
|
---|
786 |
|
---|
787 | void SetCursorByState(int state){
|
---|
788 | if(state==FRAME_UPPER_LEFT||state==FRAME_LOWER_RIGHT) SetCursor(LoadCursor(0,IDC_SIZENWSE));
|
---|
789 | else if(state==FRAME_UPPER_RIGHT||state==FRAME_LOWER_LEFT) SetCursor(LoadCursor(0,IDC_SIZENESW));
|
---|
790 | else if(state==FRAME_LEFT||state==FRAME_RIGHT) SetCursor(LoadCursor(0,IDC_SIZEWE));
|
---|
791 | else if(state==FRAME_UPPER||state==FRAME_LOWER) SetCursor(LoadCursor(0,IDC_SIZENS));
|
---|
792 | else if(state==FRAME_INSIDE) SetCursor(LoadCursor(0,IDC_SIZEALL));
|
---|
793 | else SetCursor(LoadCursor(0,IDC_ARROW));
|
---|
794 | }
|
---|
795 |
|
---|
796 | void SetTextEditColorDesign(TEXTEDIT_COLOR_INFO *pColorInfo,CTheme *pobj_Theme,BOOL bRedraw){
|
---|
797 | pColorInfo->rgbDefault=pobj_Theme->TextColorInfo.rgbDefault;
|
---|
798 | pColorInfo->rgbComment=pobj_Theme->TextColorInfo.rgbComment;
|
---|
799 | pColorInfo->rgbStatement=pobj_Theme->TextColorInfo.rgbStatement;
|
---|
800 | pColorInfo->rgbString=pobj_Theme->TextColorInfo.rgbString;
|
---|
801 | pColorInfo->rgbCursorBack=pobj_Theme->TextColorInfo.rgbCursorBack;
|
---|
802 | pColorInfo->rgbBackground=pobj_Theme->TextColorInfo.rgbBackground;
|
---|
803 |
|
---|
804 | //アクティブテーマにセット
|
---|
805 | lstrcpy(pobj_nv->szActiveTheme,pobj_Theme->m_name);
|
---|
806 |
|
---|
807 | //テーマ依存の描画リソースを取得
|
---|
808 | pobj_DBTheme->unlock();
|
---|
809 | pobj_DBTheme->lock();
|
---|
810 |
|
---|
811 | if(bRedraw){
|
---|
812 | //再描画
|
---|
813 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
814 | int i;
|
---|
815 | for(i=0;i<MAX_WNDNUM;i++){
|
---|
816 | if(MdiInfo[i].hwnd){
|
---|
817 | if(IS_DOCUMENT_TEXT(MdiInfo[i].DocType)){
|
---|
818 | SetTextEditWordColor(i);
|
---|
819 | InvalidateRect(MdiInfo[i].pmti->hEdit,NULL,0);
|
---|
820 | }
|
---|
821 | }
|
---|
822 | }
|
---|
823 | }
|
---|
824 | }
|
---|
825 |
|
---|
826 | BOOL SerialCheck(char *buffer){
|
---|
827 | _int64 i64;
|
---|
828 | i64=_atoi64(buffer);
|
---|
829 | i64=(i64*2-129374);
|
---|
830 | i64=(i64*3-34564);
|
---|
831 | i64=(i64*4-2334);
|
---|
832 |
|
---|
833 | if(i64==SERIAL_HASH_64) return 1;
|
---|
834 | return 0;
|
---|
835 | }
|
---|
836 | void SerialCheck_IniFile(void){
|
---|
837 | char temporary[MAX_PATH];
|
---|
838 | sprintf(temporary,"%sUserSetting\\sh.ini",pj_editor_Dir);
|
---|
839 | char *buffer;
|
---|
840 | buffer=ReadBuffer_NonErrMsg(temporary);
|
---|
841 | if(buffer){
|
---|
842 | _int64 i64;
|
---|
843 | i64=_atoi64(buffer);
|
---|
844 | if(i64==SERIAL_HASH_64){
|
---|
845 | bProfessional=1;
|
---|
846 | }
|
---|
847 | HeapDefaultFree(buffer);
|
---|
848 | }
|
---|
849 | }
|
---|
850 | void WriteSerialHash(void){
|
---|
851 | MakeUserSettingDir();
|
---|
852 |
|
---|
853 | char temporary[MAX_PATH],temp2[255];
|
---|
854 | sprintf(temporary,"%sUserSetting\\sh.ini",pj_editor_Dir);
|
---|
855 |
|
---|
856 | _i64toa(SERIAL_HASH_64,temp2,10);
|
---|
857 | WriteBuffer(temporary,temp2,lstrlen(temp2));
|
---|
858 | }
|
---|
859 | BOOL SetupProjectEditor(void){
|
---|
860 | extern HINSTANCE hInst;
|
---|
861 | int i;
|
---|
862 | char str[MAX_PATH],temporary[MAX_PATH];
|
---|
863 |
|
---|
864 |
|
---|
865 | //リソース用DLLをマッピング
|
---|
866 | #if defined(JPN)
|
---|
867 | //日本語リソース
|
---|
868 | sprintf(temporary,"%sSubOperation\\res.dll",pj_editor_Dir);
|
---|
869 | #else
|
---|
870 | //英語リソース
|
---|
871 | sprintf(temporary,"%sSubOperation\\res_e.dll",pj_editor_Dir);
|
---|
872 | #endif
|
---|
873 | hResInst=LoadLibrary(temporary);
|
---|
874 |
|
---|
875 | //アイコンリソースDLLをマッピング
|
---|
876 | sprintf(temporary,"%sSubOperation\\icon_res.dll",pj_editor_Dir);
|
---|
877 | hIconResInst=LoadLibrary(temporary);
|
---|
878 |
|
---|
879 | //LuxCtrl.dllをマッピング
|
---|
880 | sprintf(temporary,"%sSubOperation\\LuxCtrl.dll",pj_editor_Dir);
|
---|
881 | hLib_LuxCtrl=LoadLibrary(temporary);
|
---|
882 | if(!hLib_LuxCtrl){
|
---|
883 | MessageBox(0,"LuxCtrl.dllの読み込みに失敗しました。",APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
|
---|
884 | return 0;
|
---|
885 | }
|
---|
886 | LuxToolbar_CreateInstance=
|
---|
887 | (PROC_LuxToolbar_CreateInstance)GetProcAddress(hLib_LuxCtrl,"LuxToolbar_CreateInstance");
|
---|
888 |
|
---|
889 |
|
---|
890 | //モジュールディレクトリを取得
|
---|
891 | GetModuleFileName(hInst,temporary,MAX_PATH);
|
---|
892 | _splitpath(temporary,pj_editor_Dir,str,NULL,NULL);
|
---|
893 | lstrcat(pj_editor_Dir,str);
|
---|
894 |
|
---|
895 | //ヒープオブジェクトを作成
|
---|
896 | extern HANDLE hHeap;
|
---|
897 | hHeap=HeapCreate(HEAP_GENERATE_EXCEPTIONS,0,0);
|
---|
898 |
|
---|
899 |
|
---|
900 | ///////////////////////////////
|
---|
901 | // シリアルIDの確認
|
---|
902 | ///////////////////////////////
|
---|
903 | #ifdef SHAREWARE
|
---|
904 | //Pro版の場合はシリアル確認を行う
|
---|
905 | SerialCheck_IniFile();
|
---|
906 |
|
---|
907 | if(bProfessional==0){
|
---|
908 | if(DialogBox(hResInst,MAKEINTRESOURCE(IDD_PASSWORD),0,DlgPassword)){
|
---|
909 | bProfessional=1;
|
---|
910 | WriteSerialHash();
|
---|
911 |
|
---|
912 | DialogBox(hResInst,MAKEINTRESOURCE(IDD_PROFESSIONAL_START),0,DlgProfessionalStart);
|
---|
913 | }
|
---|
914 | else{
|
---|
915 | MessageBox(0,"機能制限がかかったスタンダードモードで起動します。",APPLICATION_NAME,MB_OK);
|
---|
916 | }
|
---|
917 | }
|
---|
918 | #endif
|
---|
919 | #ifndef THETEXT
|
---|
920 | //ProjectEditorの場合はシリアル確認を行う
|
---|
921 | SerialCheck_IniFile();
|
---|
922 | #endif
|
---|
923 |
|
---|
924 |
|
---|
925 |
|
---|
926 | if(bProfessional){
|
---|
927 | //Pro版は自動バックアップ及び復元機能を有効にする
|
---|
928 |
|
---|
929 | //自動バックアップ用のディレクトリを生成
|
---|
930 | CreateBackupDir();
|
---|
931 | }
|
---|
932 |
|
---|
933 | //COMを初期化
|
---|
934 | CoInitialize(0);
|
---|
935 |
|
---|
936 | //スクリーンサイズを取得
|
---|
937 | ScreenX=GetSystemMetrics(SM_CXSCREEN);
|
---|
938 | ScreenY=GetSystemMetrics(SM_CYSCREEN);
|
---|
939 |
|
---|
940 | //コンパイラ名をセット(デフォルトはWin32)
|
---|
941 | extern char *lpszCompilerName;
|
---|
942 | lpszCompilerName=WIN32_COMPILER_NAME;
|
---|
943 |
|
---|
944 | //不揮発性のデータを取得
|
---|
945 | pobj_nv=new CNonVolatile;
|
---|
946 | pobj_nv->load();
|
---|
947 |
|
---|
948 |
|
---|
949 | if(!bProfessional){
|
---|
950 | //フリー版ではWeb検索の結果を残さない
|
---|
951 | pobj_nv->bSaveWebFindStr=0;
|
---|
952 |
|
---|
953 | //フリー版ではCtrlキーによるリンク
|
---|
954 | pobj_nv->bCtrlKeyHyperLink=0;
|
---|
955 | }
|
---|
956 |
|
---|
957 |
|
---|
958 | //アルファブレンド用のAPIを取得
|
---|
959 | extern FWINLAYER SetLayeredWindowAttributes;
|
---|
960 | extern HINSTANCE hUser32Lib;
|
---|
961 | hUser32Lib=LoadLibrary("user32.dll");
|
---|
962 | SetLayeredWindowAttributes=(FWINLAYER)GetProcAddress(hUser32Lib,"SetLayeredWindowAttributes");
|
---|
963 |
|
---|
964 |
|
---|
965 |
|
---|
966 |
|
---|
967 | /////////////////////
|
---|
968 | // フォントを定義
|
---|
969 | /////////////////////
|
---|
970 |
|
---|
971 | //パラメータ ヒント フォント
|
---|
972 | extern METHODCHECKINFO MethodCheckInfo;
|
---|
973 | MethodCheckInfo.hFont=CreateFontIndirect(&MethodCheckInfo.LogFont);
|
---|
974 | i=MethodCheckInfo.LogFont.lfWeight;
|
---|
975 | MethodCheckInfo.LogFont.lfWeight=FW_BOLD;
|
---|
976 | MethodCheckInfo.hBoldFont=CreateFontIndirect(&MethodCheckInfo.LogFont);
|
---|
977 | MethodCheckInfo.LogFont.lfWeight=i;
|
---|
978 |
|
---|
979 | //ステータスバー フォント
|
---|
980 | LOGFONT LogFont;
|
---|
981 | extern HFONT hStatusFont;
|
---|
982 | LogFont.lfHeight=-12;
|
---|
983 | LogFont.lfWidth=0;
|
---|
984 | LogFont.lfEscapement=0;
|
---|
985 | LogFont.lfOrientation=0;
|
---|
986 | LogFont.lfWeight=FW_REGULAR;
|
---|
987 | LogFont.lfItalic=NULL;
|
---|
988 | LogFont.lfUnderline=NULL;
|
---|
989 | LogFont.lfStrikeOut=NULL;
|
---|
990 | LogFont.lfCharSet=SHIFTJIS_CHARSET;
|
---|
991 | LogFont.lfOutPrecision=OUT_STRING_PRECIS;
|
---|
992 | LogFont.lfClipPrecision=CLIP_STROKE_PRECIS;
|
---|
993 | LogFont.lfQuality=DRAFT_QUALITY;
|
---|
994 | LogFont.lfPitchAndFamily=VARIABLE_PITCH;
|
---|
995 | sprintf(LogFont.lfFaceName,"MS Pゴシック");
|
---|
996 | hStatusFont=CreateFontIndirect(&LogFont);
|
---|
997 |
|
---|
998 | //ハイパーリンク フォント
|
---|
999 | extern HFONT hHyperLinkFont;
|
---|
1000 | LogFont.lfHeight=-12;
|
---|
1001 | LogFont.lfWidth=0;
|
---|
1002 | LogFont.lfEscapement=0;
|
---|
1003 | LogFont.lfOrientation=0;
|
---|
1004 | LogFont.lfWeight=FW_REGULAR;
|
---|
1005 | LogFont.lfItalic=NULL;
|
---|
1006 | LogFont.lfUnderline=TRUE;
|
---|
1007 | LogFont.lfStrikeOut=NULL;
|
---|
1008 | LogFont.lfCharSet=SHIFTJIS_CHARSET;
|
---|
1009 | LogFont.lfOutPrecision=OUT_STRING_PRECIS;
|
---|
1010 | LogFont.lfClipPrecision=CLIP_STROKE_PRECIS;
|
---|
1011 | LogFont.lfQuality=DRAFT_QUALITY;
|
---|
1012 | LogFont.lfPitchAndFamily=VARIABLE_PITCH;
|
---|
1013 | sprintf(LogFont.lfFaceName,"MS Pゴシック");
|
---|
1014 | hHyperLinkFont=CreateFontIndirect(&LogFont);
|
---|
1015 |
|
---|
1016 | //ルーラー フォント
|
---|
1017 | extern HFONT hRulerFont;
|
---|
1018 | LogFont.lfHeight=-10;
|
---|
1019 | LogFont.lfWidth=0;
|
---|
1020 | LogFont.lfEscapement=0;
|
---|
1021 | LogFont.lfOrientation=0;
|
---|
1022 | LogFont.lfWeight=FW_REGULAR;
|
---|
1023 | LogFont.lfItalic=NULL;
|
---|
1024 | LogFont.lfUnderline=0;
|
---|
1025 | LogFont.lfStrikeOut=NULL;
|
---|
1026 | LogFont.lfCharSet=SHIFTJIS_CHARSET;
|
---|
1027 | LogFont.lfOutPrecision=OUT_STRING_PRECIS;
|
---|
1028 | LogFont.lfClipPrecision=CLIP_STROKE_PRECIS;
|
---|
1029 | LogFont.lfQuality=DRAFT_QUALITY;
|
---|
1030 | LogFont.lfPitchAndFamily=VARIABLE_PITCH;
|
---|
1031 | sprintf(LogFont.lfFaceName,"MS ゴシック");
|
---|
1032 | hRulerFont=CreateFontIndirect(&LogFont);
|
---|
1033 |
|
---|
1034 | //行番号の描画用
|
---|
1035 | extern HFONT hFont_LineNumber;
|
---|
1036 | LogFont.lfHeight=-11;
|
---|
1037 | LogFont.lfWidth=0;
|
---|
1038 | LogFont.lfEscapement=0;
|
---|
1039 | LogFont.lfOrientation=0;
|
---|
1040 | LogFont.lfWeight=FW_BOLD;
|
---|
1041 | LogFont.lfItalic=NULL;
|
---|
1042 | LogFont.lfUnderline=NULL;
|
---|
1043 | LogFont.lfStrikeOut=NULL;
|
---|
1044 | LogFont.lfCharSet=ANSI_CHARSET;
|
---|
1045 | LogFont.lfOutPrecision=OUT_STRING_PRECIS;
|
---|
1046 | LogFont.lfClipPrecision=CLIP_STROKE_PRECIS;
|
---|
1047 | LogFont.lfQuality=DRAFT_QUALITY;
|
---|
1048 | LogFont.lfPitchAndFamily=VARIABLE_PITCH;
|
---|
1049 | sprintf(LogFont.lfFaceName,"Courier New");
|
---|
1050 | hFont_LineNumber=CreateFontIndirect(&LogFont);
|
---|
1051 |
|
---|
1052 | //メニューフォント
|
---|
1053 | NONCLIENTMETRICS NCMetrics;
|
---|
1054 | NCMetrics.cbSize = sizeof( NONCLIENTMETRICS );
|
---|
1055 | SystemParametersInfo( SPI_GETNONCLIENTMETRICS, sizeof( NONCLIENTMETRICS ), &NCMetrics, 0 );
|
---|
1056 | hMenuFont=CreateFontIndirect(&NCMetrics.lfMenuFont);
|
---|
1057 |
|
---|
1058 |
|
---|
1059 |
|
---|
1060 | //背景ブラシ
|
---|
1061 | extern HBRUSH h3DFaceBackBrush;
|
---|
1062 | h3DFaceBackBrush=CreateSolidBrush(GetSysColor(COLOR_3DFACE));
|
---|
1063 |
|
---|
1064 | //アイコン
|
---|
1065 | extern HICON hOwnerIcon,hBasicProgramIcon,hTextDocumentIcon,hWindowDocumentIcon;
|
---|
1066 | hOwnerIcon=(HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_MAIN),IMAGE_ICON,16,16,LR_DEFAULTCOLOR);
|
---|
1067 | hBasicProgramIcon=(HICON)LoadImage(hResInst,MAKEINTRESOURCE(IDI_BASICPROGRAM),IMAGE_ICON,16,16,LR_DEFAULTCOLOR);
|
---|
1068 | hTextDocumentIcon=(HICON)LoadImage(hResInst,MAKEINTRESOURCE(IDI_TEXTDOCUMENT),IMAGE_ICON,16,16,LR_DEFAULTCOLOR);
|
---|
1069 | hWindowDocumentIcon=(HICON)LoadImage(hResInst,MAKEINTRESOURCE(IDI_WINDOW),IMAGE_ICON,16,16,LR_DEFAULTCOLOR);
|
---|
1070 |
|
---|
1071 |
|
---|
1072 |
|
---|
1073 |
|
---|
1074 | //メインメニュー
|
---|
1075 | pobj_MainMenu=new CMenuEx(LoadMenu(hResInst,MAKEINTRESOURCE(IDR_MAINMENU)));
|
---|
1076 |
|
---|
1077 | if(!bProfessional){
|
---|
1078 | //フリー版の場合はプレビュー機能を削除する
|
---|
1079 | RemoveMenu(GetSubMenu(pobj_MainMenu->hMenu,0),IDM_PREVIEW,MF_BYCOMMAND);
|
---|
1080 | }
|
---|
1081 |
|
---|
1082 | pobj_MainMenu->InitOwnerDraw(1); //オーナー描画の初期化
|
---|
1083 |
|
---|
1084 | CSubMenuEx *pobj_FileMenu;
|
---|
1085 | pobj_FileMenu=pobj_MainMenu->ppobj_MenuItemData[0]->pobj_SubMenu;
|
---|
1086 |
|
---|
1087 | //未完成
|
---|
1088 | extern HMENU hFirstMainMenu;
|
---|
1089 | hFirstMainMenu=0;
|
---|
1090 |
|
---|
1091 | //「最近使ったファイル」サブメニューを取得(と同時にも正規のメニュー文字列を指定)
|
---|
1092 | for(i=0;i<pobj_FileMenu->iMenuItemNum;i++){
|
---|
1093 | if(pobj_FileMenu->ppobj_MenuItemData[i]->str){
|
---|
1094 | if(lstrcmp(pobj_FileMenu->ppobj_MenuItemData[i]->str,"FileHistory")==0){
|
---|
1095 | pobj_FileMenu->RenameMenuItem(i,"最近使ったファイル(&F)");
|
---|
1096 |
|
---|
1097 | extern CSubMenuEx *pobj_FileHistoryMenu;
|
---|
1098 | pobj_FileHistoryMenu=pobj_FileMenu->ppobj_MenuItemData[i]->pobj_SubMenu;
|
---|
1099 | }
|
---|
1100 |
|
---|
1101 | #ifndef THETEXT
|
---|
1102 | //「最近使ったプロジェクト」サブメニューを取得(と同時にも正規のメニュー文字列を指定)
|
---|
1103 | //※ProjectEditorのみ
|
---|
1104 | if(lstrcmp(pobj_FileMenu->ppobj_MenuItemData[i]->str,"ProjectHistory")==0){
|
---|
1105 | pobj_FileMenu->RenameMenuItem(i,"最近使ったプロジェクト(&J)");
|
---|
1106 |
|
---|
1107 | extern CSubMenuEx *pobj_ProjectHistoryMenu;
|
---|
1108 | pobj_ProjectHistoryMenu=pobj_FileMenu->ppobj_MenuItemData[i]->pobj_SubMenu;
|
---|
1109 | }
|
---|
1110 | #endif
|
---|
1111 | }
|
---|
1112 | }
|
---|
1113 |
|
---|
1114 | #define ICONSET(itemID,iconID) pobj_MainMenu->SetIcon(itemID,(HICON)LoadImage(hIconResInst,MAKEINTRESOURCE(iconID),IMAGE_ICON,16,16,0));
|
---|
1115 | //メニューアイコンをセット
|
---|
1116 |
|
---|
1117 | //ファイル
|
---|
1118 | ICONSET(IDM_NEW,IDI_NEW);
|
---|
1119 | ICONSET(IDM_OPEN,IDI_OPEN);
|
---|
1120 | ICONSET(IDM_SAVE,IDI_SAVE);
|
---|
1121 | ICONSET(IDM_ALLSAVE,IDI_ALLSAVE);
|
---|
1122 | ICONSET(IDM_PREVIEW,IDI_PREVIEW);
|
---|
1123 | ICONSET(IDM_PRINTOUT,IDI_PRINT);
|
---|
1124 |
|
---|
1125 | //編集
|
---|
1126 | ICONSET(IDM_CUT,IDI_CUT);
|
---|
1127 | ICONSET(IDM_COPY,IDI_COPY);
|
---|
1128 | ICONSET(IDM_PASTE,IDI_PASTE);
|
---|
1129 | ICONSET(IDM_UNDO,IDI_UNDO);
|
---|
1130 | ICONSET(IDM_REDO,IDI_REDO);
|
---|
1131 | ICONSET(IDM_FIND,IDI_FIND);
|
---|
1132 |
|
---|
1133 | //表示
|
---|
1134 | ICONSET(IDM_SET,IDI_OPTION);
|
---|
1135 |
|
---|
1136 | //変換
|
---|
1137 | ICONSET(IDM_CONV_ALPHA_SMALL,IDI_CONV_ALPHA_SMALL);
|
---|
1138 | ICONSET(IDM_CONV_ALPHA_BIG,IDI_CONV_ALPHA_BIG);
|
---|
1139 | ICONSET(IDM_CONV_HALF,IDI_CONV_HALF);
|
---|
1140 | ICONSET(IDM_CONV_MULTI,IDI_CONV_MULTI);
|
---|
1141 | ICONSET(IDM_CONV_KATAKANA,IDI_CONV_KATAKANA);
|
---|
1142 | ICONSET(IDM_CONV_HIRAGANA,IDI_CONV_HIRAGANA);
|
---|
1143 |
|
---|
1144 | //ヘルプ
|
---|
1145 | ICONSET(IDM_TOPIC,IDI_HELP);
|
---|
1146 |
|
---|
1147 | #ifdef THETEXT
|
---|
1148 | //TheTextのみの機能
|
---|
1149 | ICONSET(IDM_STRING_COUNT,IDI_STRINGCOUNT);
|
---|
1150 | #else
|
---|
1151 | //ProjectEditorのみの機能
|
---|
1152 |
|
---|
1153 | //リリース
|
---|
1154 | ICONSET(IDM_RELEASECOMPILE,IDI_RELEASECOMPILE);
|
---|
1155 | ICONSET(IDM_RELEASERUN,IDI_RELEASERUN);
|
---|
1156 |
|
---|
1157 | //デバッグ
|
---|
1158 | ICONSET(IDM_ATTACH,IDI_ATTACH);
|
---|
1159 | ICONSET(IDM_DEBUGCOMPILE,IDI_DEBUGCOMPILE);
|
---|
1160 | ICONSET(IDM_DEBUG,IDI_DEBUGRUN);
|
---|
1161 | ICONSET(IDM_BREAKPOINT,IDI_BREAKPOINT);
|
---|
1162 | ICONSET(IDM_STEP_IN,IDI_STEPIN);
|
---|
1163 | ICONSET(IDM_STEP_OVER,IDI_STEPOVER);
|
---|
1164 | ICONSET(IDM_STEP_CURSOR,IDI_STEPTOCURSOR);
|
---|
1165 | ICONSET(IDM_DEBUG_PAUSE,IDI_DEBUGPAUSE);
|
---|
1166 | ICONSET(IDM_DEBUG_STOP,IDI_DEBUGSTOP);
|
---|
1167 |
|
---|
1168 | //コミュニティ
|
---|
1169 | ICONSET(IDM_COMMUNITY,IDI_COMMUNITY_MAIN);
|
---|
1170 | ICONSET(IDM_COMMU_SEARCH,IDI_COMMUNITY_FIND);
|
---|
1171 | ICONSET(IDM_COMMU_PM,IDI_COMMUNITY_PRIVATEMSG);
|
---|
1172 | ICONSET(ID_COMMU_FORUM1,IDI_COMMUNITY_FORUM);
|
---|
1173 | ICONSET(ID_COMMU_FORUM2,IDI_COMMUNITY_FORUM);
|
---|
1174 | ICONSET(ID_COMMU_FORUM3,IDI_COMMUNITY_FORUM);
|
---|
1175 | ICONSET(ID_COMMU_FORUM4,IDI_COMMUNITY_FORUM);
|
---|
1176 | ICONSET(ID_COMMU_FORUM5,IDI_COMMUNITY_FORUM);
|
---|
1177 | ICONSET(ID_COMMU_FORUM6,IDI_COMMUNITY_FORUM_SECRET);
|
---|
1178 | ICONSET(ID_COMMU_FORUM7,IDI_COMMUNITY_FORUM);
|
---|
1179 | ICONSET(ID_COMMU_FORUM8,IDI_COMMUNITY_FORUM);
|
---|
1180 | #endif
|
---|
1181 |
|
---|
1182 | #undef ICONSET
|
---|
1183 |
|
---|
1184 |
|
---|
1185 |
|
---|
1186 |
|
---|
1187 | extern HMENU hEditMenuBase,hEditMenu;
|
---|
1188 | hEditMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_EDITMENU));
|
---|
1189 | hEditMenu=GetSubMenu(hEditMenuBase,0);
|
---|
1190 |
|
---|
1191 | extern HMENU hRebarMenuBase,hRebarMenu;
|
---|
1192 | hRebarMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_REBARMENU));
|
---|
1193 | hRebarMenu=GetSubMenu(hRebarMenuBase,0);
|
---|
1194 |
|
---|
1195 | extern HMENU hTabMenuBase,hTabMenu,hTabColorMenu;
|
---|
1196 | hTabMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_TABMENU));
|
---|
1197 | hTabMenu=GetSubMenu(hTabMenuBase,0);
|
---|
1198 | hTabColorMenu=GetSubMenu(hTabMenu,0);
|
---|
1199 |
|
---|
1200 | extern HMENU hFileTreeMenuBase;
|
---|
1201 | hFileTreeMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_PROJECTVIEW_FILETREEMENU));
|
---|
1202 |
|
---|
1203 | extern HMENU hProcedureTreeMenuBase;
|
---|
1204 | hProcedureTreeMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_PROJECTVIEW_PROCEDURETREEMENU));
|
---|
1205 |
|
---|
1206 | extern HMENU hMaterialTreeMenuBase;
|
---|
1207 | hMaterialTreeMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_PROJECTVIEW_MATERIALTREEMENU));
|
---|
1208 |
|
---|
1209 | extern HMENU hRadMenuBase;
|
---|
1210 | hRadMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_RADCONTEXTMENU));
|
---|
1211 |
|
---|
1212 | //クリップボードのデータ形式(RAD用)を新規登録
|
---|
1213 | extern DWORD dwRadClipboardID;
|
---|
1214 | dwRadClipboardID=RegisterClipboardFormat("ProjectEditor-RAD");
|
---|
1215 |
|
---|
1216 | //256色の標準パレットを読み込む
|
---|
1217 | extern RGBQUAD DefaultColorTable256[256];
|
---|
1218 | HANDLE hFile;
|
---|
1219 | DWORD dw;
|
---|
1220 | sprintf(temporary,"%sSubOperation\\8bit.plt",pj_editor_Dir);
|
---|
1221 | hFile=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
|
---|
1222 | if(hFile==INVALID_HANDLE_VALUE){
|
---|
1223 | //"\"%s\" ファイルの読み込みに失敗しました。"
|
---|
1224 | sprintf(str,STRING_ERROR_CANT_FILEOPEN,temporary);
|
---|
1225 | MessageBox(NULL,str,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
|
---|
1226 | return 0;
|
---|
1227 | }
|
---|
1228 | ReadFile(hFile,DefaultColorTable256,sizeof(RGBQUAD)*256,&dw,NULL);
|
---|
1229 | CloseHandle(hFile);
|
---|
1230 |
|
---|
1231 |
|
---|
1232 |
|
---|
1233 | //デザインテーマオブジェクトを生成
|
---|
1234 | pobj_DBTheme=new CDBTheme();
|
---|
1235 |
|
---|
1236 |
|
---|
1237 | /////////////////////////
|
---|
1238 | // カラーデザインを設定
|
---|
1239 | CTheme *pobj_Theme;
|
---|
1240 | pobj_Theme=pobj_DBTheme->GetActiveTheme();
|
---|
1241 | if(!pobj_Theme) pobj_Theme=pobj_DBTheme->ppobj_Theme[0];
|
---|
1242 |
|
---|
1243 | SetTextEditColorDesign(&tci,pobj_Theme,0);
|
---|
1244 |
|
---|
1245 |
|
---|
1246 | #ifndef THETEXT
|
---|
1247 | /////////////////////////////////////////////////////
|
---|
1248 | // ProjectEditorのみ
|
---|
1249 | /////////////////////////////////////////////////////
|
---|
1250 |
|
---|
1251 |
|
---|
1252 | //クラスビュー管理オブジェクトを生成
|
---|
1253 | pobj_ClassTreeView=new CClassTreeView();
|
---|
1254 |
|
---|
1255 |
|
---|
1256 | /////////////////////////
|
---|
1257 | // basic.sbpの内容を取得
|
---|
1258 | /////////////////////////
|
---|
1259 |
|
---|
1260 | extern char *pHeaderBuf;
|
---|
1261 | sprintf(temporary,"%sInclude\\basic.sbp",pj_editor_Dir);
|
---|
1262 | pHeaderBuf=ReadBuffer(temporary);
|
---|
1263 |
|
---|
1264 | //ファイルをインクルード
|
---|
1265 | pHeaderBuf=IncludeFiles(pHeaderBuf);
|
---|
1266 |
|
---|
1267 |
|
---|
1268 | //デバッガ管理オブジェクトを生成
|
---|
1269 | pobj_Debugger=new CDebugger();
|
---|
1270 |
|
---|
1271 |
|
---|
1272 | //ブレークポイント管理オブジェクトを生成
|
---|
1273 | extern CDBBreakPoint *pobj_DBBreakPoint;
|
---|
1274 | pobj_DBBreakPoint=new CDBBreakPoint();
|
---|
1275 | #endif
|
---|
1276 |
|
---|
1277 |
|
---|
1278 | return 1;
|
---|
1279 | }
|
---|
1280 | void EndProjectEditor(void){
|
---|
1281 |
|
---|
1282 | #ifndef THETEXT
|
---|
1283 | /////////////////////////////////////////////////////
|
---|
1284 | // ProjectEditorのみ
|
---|
1285 | /////////////////////////////////////////////////////
|
---|
1286 |
|
---|
1287 |
|
---|
1288 | //クラスビュー管理オブジェクトを破棄
|
---|
1289 | delete pobj_ClassTreeView;
|
---|
1290 | pobj_ClassTreeView=0;
|
---|
1291 |
|
---|
1292 | //basic.sbpのソースコードバッファを解放
|
---|
1293 | extern char *pHeaderBuf;
|
---|
1294 | HeapDefaultFree(pHeaderBuf);
|
---|
1295 |
|
---|
1296 | //デバッガ管理オブジェクトを破棄
|
---|
1297 | delete pobj_Debugger;
|
---|
1298 |
|
---|
1299 | //ブレークポイント管理オブジェクトを破棄
|
---|
1300 | extern CDBBreakPoint *pobj_DBBreakPoint;
|
---|
1301 | delete pobj_DBBreakPoint;
|
---|
1302 | #endif
|
---|
1303 |
|
---|
1304 | //デザインテーマオブジェクトを破棄
|
---|
1305 | delete pobj_DBTheme;
|
---|
1306 |
|
---|
1307 | //不揮発性のデータを保存
|
---|
1308 | pobj_nv->save();
|
---|
1309 | delete pobj_nv;
|
---|
1310 | pobj_nv=0;
|
---|
1311 |
|
---|
1312 | //メインメニューオブジェクトを破棄
|
---|
1313 | delete pobj_MainMenu;
|
---|
1314 | pobj_MainMenu=0;
|
---|
1315 |
|
---|
1316 | extern HFONT hStatusFont;
|
---|
1317 | DeleteObject(hStatusFont);
|
---|
1318 | extern HFONT hHyperLinkFont;
|
---|
1319 | DeleteObject(hHyperLinkFont);
|
---|
1320 | extern HFONT hRulerFont;
|
---|
1321 | DeleteObject(hRulerFont);
|
---|
1322 | extern HFONT hFont_LineNumber;
|
---|
1323 | DeleteObject(hFont_LineNumber);
|
---|
1324 | extern METHODCHECKINFO MethodCheckInfo;
|
---|
1325 | DeleteObject(MethodCheckInfo.hFont);
|
---|
1326 | DeleteObject(MethodCheckInfo.hBoldFont);
|
---|
1327 | extern HICON hOwnerIcon,hBasicProgramIcon,hTextDocumentIcon,hWindowDocumentIcon;
|
---|
1328 | DestroyIcon(hOwnerIcon);
|
---|
1329 | DestroyIcon(hBasicProgramIcon);
|
---|
1330 | DestroyIcon(hTextDocumentIcon);
|
---|
1331 | DestroyIcon(hWindowDocumentIcon);
|
---|
1332 | extern HMENU hEditMenuBase,hRebarMenuBase,hTabMenuBase;
|
---|
1333 | DestroyMenu(hEditMenuBase);
|
---|
1334 | DestroyMenu(hRebarMenuBase);
|
---|
1335 | DestroyMenu(hTabMenuBase);
|
---|
1336 | extern HMENU hFileTreeMenuBase;
|
---|
1337 | DestroyMenu(hFileTreeMenuBase);
|
---|
1338 | extern HMENU hProcedureTreeMenuBase;
|
---|
1339 | DestroyMenu(hProcedureTreeMenuBase);
|
---|
1340 | extern HMENU hMaterialTreeMenuBase;
|
---|
1341 | DestroyMenu(hMaterialTreeMenuBase);
|
---|
1342 | extern HMENU hRadMenuBase;
|
---|
1343 | DestroyMenu(hRadMenuBase);
|
---|
1344 |
|
---|
1345 | //背景ブラシ
|
---|
1346 | extern HBRUSH h3DFaceBackBrush;
|
---|
1347 | DeleteObject(h3DFaceBackBrush);
|
---|
1348 |
|
---|
1349 | //スタンダードツールバーを破棄
|
---|
1350 | if(pobj_StandardToolbar){
|
---|
1351 | pobj_StandardToolbar->Release();
|
---|
1352 | pobj_StandardToolbar=0;
|
---|
1353 | }
|
---|
1354 |
|
---|
1355 | //ビルドツールバーを破棄
|
---|
1356 | if(pobj_ReleaseToolbar){
|
---|
1357 | pobj_ReleaseToolbar->Release();
|
---|
1358 | pobj_ReleaseToolbar=0;
|
---|
1359 | }
|
---|
1360 |
|
---|
1361 | //デバッガ用ツールバーを破棄
|
---|
1362 | if(pobj_DebuggerToolbar){
|
---|
1363 | pobj_DebuggerToolbar->Release();
|
---|
1364 | pobj_DebuggerToolbar=0;
|
---|
1365 | }
|
---|
1366 |
|
---|
1367 | //ヒープオブジェクトを解放
|
---|
1368 | extern HANDLE hHeap;
|
---|
1369 | HeapDestroy(hHeap);
|
---|
1370 |
|
---|
1371 | //DLLを解放
|
---|
1372 | FreeLibrary(hResInst);
|
---|
1373 | FreeLibrary(hIconResInst);
|
---|
1374 | FreeLibrary(hLib_LuxCtrl);
|
---|
1375 |
|
---|
1376 | //アルファブレンド用のAPIを解放
|
---|
1377 | extern HINSTANCE hUser32Lib;
|
---|
1378 | FreeLibrary(hUser32Lib);
|
---|
1379 |
|
---|
1380 |
|
---|
1381 |
|
---|
1382 |
|
---|
1383 | if(bProfessional){
|
---|
1384 | //Pro版は自動バックアップ及び復元機能を有効にする
|
---|
1385 |
|
---|
1386 | //////////////////////////////////////
|
---|
1387 | // バックアップ用ファイルを削除
|
---|
1388 | //////////////////////////////////////
|
---|
1389 | extern char szBackupDirPath[MAX_PATH];
|
---|
1390 | RemoveDirectoryStrong(szBackupDirPath);
|
---|
1391 | }
|
---|
1392 |
|
---|
1393 | }
|
---|
1394 |
|
---|
1395 | //各ウィンドウ生成
|
---|
1396 | void SetupWindow(HWND hwnd){
|
---|
1397 | extern HINSTANCE hInst;
|
---|
1398 | extern HMENU hFirstMainMenu;
|
---|
1399 | RECT rect;
|
---|
1400 | CLIENTCREATESTRUCT ccs;
|
---|
1401 |
|
---|
1402 | INITCOMMONCONTROLSEX InitCommCtrl;
|
---|
1403 | InitCommCtrl.dwSize=sizeof(INITCOMMONCONTROLSEX);
|
---|
1404 | InitCommCtrl.dwICC=ICC_COOL_CLASSES|ICC_PAGESCROLLER_CLASS|ICC_WIN95_CLASSES|ICC_TAB_CLASSES;
|
---|
1405 | InitCommonControlsEx(&InitCommCtrl);
|
---|
1406 |
|
---|
1407 | //タブウィンドウ
|
---|
1408 | pobj_MainTab=new CMainTab(hwnd);
|
---|
1409 |
|
---|
1410 | //MDIの親ウィンドウ(クライアントウィンドウ)を作成
|
---|
1411 | ccs.hWindowMenu=hFirstMainMenu;
|
---|
1412 | ccs.idFirstChild=ID_FIRSTCHILD;
|
---|
1413 | GetClientRect(hwnd,&rect);
|
---|
1414 | hClient=CreateWindowEx(WS_EX_CLIENTEDGE,"MDICLIENT",NULL,
|
---|
1415 | WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_VISIBLE,
|
---|
1416 | 0,0,0,0,
|
---|
1417 | hwnd,(HMENU)1,hInst,(LPSTR)&ccs);
|
---|
1418 |
|
---|
1419 | //レバーオブジェクトを生成
|
---|
1420 | pobj_Rebar=new CMainRebar(hwnd);
|
---|
1421 |
|
---|
1422 | //ステータスバー
|
---|
1423 | extern HWND hStatusBar;
|
---|
1424 | extern HFONT hStatusFont;
|
---|
1425 | hStatusBar=CreateStatusWindow(
|
---|
1426 | WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBARS_SIZEGRIP|CCS_BOTTOM,
|
---|
1427 | NULL,hwnd,NULL);
|
---|
1428 | SendMessage(hStatusBar,WM_SETFONT,(long)hStatusFont,0);
|
---|
1429 |
|
---|
1430 | //プロジェクト ビュー
|
---|
1431 | extern HWND hProjectView;
|
---|
1432 | extern HWND hProjectView_ToolWindow;
|
---|
1433 | RECT *prc;
|
---|
1434 | prc=&pobj_nv->rectProjectView;
|
---|
1435 | hProjectView_ToolWindow=CreateWindowEx(WS_EX_TOOLWINDOW,"ProjectView_ToolWindow","ProjectView",
|
---|
1436 | WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_CLIPCHILDREN,
|
---|
1437 | prc->left,prc->top,prc->right-prc->left,prc->bottom-prc->top,
|
---|
1438 | hwnd,0,hInst,0);
|
---|
1439 | hProjectView=CreateWindowEx(WS_EX_STATICEDGE,"ProjectView","ProjectView",
|
---|
1440 | WS_CHILD|WS_CLIPCHILDREN,
|
---|
1441 | 0,0,0,0,
|
---|
1442 | hwnd,0,hInst,0);
|
---|
1443 | if(pobj_nv->bClipProjectView==0){
|
---|
1444 | SetWindowLong(hProjectView,GWL_EXSTYLE,0);
|
---|
1445 | SetParent(hProjectView,hProjectView_ToolWindow);
|
---|
1446 | ResizeProjectView_ToolWindow();
|
---|
1447 | }
|
---|
1448 |
|
---|
1449 | //メニュー状態を設定
|
---|
1450 | ResetState_DocMenu();
|
---|
1451 |
|
---|
1452 |
|
---|
1453 | //SideWebを生成
|
---|
1454 | pobj_SideWeb=new CSideWeb(hwnd);
|
---|
1455 | }
|
---|
1456 |
|
---|
1457 | //実行コマンド
|
---|
1458 | BOOL SetRunning(HWND hChild){
|
---|
1459 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
1460 | extern LPSTR DefFileFilter;
|
---|
1461 | int WndNum;
|
---|
1462 | char temporary[MAX_PATH],temp2[MAX_PATH];
|
---|
1463 | HANDLE hFind;
|
---|
1464 | WIN32_FIND_DATA wfd;
|
---|
1465 |
|
---|
1466 | extern char *lpszCompilerName;
|
---|
1467 | sprintf(temporary,"%s%s",pj_editor_Dir,lpszCompilerName);
|
---|
1468 | hFind=FindFirstFile(temporary,&wfd);
|
---|
1469 | if(hFind==INVALID_HANDLE_VALUE){
|
---|
1470 | //"BasicCompiler.exe が見つかりません"
|
---|
1471 | MessageBox(hOwner,STRING_ERROR_NOBASICCOMPILER,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
|
---|
1472 | return FALSE;
|
---|
1473 | }
|
---|
1474 | FindClose(hFind);
|
---|
1475 |
|
---|
1476 | WndNum=GetWndNum(hChild);
|
---|
1477 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){
|
---|
1478 | if(MdiInfo[WndNum].path[0]=='\0'){
|
---|
1479 | //"保存先のファイルを指定してください"
|
---|
1480 | if(!GetFilePathDialog(hOwner,temp2,DefFileFilter,STRING_FILESAVETITLE_DEFAULT,0)) return FALSE;
|
---|
1481 |
|
---|
1482 | if(!SaveDocument(hChild,temp2)) return 0;
|
---|
1483 | }
|
---|
1484 | else{
|
---|
1485 | if(MdiInfo[WndNum].pmti->bModify){
|
---|
1486 | if(!SaveDocument(hChild,NULL)) return 0;
|
---|
1487 | }
|
---|
1488 | else{
|
---|
1489 | if(hFind=FindFirstFile(MdiInfo[WndNum].path,&wfd)){
|
---|
1490 | if(hFind==INVALID_HANDLE_VALUE){
|
---|
1491 | if(!SaveDocument(hChild,NULL)) return 0;
|
---|
1492 | }
|
---|
1493 | else FindClose(hFind);
|
---|
1494 | }
|
---|
1495 | }
|
---|
1496 | }
|
---|
1497 | }
|
---|
1498 | return 1;
|
---|
1499 | }
|
---|
1500 |
|
---|
1501 | BOOL IsNeedCompile(char *FileName,BOOL bDebug){
|
---|
1502 | char temporary[MAX_PATH],temp2[MAX_PATH],temp3[MAX_PATH];
|
---|
1503 | HANDLE hFind,hFile;
|
---|
1504 | WIN32_FIND_DATA wfd;
|
---|
1505 | FILETIME SourceTime,ExeTime;
|
---|
1506 |
|
---|
1507 | _splitpath(FileName,temporary,temp2,temp3,NULL);
|
---|
1508 | lstrcat(temporary,temp2);
|
---|
1509 | lstrcat(temporary,temp3);
|
---|
1510 | if(bDebug) lstrcat(temporary,"_debug.exe");
|
---|
1511 | else lstrcat(temporary,".exe");
|
---|
1512 |
|
---|
1513 | hFind=FindFirstFile(temporary,&wfd);
|
---|
1514 | if(hFind==INVALID_HANDLE_VALUE) return 1;
|
---|
1515 | FindClose(hFind);
|
---|
1516 |
|
---|
1517 | hFile=CreateFile(FileName,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
|
---|
1518 | GetFileTime(hFile,NULL,NULL,&SourceTime);
|
---|
1519 | CloseHandle(hFile);
|
---|
1520 |
|
---|
1521 | hFile=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
|
---|
1522 | GetFileTime(hFile,NULL,NULL,&ExeTime);
|
---|
1523 | CloseHandle(hFile);
|
---|
1524 |
|
---|
1525 | if(SourceTime.dwHighDateTime<ExeTime.dwHighDateTime) return 0;
|
---|
1526 | else if(SourceTime.dwHighDateTime==ExeTime.dwHighDateTime&&
|
---|
1527 | SourceTime.dwLowDateTime<=ExeTime.dwLowDateTime) return 0;
|
---|
1528 | return 1;
|
---|
1529 | }
|
---|