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