[475] | 1 | #include "stdafx.h"
|
---|
| 2 |
|
---|
[3] | 3 | #include "Common.h"
|
---|
| 4 |
|
---|
[475] | 5 | using namespace ActiveBasic::IDE;
|
---|
| 6 |
|
---|
[3] | 7 | #if defined(JPN)
|
---|
| 8 | //日本語
|
---|
| 9 | #include "pj_msg_jpn.h"
|
---|
| 10 | #else
|
---|
| 11 | //英語
|
---|
| 12 | #include "pj_msg_eng.h"
|
---|
| 13 | #endif
|
---|
| 14 |
|
---|
[625] | 15 | int GetWndInfoNum( const std::string &name )
|
---|
| 16 | {
|
---|
[618] | 17 | for( int i=0;i<static_cast<int>(projectInfo.windowInfos.size());i++){
|
---|
[625] | 18 | if(lstrcmpi(name.c_str(),projectInfo.windowInfos[i]->GetName().c_str())==0) return i;
|
---|
[3] | 19 | }
|
---|
| 20 | return -1;
|
---|
| 21 | }
|
---|
[625] | 22 | ActiveBasic::PM::WindowInfo *GetWndInfo( const std::string &name )
|
---|
[609] | 23 | {
|
---|
[624] | 24 | BOOST_FOREACH( ActiveBasic::PM::WindowInfo *pWindowInfo, projectInfo.windowInfos )
|
---|
[609] | 25 | {
|
---|
[625] | 26 | if(lstrcmpi(name.c_str(),pWindowInfo->GetName().c_str())==0) return pWindowInfo;
|
---|
[609] | 27 | }
|
---|
| 28 | return NULL;
|
---|
| 29 | }
|
---|
[3] | 30 | void ChangeDivisionToOrSign(char *CopyBuffer,const char *ReadBuffer){
|
---|
| 31 | int i,i2;
|
---|
| 32 | for(i=0,i2=0;;i++,i2++){
|
---|
| 33 | if(ReadBuffer[i]=='|'){
|
---|
| 34 | CopyBuffer[i2]=0;
|
---|
| 35 | lstrcpy(CopyBuffer+i2," or ");
|
---|
| 36 | i2+=3;
|
---|
| 37 | continue;
|
---|
| 38 | }
|
---|
| 39 | CopyBuffer[i2]=ReadBuffer[i];
|
---|
| 40 | if(ReadBuffer[i]=='\0') break;
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
| 43 | void ChangeOrSignToDivision(char *CopyBuffer,const char *ReadBuffer){
|
---|
| 44 | int i,i2,IsStr;
|
---|
| 45 | for(i=0,i2=0,IsStr=0;;i++,i2++){
|
---|
| 46 | if(ReadBuffer[i]=='\"') IsStr^=1;
|
---|
| 47 | if(ReadBuffer[i]=='\0'){
|
---|
| 48 | CopyBuffer[i2]=0;
|
---|
| 49 | break;
|
---|
| 50 | }
|
---|
| 51 | if(ReadBuffer[i+3]=='\0'){
|
---|
| 52 | memcpy(CopyBuffer+i2,ReadBuffer+i,3);
|
---|
| 53 | CopyBuffer[i2+3]=0;
|
---|
| 54 | break;
|
---|
| 55 | }
|
---|
| 56 | if((ReadBuffer[i]==' '||ReadBuffer[i]=='\t')&&
|
---|
| 57 | (ReadBuffer[i+1]=='O'||ReadBuffer[i+1]=='o')&&(ReadBuffer[i+2]=='R'||ReadBuffer[i+2]=='r')&&
|
---|
| 58 | (ReadBuffer[i+3]==' '||ReadBuffer[i+3]=='\t')&&IsStr==0){
|
---|
| 59 | CopyBuffer[i2]='|';
|
---|
| 60 | i+=3;
|
---|
| 61 | continue;
|
---|
| 62 | }
|
---|
| 63 | CopyBuffer[i2]=ReadBuffer[i];
|
---|
| 64 | }
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | HGLOBAL Rad_GetChildInfoClipboardData(int WndNum,int WndInfoNum){
|
---|
[624] | 68 | //ChildWindowInfo構造体をクリップボード用データ(pByteが示すバッファ)に変換する
|
---|
[3] | 69 | HGLOBAL hGlobal;
|
---|
| 70 | BYTE *pByte;
|
---|
| 71 | int i2,i3,MemSize;
|
---|
| 72 |
|
---|
| 73 | for(i3=0;;i3++){
|
---|
[629] | 74 | if(MdiInfo[WndNum]->MdiRadInfo->SelectingItem[i3]==-1) break;
|
---|
[3] | 75 | }
|
---|
| 76 |
|
---|
| 77 |
|
---|
| 78 | hGlobal=GlobalAlloc(GMEM_MOVEABLE,sizeof(int));
|
---|
| 79 | pByte=(BYTE *)GlobalLock(hGlobal);
|
---|
| 80 | *((int *)pByte)=i3;
|
---|
| 81 | GlobalUnlock(hGlobal);
|
---|
| 82 | i2=sizeof(int);
|
---|
| 83 |
|
---|
| 84 | MemSize=i2;
|
---|
| 85 |
|
---|
| 86 | for(i3--;i3>=0;i3--){
|
---|
[629] | 87 | ActiveBasic::PM::ChildWindowInfo *pChildInfo = projectInfo.windowInfos[WndInfoNum]->childWindowInfos[MdiInfo[WndNum]->MdiRadInfo->SelectingItem[i3]];
|
---|
[3] | 88 |
|
---|
[624] | 89 | MemSize+=pChildInfo->GetName().size()+1+
|
---|
[3] | 90 | sizeof(POINT)+
|
---|
| 91 | sizeof(SIZE)+
|
---|
[624] | 92 | pChildInfo->GetCaption().size()+1+
|
---|
[3] | 93 | sizeof(DWORD)+
|
---|
| 94 | sizeof(DWORD)+
|
---|
| 95 | sizeof(int)+
|
---|
| 96 | sizeof(int)+
|
---|
[624] | 97 | pChildInfo->image.path.size()+1;
|
---|
[3] | 98 |
|
---|
| 99 | hGlobal=GlobalReAlloc(hGlobal,MemSize,0);
|
---|
| 100 | pByte=(BYTE *)GlobalLock(hGlobal);
|
---|
| 101 |
|
---|
[624] | 102 | lstrcpy((char *)pByte+i2,pChildInfo->GetName().c_str());
|
---|
| 103 | i2+=pChildInfo->GetName().size()+1;
|
---|
[3] | 104 |
|
---|
| 105 | memcpy(pByte+i2,&pChildInfo->pos,sizeof(POINT));
|
---|
| 106 | i2+=sizeof(POINT);
|
---|
| 107 |
|
---|
| 108 | memcpy(pByte+i2,&pChildInfo->size,sizeof(SIZE));
|
---|
| 109 | i2+=sizeof(SIZE);
|
---|
| 110 |
|
---|
[624] | 111 | lstrcpy((char *)pByte+i2,pChildInfo->GetCaption().c_str());
|
---|
| 112 | i2+=pChildInfo->GetCaption().size()+1;
|
---|
[3] | 113 |
|
---|
[624] | 114 | *(DWORD *)(pByte+i2) = pChildInfo->GetStyle();
|
---|
[3] | 115 | i2+=sizeof(DWORD);
|
---|
| 116 |
|
---|
[624] | 117 | *(DWORD *)(pByte+i2) = pChildInfo->GetExStyle();
|
---|
[3] | 118 | i2+=sizeof(DWORD);
|
---|
| 119 |
|
---|
| 120 | memcpy(pByte+i2,&pChildInfo->Control,sizeof(int));
|
---|
| 121 | i2+=sizeof(int);
|
---|
| 122 |
|
---|
[624] | 123 | memcpy(pByte+i2,&pChildInfo->image.type,sizeof(int));
|
---|
[3] | 124 | i2+=sizeof(int);
|
---|
| 125 |
|
---|
[624] | 126 | if( pChildInfo->image.path.empty() )
|
---|
| 127 | {
|
---|
[3] | 128 | lstrcpy((char *)pByte+i2,"");
|
---|
| 129 | i2++;
|
---|
| 130 | }
|
---|
| 131 | else{
|
---|
[624] | 132 | lstrcpy((char *)pByte+i2,pChildInfo->image.path.c_str());
|
---|
| 133 | i2+=pChildInfo->image.path.size()+1;
|
---|
[3] | 134 | }
|
---|
| 135 |
|
---|
| 136 | GlobalUnlock(hGlobal);
|
---|
| 137 | }
|
---|
| 138 |
|
---|
| 139 | return hGlobal;
|
---|
| 140 | }
|
---|
| 141 | void Rad_PasteChildInfoClipboardData(int WndNum,HGLOBAL hGlobal){
|
---|
| 142 | //hGlobalに格納されているクリップボードデータをRAD画面に挿入する
|
---|
| 143 | BYTE *pByte;
|
---|
| 144 | int i2,i3,WndInfoNum;
|
---|
[624] | 145 | ActiveBasic::PM::ChildWindowInfo ChildInfo;
|
---|
[3] | 146 |
|
---|
[629] | 147 | for(i2=1;i2<MAX_RAD_SELITEM;i2++) MdiInfo[WndNum]->MdiRadInfo->SelectingItem[i2]=-1;
|
---|
[3] | 148 |
|
---|
[629] | 149 | WndInfoNum=GetWndInfoNum(MdiInfo[WndNum]->path);
|
---|
[3] | 150 | pByte=(BYTE *)GlobalLock(hGlobal);
|
---|
| 151 | i3=*((int *)pByte);
|
---|
| 152 | i2=sizeof(int);
|
---|
| 153 |
|
---|
| 154 | for(i3--;i3>=0;i3--){
|
---|
| 155 | //IdNameメンバは変更される可能性がある
|
---|
[624] | 156 | ChildInfo.SetName( (char *)pByte+i2 );
|
---|
| 157 | i2 += ChildInfo.GetName().size()+1;
|
---|
[3] | 158 |
|
---|
| 159 | memcpy(&ChildInfo.pos,pByte+i2,sizeof(POINT));
|
---|
| 160 | i2+=sizeof(POINT);
|
---|
| 161 |
|
---|
| 162 | memcpy(&ChildInfo.size,pByte+i2,sizeof(SIZE));
|
---|
| 163 | i2+=sizeof(SIZE);
|
---|
| 164 |
|
---|
[624] | 165 | ChildInfo.SetCaption( (char *)pByte+i2 );
|
---|
| 166 | i2+=ChildInfo.GetCaption().size()+1;
|
---|
[3] | 167 |
|
---|
[624] | 168 | ChildInfo.SetStyle( *(DWORD *)(pByte+i2) );
|
---|
[3] | 169 | i2+=sizeof(DWORD);
|
---|
| 170 |
|
---|
[624] | 171 | ChildInfo.SetExStyle( *(DWORD *)(pByte+i2) );
|
---|
[3] | 172 | i2+=sizeof(DWORD);
|
---|
| 173 |
|
---|
| 174 | memcpy(&ChildInfo.Control,pByte+i2,sizeof(int));
|
---|
| 175 | i2+=sizeof(int);
|
---|
| 176 |
|
---|
[624] | 177 | memcpy(&ChildInfo.image.type,pByte+i2,sizeof(int));
|
---|
[3] | 178 | i2+=sizeof(int);
|
---|
| 179 |
|
---|
[624] | 180 | ChildInfo.image.path = (char *)pByte+i2;
|
---|
| 181 | i2+=ChildInfo.image.path.size()+1;
|
---|
[3] | 182 |
|
---|
| 183 | ChildInfo.pos.x+=17;
|
---|
| 184 | ChildInfo.pos.y+=10;
|
---|
| 185 |
|
---|
[629] | 186 | MdiInfo[WndNum]->MdiRadInfo->SelectingItem[i3]=InsertDlgItem(WndNum,
|
---|
[3] | 187 | WndInfoNum,
|
---|
| 188 | -1,
|
---|
| 189 | &ChildInfo.pos,
|
---|
| 190 | &ChildInfo.size,
|
---|
[624] | 191 | ChildInfo.GetName().c_str(),
|
---|
| 192 | ChildInfo.GetCaption().c_str(),
|
---|
| 193 | ChildInfo.GetStyle(),
|
---|
| 194 | ChildInfo.GetExStyle(),
|
---|
[3] | 195 | ChildInfo.Control,
|
---|
[624] | 196 | ChildInfo.image.type,
|
---|
| 197 | ChildInfo.image.path.c_str(),
|
---|
[3] | 198 | 2);
|
---|
| 199 | }
|
---|
| 200 |
|
---|
| 201 | GlobalUnlock(hGlobal);
|
---|
| 202 |
|
---|
| 203 | ChangePropertyWindow(WndNum,WndInfoNum);
|
---|
| 204 | }
|
---|
| 205 |
|
---|
[624] | 206 | char *FormatCaption(const char *caption){
|
---|
[3] | 207 | extern HANDLE hHeap;
|
---|
| 208 | int i2,i3,BufSize;
|
---|
| 209 | char *buffer;
|
---|
| 210 |
|
---|
| 211 | BufSize=256*2;
|
---|
| 212 | buffer=(char *)HeapAlloc(hHeap,0,BufSize);
|
---|
| 213 | for(i2=0,i3=0;;i2++,i3++){
|
---|
| 214 | if(i2+256>=BufSize){
|
---|
| 215 | BufSize+=256;
|
---|
| 216 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufSize);
|
---|
| 217 | }
|
---|
| 218 | if(caption[i3]=='\"'){
|
---|
| 219 | lstrcpy(buffer+i2,"\"+Chr$(34)+\"");
|
---|
| 220 | i2+=lstrlen(buffer+i2);
|
---|
| 221 | i2--;
|
---|
| 222 | continue;
|
---|
| 223 | }
|
---|
| 224 | buffer[i2]=caption[i3];
|
---|
| 225 | if(caption[i3]=='\0') break;
|
---|
| 226 | }
|
---|
| 227 |
|
---|
| 228 | return buffer;
|
---|
| 229 | }
|
---|
[624] | 230 | char *SetCaptionSequence(const char *caption){
|
---|
[3] | 231 | extern HANDLE hHeap;
|
---|
| 232 | int i2,i3,BufSize;
|
---|
| 233 | char *buffer;
|
---|
| 234 |
|
---|
| 235 | BufSize=256*2;
|
---|
| 236 | buffer=(char *)HeapAlloc(hHeap,0,BufSize);
|
---|
| 237 | for(i2=0,i3=0;;i2++,i3++){
|
---|
| 238 | if(i2+256>=BufSize){
|
---|
| 239 | BufSize+=256;
|
---|
| 240 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufSize);
|
---|
| 241 | }
|
---|
| 242 | buffer[i2]=caption[i3];
|
---|
| 243 | if(caption[i3]=='\"'){
|
---|
| 244 | buffer[i2++]='\\';
|
---|
| 245 | buffer[i2]='1';
|
---|
| 246 | }
|
---|
| 247 | else if(caption[i3]=='\\'){
|
---|
| 248 | buffer[i2++]='\\';
|
---|
| 249 | buffer[i2]='\\';
|
---|
| 250 | }
|
---|
| 251 | else if(caption[i3]=='\0') break;
|
---|
| 252 | }
|
---|
| 253 |
|
---|
| 254 | return buffer;
|
---|
| 255 | }
|
---|
| 256 | void RestoreCaptionSequence(char *caption){
|
---|
| 257 | int i2,i3;
|
---|
| 258 |
|
---|
| 259 | for(i2=0,i3=0;;i2++,i3++){
|
---|
| 260 | caption[i2]=caption[i3];
|
---|
| 261 | if(caption[i3]=='\\'){
|
---|
| 262 | i3++;
|
---|
| 263 | if(caption[i3]=='1') caption[i2]='\"';
|
---|
| 264 | else caption[i2]=caption[i3];
|
---|
| 265 | }
|
---|
| 266 | else if(caption[i3]=='\0') break;
|
---|
| 267 | }
|
---|
| 268 | }
|
---|
| 269 |
|
---|
| 270 | //テンプレートソースファイルに値をセットする
|
---|
[619] | 271 | char *PermutationWndPgmTemplate(char *pBuf,const char *pPjName, char *pWndName, char *pHandleName, char *pProcName){
|
---|
[3] | 272 | extern HANDLE hHeap;
|
---|
| 273 | int i,i2;
|
---|
| 274 |
|
---|
| 275 | for(i=0;;i++){
|
---|
| 276 | if(pBuf[i]=='\0') break;
|
---|
| 277 | if(memicmp(pBuf+i,"#name#",6)==0){
|
---|
| 278 | //プロジェクト名を置換
|
---|
| 279 | i2=lstrlen(pPjName);
|
---|
| 280 | if(i2>6) pBuf=(char *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,pBuf,lstrlen(pBuf)+(i2-6)+1);
|
---|
| 281 | SlideString(pBuf+i+6,i2-6);
|
---|
| 282 | memcpy(pBuf+i,pPjName,i2);
|
---|
| 283 | }
|
---|
| 284 | if(memicmp(pBuf+i,"#window#",8)==0){
|
---|
| 285 | //ウィンドウ名を置換
|
---|
| 286 | i2=lstrlen(pWndName);
|
---|
| 287 | if(i2>6) pBuf=(char *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,pBuf,lstrlen(pBuf)+(i2-8)+1);
|
---|
| 288 | SlideString(pBuf+i+8,i2-8);
|
---|
| 289 | memcpy(pBuf+i,pWndName,i2);
|
---|
| 290 | }
|
---|
| 291 | if(memicmp(pBuf+i,"#handle#",8)==0){
|
---|
| 292 | //ハンドル名を置換
|
---|
| 293 | i2=lstrlen(pHandleName);
|
---|
| 294 | if(i2>6) pBuf=(char *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,pBuf,lstrlen(pBuf)+(i2-8)+1);
|
---|
| 295 | SlideString(pBuf+i+8,i2-8);
|
---|
| 296 | memcpy(pBuf+i,pHandleName,i2);
|
---|
| 297 | }
|
---|
| 298 | if(memicmp(pBuf+i,"#procedure#",11)==0){
|
---|
| 299 | //プロシージャ名を置換
|
---|
| 300 | i2=lstrlen(pProcName);
|
---|
| 301 | if(i2>6) pBuf=(char *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,pBuf,lstrlen(pBuf)+(i2-11)+1);
|
---|
| 302 | SlideString(pBuf+i+11,i2-11);
|
---|
| 303 | memcpy(pBuf+i,pProcName,i2);
|
---|
| 304 | }
|
---|
| 305 | }
|
---|
| 306 |
|
---|
| 307 | return pBuf;
|
---|
| 308 | }
|
---|
[625] | 309 | const std::string PermutationWndPgmTemplate( const std::string &templateFilePath, const std::string &projectName, const std::string &windowName, const std::string &handleName, const std::string &procName )
|
---|
| 310 | {
|
---|
| 311 | Jenga::Common::SourceTemplate sourceTemplate( templateFilePath );
|
---|
| 312 | Jenga::Common::SourceTemplate::Values values;
|
---|
[3] | 313 |
|
---|
[625] | 314 | values.Insert( "#name#", projectName );
|
---|
| 315 | values.Insert( "#window#", windowName );
|
---|
| 316 | values.Insert( "#handle#", handleName );
|
---|
| 317 | values.Insert( "#procedure#", procName );
|
---|
| 318 |
|
---|
| 319 | return sourceTemplate.GetResult( values );
|
---|
| 320 | }
|
---|
| 321 |
|
---|
[3] | 322 | BOOL GetItemNotifyMessageNameByEvent(char *buffer,int ClassID,const char *EventName){
|
---|
| 323 | if(lstrcmp(EventName,"Click")==0) lstrcpy(buffer,"NM_CLICK");
|
---|
| 324 | else if(lstrcmp(EventName,"CustomDraw")==0) lstrcpy(buffer,"NM_CUSTOMDRAW");
|
---|
| 325 | else if(lstrcmp(EventName,"DblClick")==0) lstrcpy(buffer,"NM_DBLCLK");
|
---|
| 326 | else if(lstrcmp(EventName,"KillFocus")==0) lstrcpy(buffer,"NM_KILLFOCUS");
|
---|
| 327 | else if(lstrcmp(EventName,"OutOfMemory")==0) lstrcpy(buffer,"NM_OUTOFMEMORY");
|
---|
| 328 | else if(lstrcmp(EventName,"RClick")==0) lstrcpy(buffer,"NM_RCLICK");
|
---|
| 329 | else if(lstrcmp(EventName,"RDblClick")==0) lstrcpy(buffer,"NM_RDBLCLK");
|
---|
| 330 | else if(lstrcmp(EventName,"ReleasedCapture")==0) lstrcpy(buffer,"NM_RELEASEDCAPTURE");
|
---|
| 331 | else if(lstrcmp(EventName,"Return")==0) lstrcpy(buffer,"NM_RETURN");
|
---|
| 332 | else if(lstrcmp(EventName,"SetFocus")==0) lstrcpy(buffer,"NM_SETFOCUS");
|
---|
| 333 | else{
|
---|
| 334 | if(ClassID==CT_LISTVIEW){
|
---|
| 335 | if(lstrcmp(EventName,"BeginDrag")==0) lstrcpy(buffer,"LVN_BEGINDRAG");
|
---|
| 336 | else if(lstrcmp(EventName,"BeginLabelEdit")==0) lstrcpy(buffer,"LVN_BEGINLABELEDIT");
|
---|
| 337 | else if(lstrcmp(EventName,"BeginRDrag")==0) lstrcpy(buffer,"LVN_BEGINRDRAG");
|
---|
| 338 | else if(lstrcmp(EventName,"ColumnClick")==0) lstrcpy(buffer,"LVN_COLUMNCLICK");
|
---|
| 339 | else if(lstrcmp(EventName,"DeleteAllItems")==0) lstrcpy(buffer,"LVN_DELETEALLITEMS");
|
---|
| 340 | else if(lstrcmp(EventName,"DeleteItem")==0) lstrcpy(buffer,"LVN_DELETEITEM");
|
---|
| 341 | else if(lstrcmp(EventName,"EndLabelEdit")==0) lstrcpy(buffer,"LVN_ENDLABELEDIT");
|
---|
| 342 | else if(lstrcmp(EventName,"GetDispInfo")==0) lstrcpy(buffer,"LVN_GETDISPINFO");
|
---|
| 343 | else if(lstrcmp(EventName,"InsertItem")==0) lstrcpy(buffer,"LVN_INSERTITEM");
|
---|
| 344 | else if(lstrcmp(EventName,"ItemChanged")==0) lstrcpy(buffer,"LVN_ITEMCHANGED");
|
---|
| 345 | else if(lstrcmp(EventName,"ItemChanging")==0) lstrcpy(buffer,"LVN_ITEMCHANGING");
|
---|
| 346 | else if(lstrcmp(EventName,"KeyDown")==0) lstrcpy(buffer,"LVN_KEYDOWN");
|
---|
| 347 | else if(lstrcmp(EventName,"SetDispInfo")==0) lstrcpy(buffer,"LVN_SETDISPINFO");
|
---|
| 348 | else return 0;
|
---|
| 349 | }
|
---|
| 350 | else if(ClassID==CT_UPDOWN){
|
---|
| 351 | if(lstrcmp(EventName,"Deltapos")==0) lstrcpy(buffer,"UDN_DELTAPOS");
|
---|
| 352 | else return 0;
|
---|
| 353 | }
|
---|
| 354 | else return 0;
|
---|
| 355 | //未完成
|
---|
| 356 | }
|
---|
| 357 | return 1;
|
---|
| 358 | }
|
---|
[624] | 359 | BOOL GetNotifyCommandByItemMessage(ActiveBasic::PM::WindowInfo *pWindowInfo,ITEMEVENTINFO *pItemEventInfo,char *Command,char *spaces){
|
---|
[3] | 360 | int i,i2,i3,sw;
|
---|
| 361 | char temporary[MAX_PATH];
|
---|
| 362 |
|
---|
| 363 | i2=0;
|
---|
| 364 | sw=0;
|
---|
| 365 | for(i=0;;i++){
|
---|
| 366 | if(pItemEventInfo[i].IdName==0) break;
|
---|
| 367 | if(pItemEventInfo[i].ClassID==CT_LISTVIEW||
|
---|
| 368 | pItemEventInfo[i].ClassID==CT_TREEVIEW||
|
---|
| 369 | pItemEventInfo[i].ClassID==CT_UPDOWN||
|
---|
| 370 | pItemEventInfo[i].ClassID==CT_PROGRESSBAR||
|
---|
| 371 | pItemEventInfo[i].ClassID==CT_TRACKBAR){
|
---|
| 372 | //コモン コントロール(WM_NOTIFY)
|
---|
| 373 | sw=1;
|
---|
| 374 | sprintf(Command+i2,"%sCase %s\r\n",spaces,pItemEventInfo[i].IdName);
|
---|
| 375 | i2+=lstrlen(Command+i2);
|
---|
| 376 | sprintf(Command+i2,"%s\tSelect Case pnmHdr->code\r\n",spaces);
|
---|
| 377 | i2+=lstrlen(Command+i2);
|
---|
| 378 | for(i3=0;i3<pItemEventInfo[i].EventNum;i3++){
|
---|
| 379 | if(GetItemNotifyMessageNameByEvent(temporary,pItemEventInfo[i].ClassID,pItemEventInfo[i].pEventNames[i3])){
|
---|
| 380 | sprintf(Command+i2,"%s\t\tCase %s\r\n",spaces,temporary);
|
---|
| 381 | i2+=lstrlen(Command+i2);
|
---|
[617] | 382 | sprintf(Command+i2,"%s\t\t\t%s_%s_%s(ByVal (pnmHdr As VoidPtr))\r\n",
|
---|
| 383 | spaces,
|
---|
| 384 | pWindowInfo->GetName().c_str(),
|
---|
| 385 | pItemEventInfo[i].IdName,pItemEventInfo[i].pEventNames[i3]
|
---|
| 386 | );
|
---|
[3] | 387 | i2+=lstrlen(Command+i2);
|
---|
| 388 | }
|
---|
| 389 | }
|
---|
| 390 | sprintf(Command+i2,"%s\tEnd Select\r\n",spaces);
|
---|
| 391 | i2+=lstrlen(Command+i2);
|
---|
| 392 | }
|
---|
| 393 | }
|
---|
| 394 | return sw;
|
---|
| 395 | }
|
---|
| 396 | void GetItemMessageNameByEvent(char *buffer,int ClassID,const char *EventName){
|
---|
| 397 | if(ClassID==CT_BUTTON||
|
---|
| 398 | ClassID==CT_CHECKBOX||
|
---|
| 399 | ClassID==CT_RADIOBUTTON){
|
---|
| 400 | if(lstrcmp(EventName,"Click")==0) lstrcpy(buffer,"BN_CLICKED");
|
---|
| 401 | else if(lstrcmp(EventName,"DblClick")==0) lstrcpy(buffer,"BN_DBLCLK");
|
---|
| 402 | }
|
---|
| 403 | else if(ClassID==CT_COMBOBOX){
|
---|
| 404 | if(lstrcmp(EventName,"CloseUp")==0) lstrcpy(buffer,"CBN_CLOSEUP");
|
---|
| 405 | else if(lstrcmp(EventName,"DblClick")==0) lstrcpy(buffer,"CBN_DBLCLK");
|
---|
| 406 | else if(lstrcmp(EventName,"DropDown")==0) lstrcpy(buffer,"CBN_DROPDOWN");
|
---|
| 407 | else if(lstrcmp(EventName,"EditChange")==0) lstrcpy(buffer,"CBN_EDITCHANGE");
|
---|
| 408 | else if(lstrcmp(EventName,"EditUpdate")==0) lstrcpy(buffer,"CBN_EDITUPDATE");
|
---|
| 409 | else if(lstrcmp(EventName,"ErrSpace")==0) lstrcpy(buffer,"CBN_ERRSPACE");
|
---|
| 410 | else if(lstrcmp(EventName,"KillFocus")==0) lstrcpy(buffer,"CBN_KILLFOCUS");
|
---|
| 411 | else if(lstrcmp(EventName,"SelChange")==0) lstrcpy(buffer,"CBN_SELCHANGE");
|
---|
| 412 | else if(lstrcmp(EventName,"SelEndCancel")==0) lstrcpy(buffer,"CBN_SELENDCANCEL");
|
---|
| 413 | else if(lstrcmp(EventName,"SelEndOk")==0) lstrcpy(buffer,"CBN_SELENDOK");
|
---|
| 414 | else if(lstrcmp(EventName,"SetFocus")==0) lstrcpy(buffer,"CBN_SETFOCUS");
|
---|
| 415 | }
|
---|
| 416 | else if(ClassID==CT_EDIT){
|
---|
| 417 | if(lstrcmp(EventName,"Change")==0) lstrcpy(buffer,"EN_CHANGE");
|
---|
| 418 | else if(lstrcmp(EventName,"ErrSpace")==0) lstrcpy(buffer,"EN_ERRSPACE");
|
---|
| 419 | else if(lstrcmp(EventName,"HScroll")==0) lstrcpy(buffer,"EN_HSCROLL");
|
---|
| 420 | else if(lstrcmp(EventName,"KillFocus")==0) lstrcpy(buffer,"EN_KILLFOCUS");
|
---|
| 421 | else if(lstrcmp(EventName,"MaxText")==0) lstrcpy(buffer,"EN_MAXTEXT");
|
---|
| 422 | else if(lstrcmp(EventName,"SetFocus")==0) lstrcpy(buffer,"EN_SETFOCUS");
|
---|
| 423 | else if(lstrcmp(EventName,"Update")==0) lstrcpy(buffer,"EN_UPDATE");
|
---|
| 424 | else if(lstrcmp(EventName,"VScroll")==0) lstrcpy(buffer,"EN_VSCROLL");
|
---|
| 425 | }
|
---|
| 426 | else if(ClassID==CT_IMAGEBOX||
|
---|
| 427 | ClassID==CT_STATIC){
|
---|
| 428 | if(lstrcmp(EventName,"Click")==0) lstrcpy(buffer,"STN_CLICKED");
|
---|
| 429 | else if(lstrcmp(EventName,"DblClick")==0) lstrcpy(buffer,"STN_DBLCLK");
|
---|
| 430 | }
|
---|
| 431 | else if(ClassID==CT_LISTBOX){
|
---|
| 432 | if(lstrcmp(EventName,"SelChange")==0) lstrcpy(buffer,"LBN_SELCHANGE");
|
---|
| 433 | else if(lstrcmp(EventName,"DblClick")==0) lstrcpy(buffer,"LBN_DBLCLK");
|
---|
| 434 | else if(lstrcmp(EventName,"ErrSpace")==0) lstrcpy(buffer,"LBN_ERRSPACE");
|
---|
| 435 | else if(lstrcmp(EventName,"KillFocus")==0) lstrcpy(buffer,"LBN_KILLFOCUS");
|
---|
| 436 | else if(lstrcmp(EventName,"SelCancel")==0) lstrcpy(buffer,"LBN_SELCANCEL");
|
---|
| 437 | else if(lstrcmp(EventName,"SetFocus")==0) lstrcpy(buffer,"LBN_SETFOCUS");
|
---|
| 438 | }
|
---|
| 439 | }
|
---|
[624] | 440 | void GetCommandByItemMessage(ActiveBasic::PM::WindowInfo *pWindowInfo,ITEMEVENTINFO *pItemEventInfo,char *Command,char *spaces){
|
---|
[3] | 441 | extern HANDLE hHeap;
|
---|
| 442 | int i,i2,i3;
|
---|
| 443 | char temporary[MAX_PATH];
|
---|
| 444 |
|
---|
| 445 | i2=0;
|
---|
| 446 | for(i=0;;i++){
|
---|
| 447 | if(pItemEventInfo[i].IdName==0) break;
|
---|
| 448 | if(pItemEventInfo[i].ClassID!=CT_LISTVIEW&&
|
---|
| 449 | pItemEventInfo[i].ClassID!=CT_PROGRESSBAR&&
|
---|
| 450 | pItemEventInfo[i].ClassID!=CT_TREEVIEW&&
|
---|
| 451 | pItemEventInfo[i].ClassID!=CT_TRACKBAR&&
|
---|
| 452 | pItemEventInfo[i].ClassID!=CT_UPDOWN
|
---|
| 453 | ){
|
---|
| 454 | //WM_COMMAND
|
---|
| 455 | sprintf(Command+i2,"%sCase %s\r\n",spaces,pItemEventInfo[i].IdName);
|
---|
| 456 | i2+=lstrlen(Command+i2);
|
---|
| 457 | if(pItemEventInfo[i].ClassID==CT_MENU){
|
---|
[617] | 458 | sprintf(Command+i2,"%s\t%s_%s_MenuClick()\r\n",spaces,pWindowInfo->GetName().c_str(),pItemEventInfo[i].IdName);
|
---|
[3] | 459 | i2+=lstrlen(Command+i2);
|
---|
| 460 | for(i3=0;i3<pItemEventInfo[i].EventNum;i3++)
|
---|
| 461 | HeapDefaultFree(pItemEventInfo[i].pEventNames[i3]);
|
---|
| 462 | }
|
---|
| 463 | else{
|
---|
| 464 | sprintf(Command+i2,"%s\tSelect Case HIWORD(wParam)\r\n",spaces);
|
---|
| 465 | i2+=lstrlen(Command+i2);
|
---|
| 466 | for(i3=0;i3<pItemEventInfo[i].EventNum;i3++){
|
---|
| 467 | GetItemMessageNameByEvent(temporary,pItemEventInfo[i].ClassID,pItemEventInfo[i].pEventNames[i3]);
|
---|
| 468 | sprintf(Command+i2,"%s\t\tCase %s\r\n",spaces,temporary);
|
---|
| 469 | i2+=lstrlen(Command+i2);
|
---|
[617] | 470 | sprintf(Command+i2,"%s\t\t\t%s_%s_%s()\r\n",spaces,pWindowInfo->GetName().c_str(),pItemEventInfo[i].IdName,pItemEventInfo[i].pEventNames[i3]);
|
---|
[3] | 471 | i2+=lstrlen(Command+i2);
|
---|
| 472 | HeapDefaultFree(pItemEventInfo[i].pEventNames[i3]);
|
---|
| 473 | }
|
---|
| 474 | sprintf(Command+i2,"%s\tEnd Select\r\n",spaces);
|
---|
| 475 | i2+=lstrlen(Command+i2);
|
---|
| 476 | }
|
---|
| 477 | HeapDefaultFree(pItemEventInfo[i].IdName);
|
---|
| 478 | HeapDefaultFree(pItemEventInfo[i].pEventNames);
|
---|
| 479 | }
|
---|
| 480 | else{
|
---|
| 481 | //WM_NOTIFY情報のメモリ解放
|
---|
| 482 | for(i3=0;i3<pItemEventInfo[i].EventNum;i3++)
|
---|
| 483 | HeapDefaultFree(pItemEventInfo[i].pEventNames[i3]);
|
---|
| 484 | HeapDefaultFree(pItemEventInfo[i].IdName);
|
---|
| 485 | HeapDefaultFree(pItemEventInfo[i].pEventNames);
|
---|
| 486 | }
|
---|
| 487 | }
|
---|
| 488 | }
|
---|
| 489 |
|
---|
| 490 | void GetItemClassName(char *buffer,int Control){
|
---|
| 491 | switch(Control){
|
---|
| 492 | case CT_BUTTON:
|
---|
| 493 | case CT_CHECKBOX:
|
---|
| 494 | case CT_GROUPBOX:
|
---|
| 495 | case CT_RADIOBUTTON:
|
---|
| 496 | lstrcpy(buffer,"BUTTON");
|
---|
| 497 | break;
|
---|
| 498 | case CT_COMBOBOX:
|
---|
| 499 | lstrcpy(buffer,"COMBOBOX");
|
---|
| 500 | break;
|
---|
| 501 | case CT_EDIT:
|
---|
| 502 | lstrcpy(buffer,"EDIT");
|
---|
| 503 | break;
|
---|
| 504 | case CT_HSCROLLBAR:
|
---|
| 505 | case CT_VSCROLLBAR:
|
---|
| 506 | lstrcpy(buffer,"SCROLLBAR");
|
---|
| 507 | break;
|
---|
| 508 | case CT_LISTBOX:
|
---|
| 509 | lstrcpy(buffer,"LISTBOX");
|
---|
| 510 | break;
|
---|
| 511 | case CT_LISTVIEW:
|
---|
| 512 | lstrcpy(buffer,"SysListView32");
|
---|
| 513 | break;
|
---|
| 514 | case CT_IMAGEBOX:
|
---|
| 515 | case CT_STATIC:
|
---|
| 516 | lstrcpy(buffer,"STATIC");
|
---|
| 517 | break;
|
---|
| 518 | case CT_PROGRESSBAR:
|
---|
| 519 | lstrcpy(buffer,"msctls_progress32");
|
---|
| 520 | break;
|
---|
| 521 | case CT_TRACKBAR:
|
---|
| 522 | lstrcpy(buffer,"msctls_trackbar32");
|
---|
| 523 | break;
|
---|
| 524 | case CT_TREEVIEW:
|
---|
| 525 | lstrcpy(buffer,"SysTreeView32");
|
---|
| 526 | break;
|
---|
| 527 | //CT_UPDOWNはCreateUpDownControl関数で独自に作成される
|
---|
| 528 | }
|
---|
| 529 | }
|
---|
| 530 | long GetCommandByMessage(int WndInfoNum,const char *MessageName,BOOL bProcedureCall,char *Command,char *spaces){
|
---|
| 531 | int i,i2,sw;
|
---|
| 532 | char temporary[MAX_PATH],*temp2;
|
---|
| 533 |
|
---|
[624] | 534 | ActiveBasic::PM::WindowInfo *pWindowInfo = projectInfo.windowInfos[WndInfoNum];
|
---|
[3] | 535 |
|
---|
| 536 | Command[0]=0;
|
---|
| 537 |
|
---|
| 538 |
|
---|
| 539 | /////////////////////
|
---|
| 540 | // Default コマンド
|
---|
| 541 |
|
---|
| 542 | if(lstrcmp(MessageName,"Activate")==0){
|
---|
| 543 | sprintf(Command,"%sCase WM_ACTIVATE\r\n",spaces);
|
---|
| 544 | i=lstrlen(Command);
|
---|
[617] | 545 | sprintf(Command+i,"%s\t%s_%s(LOWORD(wParam),HIWORD(wParam))\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 546 | }
|
---|
| 547 | else if(lstrcmp(MessageName,"Create")==0){
|
---|
[625] | 548 | if( pWindowInfo->IsModalDlg() || pWindowInfo->IsModelessDlg() )
|
---|
| 549 | {
|
---|
[3] | 550 | sprintf(Command,"%sCase WM_INITDIALOG\r\n",spaces);
|
---|
[625] | 551 | }
|
---|
| 552 | else
|
---|
| 553 | {
|
---|
| 554 | sprintf(Command,"%sCase WM_CREATE\r\n",spaces);
|
---|
| 555 | }
|
---|
[3] | 556 | i=lstrlen(Command);
|
---|
| 557 |
|
---|
[617] | 558 | sprintf(Command+i,"%s\t%s=hWnd\r\n",spaces,pWindowInfo->GetHandleName().c_str());
|
---|
[3] | 559 | i+=lstrlen(Command+i);
|
---|
| 560 |
|
---|
[624] | 561 | if( pWindowInfo->HasMenu() )
|
---|
| 562 | {
|
---|
[3] | 563 | //メニュー作成
|
---|
[618] | 564 | for(i2=0;i2<projectInfo.NumberOfMenu;i2++){
|
---|
[624] | 565 | if(lstrcmpi(projectInfo.pMenuInfo[i2].IdName,pWindowInfo->GetMenuIdName().c_str())==0) break;
|
---|
[3] | 566 | }
|
---|
[618] | 567 | if(i2!=projectInfo.NumberOfMenu){
|
---|
| 568 | sprintf(Command+i,"%s\tSetMenu(hWnd,hMenu_%s)\r\n",spaces,projectInfo.pMenuInfo[i2].IdName);
|
---|
[3] | 569 | i+=lstrlen(Command+i);
|
---|
| 570 | }
|
---|
| 571 | }
|
---|
| 572 |
|
---|
| 573 | //子ウィンドウ作成
|
---|
[616] | 574 | sw = 0;
|
---|
[624] | 575 | BOOST_FOREACH( const ActiveBasic::PM::ChildWindowInfo *pChildInfo, pWindowInfo->childWindowInfos )
|
---|
[616] | 576 | {
|
---|
| 577 | if(pChildInfo->Control==CT_UPDOWN){
|
---|
[3] | 578 | sprintf(Command+i,"%s\tCreateUpDownControl(%d,%d,%d,%d,%d,hWnd,%s,GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,0,0,100,0)\r\n",
|
---|
| 579 | spaces,
|
---|
[624] | 580 | pChildInfo->GetStyle(),
|
---|
[616] | 581 | pChildInfo->pos.x,pChildInfo->pos.y,
|
---|
| 582 | pChildInfo->size.cx,pChildInfo->size.cy,
|
---|
[624] | 583 | pChildInfo->GetName().c_str());
|
---|
[3] | 584 | i+=lstrlen(Command+i);
|
---|
| 585 | }
|
---|
| 586 | else{
|
---|
[616] | 587 | GetItemClassName(temporary,pChildInfo->Control);
|
---|
[624] | 588 | temp2=FormatCaption(pChildInfo->GetCaption().c_str());
|
---|
[3] | 589 | sprintf(Command+i,"%s\tCreateWindowEx(&H%08x,\"%s\",\"%s\",&H%08x,%d,%d,%d,%d,hWnd,%s As HMENU,GetModuleHandle(0),0)\r\n",
|
---|
| 590 | spaces,
|
---|
[624] | 591 | pChildInfo->GetExStyle(),
|
---|
[3] | 592 | temporary,
|
---|
| 593 | temp2,
|
---|
[624] | 594 | pChildInfo->GetStyle(),
|
---|
[616] | 595 | pChildInfo->pos.x,
|
---|
| 596 | pChildInfo->pos.y,
|
---|
| 597 | pChildInfo->size.cx,
|
---|
| 598 | pChildInfo->size.cy,
|
---|
[624] | 599 | pChildInfo->GetName().c_str());
|
---|
[3] | 600 | i+=lstrlen(Command+i);
|
---|
| 601 | HeapDefaultFree(temp2);
|
---|
| 602 | sprintf(Command+i,"%s\tSendMessage(GetDlgItem(hWnd,%s),WM_SETFONT,hFont_%s As WPARAM,0)\r\n",
|
---|
| 603 | spaces,
|
---|
[624] | 604 | pChildInfo->GetName().c_str(),
|
---|
[617] | 605 | pWindowInfo->GetName().c_str());
|
---|
[3] | 606 | i+=lstrlen(Command+i);
|
---|
| 607 |
|
---|
[616] | 608 | if(pChildInfo->Control==CT_IMAGEBOX){
|
---|
[3] | 609 | //イメージ ボックスの場合
|
---|
[624] | 610 | if((pChildInfo->GetStyle()&0x000F)==SS_ICON){
|
---|
| 611 | if(pChildInfo->image.IsFile()){
|
---|
| 612 | if(strstr(pChildInfo->image.path.c_str(),":")||
|
---|
| 613 | strstr(pChildInfo->image.path.c_str(),"\\\\")){
|
---|
[3] | 614 | sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,\"%s\",IMAGE_ICON,0,0,LR_DEFAULTSIZE or LR_LOADFROMFILE)\r\n",
|
---|
| 615 | spaces,
|
---|
[617] | 616 | pWindowInfo->GetName().c_str(),
|
---|
[624] | 617 | pChildInfo->GetName().c_str(),
|
---|
| 618 | pChildInfo->image.path.c_str());
|
---|
[3] | 619 | }
|
---|
| 620 | else{
|
---|
| 621 | if(sw==0){
|
---|
| 622 | sw=1;
|
---|
| 623 | lstrcpy(Command+i,"\r\n");
|
---|
| 624 | i+=2;
|
---|
| 625 | sprintf(Command+i,"%s\tDim ImageFilePath[MAX_PATH] As Byte\r\n",spaces);
|
---|
| 626 | i+=lstrlen(Command+i);
|
---|
| 627 | sprintf(Command+i,"%s\tDim ModulePath[MAX_PATH] As Byte, i As Long\r\n",spaces);
|
---|
| 628 | i+=lstrlen(Command+i);
|
---|
| 629 | sprintf(Command+i,"%s\tGetModuleFileName(GetModuleHandle(0),ModulePath,MAX_PATH)\r\n",spaces);
|
---|
| 630 | i+=lstrlen(Command+i);
|
---|
| 631 | sprintf(Command+i,"%s\tFor i=lstrlen(ModulePath)-1 To 0 Step -1\r\n",spaces);
|
---|
| 632 | i+=lstrlen(Command+i);
|
---|
| 633 | sprintf(Command+i,"%s\t\tIf ModulePath[i]=&H5C Then Exit For\r\n",spaces);
|
---|
| 634 | i+=lstrlen(Command+i);
|
---|
| 635 | sprintf(Command+i,"%s\tNext\r\n",spaces);
|
---|
| 636 | i+=lstrlen(Command+i);
|
---|
| 637 | sprintf(Command+i,"%s\tModulePath[i+1]=0\r\n",spaces);
|
---|
| 638 | i+=lstrlen(Command+i);
|
---|
| 639 | lstrcpy(Command+i,"\r\n");
|
---|
| 640 | i+=2;
|
---|
| 641 | }
|
---|
[624] | 642 | sprintf(Command+i,"%s\twsprintf(ImageFilePath,\"%%s%s\",ModulePath)\r\n",spaces,pChildInfo->image.path.c_str());
|
---|
[3] | 643 | i+=lstrlen(Command+i);
|
---|
| 644 | sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,ImageFilePath,IMAGE_ICON,0,0,LR_DEFAULTSIZE or LR_LOADFROMFILE)\r\n",
|
---|
| 645 | spaces,
|
---|
[617] | 646 | pWindowInfo->GetName().c_str(),
|
---|
[624] | 647 | pChildInfo->GetName().c_str());
|
---|
[3] | 648 | }
|
---|
| 649 | i+=lstrlen(Command+i);
|
---|
| 650 | }
|
---|
[624] | 651 | else if(pChildInfo->image.IsResource()){
|
---|
[3] | 652 | sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,%s As *Byte,IMAGE_ICON,0,0,LR_DEFAULTSIZE)\r\n",
|
---|
| 653 | spaces,
|
---|
[617] | 654 | pWindowInfo->GetName().c_str(),
|
---|
[624] | 655 | pChildInfo->GetName().c_str(),
|
---|
| 656 | pChildInfo->image.path.c_str());
|
---|
[3] | 657 | i+=lstrlen(Command+i);
|
---|
| 658 | }
|
---|
| 659 | sprintf(Command+i,"%s\tSendMessage(GetDlgItem(hWnd,%s),STM_SETICON,hImage_%s_%s As WPARAM,0)\r\n",
|
---|
| 660 | spaces,
|
---|
[624] | 661 | pChildInfo->GetName().c_str(),
|
---|
[617] | 662 | pWindowInfo->GetName().c_str(),
|
---|
[624] | 663 | pChildInfo->GetName().c_str());
|
---|
[3] | 664 | i+=lstrlen(Command+i);
|
---|
| 665 | }
|
---|
[624] | 666 | else if((pChildInfo->GetStyle()&0x000F)==SS_BITMAP){
|
---|
| 667 | if(pChildInfo->image.IsFile()){
|
---|
| 668 | if(strstr(pChildInfo->image.path.c_str(),":")||
|
---|
| 669 | strstr(pChildInfo->image.path.c_str(),"\\\\")){
|
---|
[3] | 670 | sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,\"%s\",IMAGE_BITMAP,0,0,LR_DEFAULTSIZE or LR_LOADFROMFILE)\r\n",
|
---|
| 671 | spaces,
|
---|
[617] | 672 | pWindowInfo->GetName().c_str(),
|
---|
[624] | 673 | pChildInfo->GetName().c_str(),
|
---|
| 674 | pChildInfo->image.path.c_str());
|
---|
[3] | 675 | }
|
---|
| 676 | else{
|
---|
| 677 | if(sw==0){
|
---|
| 678 | sw=1;
|
---|
| 679 | lstrcpy(Command+i,"\r\n");
|
---|
| 680 | i+=2;
|
---|
| 681 | sprintf(Command+i,"%s\tDim ImageFilePath[MAX_PATH] As Byte\r\n",spaces);
|
---|
| 682 | i+=lstrlen(Command+i);
|
---|
| 683 | sprintf(Command+i,"%s\tDim ModulePath[MAX_PATH] As Byte, i As Long\r\n",spaces);
|
---|
| 684 | i+=lstrlen(Command+i);
|
---|
| 685 | sprintf(Command+i,"%s\tGetModuleFileName(GetModuleHandle(0),ModulePath,MAX_PATH)\r\n",spaces);
|
---|
| 686 | i+=lstrlen(Command+i);
|
---|
| 687 | sprintf(Command+i,"%s\tFor i=lstrlen(ModulePath)-1 To 0 Step -1\r\n",spaces);
|
---|
| 688 | i+=lstrlen(Command+i);
|
---|
| 689 | sprintf(Command+i,"%s\t\tIf ModulePath[i]=&H5C Then Exit For\r\n",spaces);
|
---|
| 690 | i+=lstrlen(Command+i);
|
---|
| 691 | sprintf(Command+i,"%s\tNext\r\n",spaces);
|
---|
| 692 | i+=lstrlen(Command+i);
|
---|
| 693 | sprintf(Command+i,"%s\tModulePath[i+1]=0\r\n",spaces);
|
---|
| 694 | i+=lstrlen(Command+i);
|
---|
| 695 | lstrcpy(Command+i,"\r\n");
|
---|
| 696 | i+=2;
|
---|
| 697 | }
|
---|
[624] | 698 | sprintf(Command+i,"%s\twsprintf(ImageFilePath,\"%%s%s\",ModulePath)\r\n",spaces,pChildInfo->image.path.c_str());
|
---|
[3] | 699 | i+=lstrlen(Command+i);
|
---|
| 700 | sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,ImageFilePath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE)\r\n",
|
---|
| 701 | spaces,
|
---|
[617] | 702 | pWindowInfo->GetName().c_str(),
|
---|
[624] | 703 | pChildInfo->GetName().c_str());
|
---|
[3] | 704 | }
|
---|
| 705 | i+=lstrlen(Command+i);
|
---|
| 706 | }
|
---|
[624] | 707 | else if(pChildInfo->image.IsResource()){
|
---|
[3] | 708 | sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,%s As *Byte,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE)\r\n",
|
---|
| 709 | spaces,
|
---|
[617] | 710 | pWindowInfo->GetName().c_str(),
|
---|
[624] | 711 | pChildInfo->GetName().c_str(),
|
---|
| 712 | pChildInfo->image.path.c_str());
|
---|
[3] | 713 | i+=lstrlen(Command+i);
|
---|
| 714 | }
|
---|
| 715 | sprintf(Command+i,"%s\tSendMessage(GetDlgItem(hWnd,%s),STM_SETIMAGE,IMAGE_BITMAP,hImage_%s_%s As LPARAM)\r\n",
|
---|
| 716 | spaces,
|
---|
[624] | 717 | pChildInfo->GetName().c_str(),
|
---|
[617] | 718 | pWindowInfo->GetName().c_str(),
|
---|
[624] | 719 | pChildInfo->GetName().c_str());
|
---|
[3] | 720 | i+=lstrlen(Command+i);
|
---|
| 721 | }
|
---|
| 722 | }
|
---|
| 723 | }
|
---|
| 724 | }
|
---|
| 725 |
|
---|
| 726 | if(bProcedureCall)
|
---|
[617] | 727 | sprintf(Command+i,"%s\t%s_%s(ByVal (lParam As VoidPtr))\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 728 | return WM_CREATE;
|
---|
| 729 | }
|
---|
| 730 | else if(lstrcmp(MessageName,"Destroy")==0){
|
---|
| 731 | sprintf(Command,"%sCase WM_DESTROY\r\n",spaces);
|
---|
| 732 | i=lstrlen(Command);
|
---|
| 733 | if(bProcedureCall){
|
---|
[617] | 734 | sprintf(Command+i,"%s\t%s_%s()\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 735 | i+=lstrlen(Command+i);
|
---|
| 736 | }
|
---|
| 737 |
|
---|
[624] | 738 | if( pWindowInfo->HasMenu() )
|
---|
| 739 | {
|
---|
[3] | 740 | //メニューを解放
|
---|
[618] | 741 | for(i2=0;i2<projectInfo.NumberOfMenu;i2++){
|
---|
[624] | 742 | if(lstrcmpi(projectInfo.pMenuInfo[i2].IdName,pWindowInfo->GetMenuIdName().c_str())==0) break;
|
---|
[3] | 743 | }
|
---|
[618] | 744 | if(i2!=projectInfo.NumberOfMenu){
|
---|
[3] | 745 | sprintf(Command+i,"%s\tSetMenu(hWnd,NULL)\r\n",spaces);
|
---|
| 746 | i+=lstrlen(Command+i);
|
---|
| 747 | }
|
---|
| 748 | }
|
---|
| 749 |
|
---|
| 750 | //イメージ ボックス用の変数を解放
|
---|
[624] | 751 | BOOST_FOREACH( const ActiveBasic::PM::ChildWindowInfo *pChildInfo, pWindowInfo->childWindowInfos )
|
---|
[616] | 752 | {
|
---|
| 753 | if(pChildInfo->Control==CT_IMAGEBOX){
|
---|
[624] | 754 | if((pChildInfo->GetStyle()&0x000F)==SS_ICON)
|
---|
| 755 | sprintf(Command+i,"%s\tDestroyIcon(hImage_%s_%s)\r\n",spaces,pWindowInfo->GetName().c_str(),pChildInfo->GetName().c_str());
|
---|
| 756 | else if((pChildInfo->GetStyle()&0x000F)==SS_BITMAP)
|
---|
| 757 | sprintf(Command+i,"%s\tDeleteObject(hImage_%s_%s)\r\n",spaces,pWindowInfo->GetName().c_str(),pChildInfo->GetName().c_str());
|
---|
[3] | 758 | i+=lstrlen(Command+i);
|
---|
| 759 | }
|
---|
| 760 | }
|
---|
| 761 | return WM_DESTROY;
|
---|
| 762 | }
|
---|
| 763 | else if(lstrcmp(MessageName,"DropFiles")==0){
|
---|
| 764 | sprintf(Command,"%sCase WM_DROPFILES\r\n",spaces);
|
---|
| 765 | i=lstrlen(Command);
|
---|
[617] | 766 | sprintf(Command+i,"%s\t%s_%s(wParam As HDROP)\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 767 | }
|
---|
| 768 | else if(lstrcmp(MessageName,"HScroll")==0){
|
---|
| 769 | sprintf(Command,"%sCase WM_HSCROLL\r\n",spaces);
|
---|
| 770 | i=lstrlen(Command);
|
---|
[617] | 771 | sprintf(Command+i,"%s\t%s_%s(LOWORD(wParam),HIWORD(wParam),lParam As HWND)\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 772 | }
|
---|
| 773 | else if(lstrcmp(MessageName,"KeyDown")==0){
|
---|
| 774 | sprintf(Command,"%sCase WM_KEYDOWN\r\n",spaces);
|
---|
| 775 | i=lstrlen(Command);
|
---|
[617] | 776 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,lParam As Long)\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 777 | }
|
---|
| 778 | else if(lstrcmp(MessageName,"KeyPress")==0){
|
---|
| 779 | sprintf(Command,"%sCase WM_CHAR\r\n",spaces);
|
---|
| 780 | i=lstrlen(Command);
|
---|
[617] | 781 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,lParam As Long)\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 782 | }
|
---|
| 783 | else if(lstrcmp(MessageName,"KeyUp")==0){
|
---|
| 784 | sprintf(Command,"%sCase WM_KEYUP\r\n",spaces);
|
---|
| 785 | i=lstrlen(Command);
|
---|
[617] | 786 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,lParam As Long)\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 787 | }
|
---|
| 788 | else if(lstrcmp(MessageName,"LButtonDown")==0){
|
---|
| 789 | sprintf(Command,"%sCase WM_LBUTTONDOWN\r\n",spaces);
|
---|
| 790 | i=lstrlen(Command);
|
---|
[617] | 791 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 792 | }
|
---|
| 793 | else if(lstrcmp(MessageName,"LButtonDblClick")==0){
|
---|
| 794 | sprintf(Command,"%sCase WM_LBUTTONDBLCLK\r\n",spaces);
|
---|
| 795 | i=lstrlen(Command);
|
---|
[617] | 796 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 797 | }
|
---|
| 798 | else if(lstrcmp(MessageName,"LButtonUp")==0){
|
---|
| 799 | sprintf(Command,"%sCase WM_LBUTTONUP\r\n",spaces);
|
---|
| 800 | i=lstrlen(Command);
|
---|
[617] | 801 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 802 | }
|
---|
| 803 | else if(lstrcmp(MessageName,"MButtonDown")==0){
|
---|
| 804 | sprintf(Command,"%sCase WM_MBUTTONDOWN\r\n",spaces);
|
---|
| 805 | i=lstrlen(Command);
|
---|
[617] | 806 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 807 | }
|
---|
| 808 | else if(lstrcmp(MessageName,"MButtonDblClick")==0){
|
---|
| 809 | sprintf(Command,"%sCase WM_MBUTTONDBLCLK\r\n",spaces);
|
---|
| 810 | i=lstrlen(Command);
|
---|
[617] | 811 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 812 | }
|
---|
| 813 | else if(lstrcmp(MessageName,"MButtonUp")==0){
|
---|
| 814 | sprintf(Command,"%sCase WM_MBUTTONUP\r\n",spaces);
|
---|
| 815 | i=lstrlen(Command);
|
---|
[617] | 816 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 817 | }
|
---|
| 818 | else if(lstrcmp(MessageName,"MouseMove")==0){
|
---|
| 819 | sprintf(Command,"%sCase WM_MOUSEMOVE\r\n",spaces);
|
---|
| 820 | i=lstrlen(Command);
|
---|
[617] | 821 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 822 | }
|
---|
| 823 | else if(lstrcmp(MessageName,"Move")==0){
|
---|
| 824 | sprintf(Command,"%sCase WM_MOVE\r\n",spaces);
|
---|
| 825 | i=lstrlen(Command);
|
---|
[617] | 826 | sprintf(Command+i,"%s\t%s_%s(LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 827 | }
|
---|
| 828 | else if(lstrcmp(MessageName,"Notify")==0){
|
---|
| 829 | //コモンコントロールメッセージと共に挿入
|
---|
| 830 | return WM_NOTIFY;
|
---|
| 831 | }
|
---|
| 832 | else if(lstrcmp(MessageName,"Paint")==0){
|
---|
| 833 | sprintf(Command,"%sCase WM_PAINT\r\n",spaces);
|
---|
| 834 | i=lstrlen(Command);
|
---|
| 835 | sprintf(Command+i,"%s\tDim ps As PAINTSTRUCT\r\n",spaces);
|
---|
| 836 | i+=lstrlen(Command+i);
|
---|
| 837 | sprintf(Command+i,"%s\tDim hDC As HDC\r\n",spaces);
|
---|
| 838 | i+=lstrlen(Command+i);
|
---|
| 839 | sprintf(Command+i,"%s\thDC=BeginPaint(hWnd,ps)\r\n",spaces);
|
---|
| 840 | i+=lstrlen(Command+i);
|
---|
[617] | 841 | sprintf(Command+i,"%s\t%s_%s(hDC)\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 842 | i+=lstrlen(Command+i);
|
---|
| 843 | sprintf(Command+i,"%s\tEndPaint(hWnd,ps)\r\n",spaces);
|
---|
| 844 | return WM_PAINT;
|
---|
| 845 | }
|
---|
| 846 | else if(lstrcmp(MessageName,"QueryClose")==0){
|
---|
| 847 | sprintf(Command,"%sCase WM_CLOSE\r\n",spaces);
|
---|
| 848 | i=lstrlen(Command);
|
---|
| 849 | sprintf(Command+i,"%s\tDim cancel=0 As Integer\r\n",spaces);
|
---|
| 850 | i+=lstrlen(Command+i);
|
---|
[625] | 851 | if(bProcedureCall)
|
---|
| 852 | {
|
---|
[617] | 853 | sprintf(Command+i,"%s\t%s_%s(cancel)\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 854 | i+=lstrlen(Command+i);
|
---|
| 855 | }
|
---|
[625] | 856 |
|
---|
| 857 | if( pWindowInfo->IsModalDlg() )
|
---|
| 858 | {
|
---|
[3] | 859 | sprintf(Command+i,"%s\tIf cancel=0 Then EndDialog(hWnd,0)\r\n",spaces);
|
---|
[625] | 860 | }
|
---|
[3] | 861 | else
|
---|
[625] | 862 | {
|
---|
[3] | 863 | sprintf(Command+i,"%s\tIf cancel=0 Then DestroyWindow(hWnd)\r\n",spaces);
|
---|
[625] | 864 | }
|
---|
[3] | 865 | return WM_CLOSE;
|
---|
| 866 | }
|
---|
| 867 | else if(lstrcmp(MessageName,"RButtonDblClick")==0){
|
---|
| 868 | sprintf(Command,"%sCase WM_RBUTTONDBLCLK\r\n",spaces);
|
---|
| 869 | i=lstrlen(Command);
|
---|
[617] | 870 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 871 | }
|
---|
| 872 | else if(lstrcmp(MessageName,"RButtonDown")==0){
|
---|
| 873 | sprintf(Command,"%sCase WM_RBUTTONDOWN\r\n",spaces);
|
---|
| 874 | i=lstrlen(Command);
|
---|
[617] | 875 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 876 | }
|
---|
| 877 | else if(lstrcmp(MessageName,"RButtonUp")==0){
|
---|
| 878 | sprintf(Command,"%sCase WM_RBUTTONUP\r\n",spaces);
|
---|
| 879 | i=lstrlen(Command);
|
---|
[617] | 880 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 881 | }
|
---|
| 882 | else if(lstrcmp(MessageName,"Resize")==0){
|
---|
| 883 | sprintf(Command,"%sCase WM_SIZE\r\n",spaces);
|
---|
| 884 | i=lstrlen(Command);
|
---|
[617] | 885 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 886 | }
|
---|
| 887 | else if(lstrcmp(MessageName,"SetFocus")==0){
|
---|
| 888 | sprintf(Command,"%sCase WM_SETFOCUS\r\n",spaces);
|
---|
| 889 | i=lstrlen(Command);
|
---|
[617] | 890 | sprintf(Command+i,"%s\t%s_%s()\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 891 | }
|
---|
| 892 | else if(lstrcmp(MessageName,"Timer")==0){
|
---|
| 893 | sprintf(Command,"%sCase WM_TIMER\r\n",spaces);
|
---|
| 894 | i=lstrlen(Command);
|
---|
[617] | 895 | sprintf(Command+i,"%s\t%s_%s(wParam As DWord)\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 896 | }
|
---|
| 897 | else if(lstrcmp(MessageName,"VScroll")==0){
|
---|
| 898 | sprintf(Command,"%sCase WM_VSCROLL\r\n",spaces);
|
---|
| 899 | i=lstrlen(Command);
|
---|
[617] | 900 | sprintf(Command+i,"%s\t%s_%s(LOWORD(wParam),HIWORD(wParam),lParam As HWND)\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 901 | }
|
---|
| 902 |
|
---|
| 903 |
|
---|
| 904 | ///////////////////
|
---|
| 905 | // MMSYS コマンド
|
---|
| 906 |
|
---|
| 907 | else if(lstrcmp(MessageName,"MciNotify")==0){
|
---|
| 908 | sprintf(Command,"%sCase MM_MCINOTIFY\r\n",spaces);
|
---|
| 909 | i=lstrlen(Command);
|
---|
[617] | 910 | sprintf(Command+i,"%s\t%s_%s(wParam,lParam)\r\n",spaces,pWindowInfo->GetName().c_str(),MessageName);
|
---|
[3] | 911 | }
|
---|
| 912 | return 0;
|
---|
| 913 | }
|
---|
| 914 |
|
---|
[624] | 915 | void GetMenuItemConstData(MENU_INFO *pMenuInfo,int NumberOfMenu,int *ConstNumber,Jenga::Common::Strings &namesForDuplicationCheck,char *buffer,int *base){
|
---|
[3] | 916 | extern HANDLE hHeap;
|
---|
[624] | 917 | int i;
|
---|
[3] | 918 |
|
---|
| 919 | for(i=0;i<NumberOfMenu;i++){
|
---|
| 920 | if(pMenuInfo[i].pMenuInfo){
|
---|
| 921 | //ポップアップ
|
---|
[624] | 922 | GetMenuItemConstData(pMenuInfo[i].pMenuInfo,pMenuInfo[i].NumberOfMenu,ConstNumber,namesForDuplicationCheck,buffer,base);
|
---|
[3] | 923 | }
|
---|
| 924 | else if(pMenuInfo[i].type==MFT_STRING){
|
---|
| 925 | //重複チェック
|
---|
[624] | 926 | bool isMatch = false;
|
---|
| 927 | BOOST_FOREACH( const std::string &name, namesForDuplicationCheck )
|
---|
| 928 | {
|
---|
| 929 | if(lstrcmpi(name.c_str(),pMenuInfo[i].IdName)==0)
|
---|
| 930 | {
|
---|
| 931 | isMatch = true;
|
---|
[3] | 932 | break;
|
---|
| 933 | }
|
---|
| 934 | }
|
---|
[624] | 935 | if( !isMatch )
|
---|
| 936 | {
|
---|
| 937 | namesForDuplicationCheck.push_back( pMenuInfo[i].IdName );
|
---|
[3] | 938 |
|
---|
| 939 | sprintf(buffer+(*base),"Const %s=%d\r\n",pMenuInfo[i].IdName,*ConstNumber);
|
---|
| 940 | (*base)+=lstrlen(buffer+(*base));
|
---|
| 941 | (*ConstNumber)++;
|
---|
| 942 | }
|
---|
| 943 | }
|
---|
| 944 | }
|
---|
| 945 | }
|
---|
| 946 | int GetMakeMenuCommand(MENU_INFO *pMenuInfo,int NumberOfMenu,char *MenuHandle,char *Command,BOOL bMain){
|
---|
| 947 | int i,i2;
|
---|
| 948 | char temporary[MAX_PATH];
|
---|
| 949 |
|
---|
| 950 | i=0;
|
---|
| 951 | sprintf(Command+i,"Dim %s As HMENU\r\n",MenuHandle);
|
---|
| 952 | i+=lstrlen(Command+i);
|
---|
| 953 | if(bMain) sprintf(Command+i,"%s=CreateMenu()\r\n",MenuHandle);
|
---|
| 954 | else sprintf(Command+i,"%s=CreatePopupMenu()\r\n",MenuHandle);
|
---|
| 955 | i+=lstrlen(Command+i);
|
---|
| 956 |
|
---|
| 957 | for(i2=NumberOfMenu-1;i2>=0;i2--){
|
---|
| 958 | if(pMenuInfo[i2].pMenuInfo){
|
---|
| 959 | sprintf(temporary,"%s_%d",MenuHandle,i2);
|
---|
| 960 | i+=GetMakeMenuCommand(pMenuInfo[i2].pMenuInfo,pMenuInfo[i2].NumberOfMenu,temporary,Command+i,0);
|
---|
| 961 | sprintf(Command+i,"InsMenu %s,0,MF_BYPOSITION,Ex\"%s\",0,%s,%d\r\n",
|
---|
| 962 | MenuHandle,
|
---|
| 963 | pMenuInfo[i2].caption,
|
---|
| 964 | temporary,
|
---|
| 965 | pMenuInfo[i2].state);
|
---|
| 966 | i+=lstrlen(Command+i);
|
---|
| 967 | }
|
---|
| 968 | else{
|
---|
| 969 | if(pMenuInfo[i2].type==MFT_STRING){
|
---|
| 970 | sprintf(Command+i,"InsMenu %s,0,MF_BYPOSITION,Ex\"%s\",%s,0,%d\r\n",
|
---|
| 971 | MenuHandle,
|
---|
| 972 | pMenuInfo[i2].caption,
|
---|
| 973 | pMenuInfo[i2].IdName,
|
---|
| 974 | pMenuInfo[i2].state);
|
---|
| 975 | i+=lstrlen(Command+i);
|
---|
| 976 | }
|
---|
| 977 | else if(pMenuInfo[i2].type==MFT_SEPARATOR){
|
---|
[64] | 978 | sprintf(Command+i,"InsMenu %s,0,MF_BYPOSITION,\"\"\r\n",
|
---|
[3] | 979 | MenuHandle);
|
---|
| 980 | i+=lstrlen(Command+i);
|
---|
| 981 | }
|
---|
| 982 | }
|
---|
| 983 | }
|
---|
| 984 | return i;
|
---|
| 985 | }
|
---|
| 986 | int GetDestroyMenuCommand(MENU_INFO *pMenuInfo,int NumberOfMenu,char *MenuHandle,char *Command){
|
---|
| 987 | int i,i2;
|
---|
| 988 | char temporary[MAX_PATH];
|
---|
| 989 |
|
---|
| 990 | i=0;
|
---|
| 991 | sprintf(Command+i,"\tDestroyMenu(%s)\r\n",MenuHandle);
|
---|
| 992 | i+=lstrlen(Command+i);
|
---|
| 993 |
|
---|
| 994 | for(i2=NumberOfMenu-1;i2>=0;i2--){
|
---|
| 995 | if(pMenuInfo[i2].pMenuInfo){
|
---|
| 996 | sprintf(temporary,"%s_%d",MenuHandle,i2);
|
---|
| 997 | i+=GetDestroyMenuCommand(pMenuInfo[i2].pMenuInfo,pMenuInfo[i2].NumberOfMenu,temporary,Command+i);
|
---|
| 998 | }
|
---|
| 999 | }
|
---|
| 1000 | return i;
|
---|
| 1001 | }
|
---|
| 1002 | void SaveWindowProgram(){
|
---|
| 1003 | extern HANDLE hHeap;
|
---|
[624] | 1004 | int i,i2,i3,i4,i5,sw1,sw2,sw3,sw4,size;
|
---|
| 1005 | char *buffer,temporary[MAX_PATH];
|
---|
[3] | 1006 |
|
---|
| 1007 | size=2;
|
---|
| 1008 | buffer=(char *)HeapAlloc(hHeap,0,65535*size);
|
---|
| 1009 | lstrcpy(buffer,"'このファイルはウィンドウ定義ファイル(*.wnd)をもとに生成されています\r\n\r\n");
|
---|
| 1010 | i2=lstrlen(buffer);
|
---|
| 1011 |
|
---|
[618] | 1012 | if(projectInfo.dwOption&PJ_OP_COMMCTRL){
|
---|
[3] | 1013 | //コマンコントロールを初期化
|
---|
| 1014 | lstrcpy(buffer+i2,"Dim _RadSys_InitCtrls As INITCOMMONCONTROLSEX\r\n");
|
---|
| 1015 | i2+=lstrlen(buffer+i2);
|
---|
| 1016 | lstrcpy(buffer+i2,"_RadSys_InitCtrls.dwSize=Len(_RadSys_InitCtrls)\r\n");
|
---|
| 1017 | i2+=lstrlen(buffer+i2);
|
---|
| 1018 | lstrcpy(buffer+i2,"_RadSys_InitCtrls.dwICC=ICC_WIN95_CLASSES\r\n");
|
---|
| 1019 | i2+=lstrlen(buffer+i2);
|
---|
| 1020 | lstrcpy(buffer+i2,"InitCommonControlsEx(_RadSys_InitCtrls)\r\n\r\n");
|
---|
| 1021 | i2+=lstrlen(buffer+i2);
|
---|
| 1022 | }
|
---|
| 1023 |
|
---|
| 1024 |
|
---|
| 1025 | ////////////
|
---|
| 1026 | //IDを定義
|
---|
| 1027 |
|
---|
[624] | 1028 | Jenga::Common::Strings namesForDuplicationCheck;
|
---|
[612] | 1029 | i4=1000;
|
---|
| 1030 | i5=0;
|
---|
[624] | 1031 | BOOST_FOREACH( ActiveBasic::PM::WindowInfo *pWindowInfo, projectInfo.windowInfos )
|
---|
[612] | 1032 | {
|
---|
[624] | 1033 | BOOST_FOREACH( const ActiveBasic::PM::ChildWindowInfo *pChildInfo, pWindowInfo->childWindowInfos )
|
---|
[616] | 1034 | {
|
---|
[3] | 1035 | //重複チェック
|
---|
[624] | 1036 | bool isMatch = false;
|
---|
| 1037 | BOOST_FOREACH( const std::string &name, namesForDuplicationCheck )
|
---|
| 1038 | {
|
---|
| 1039 | if(lstrcmpi(name.c_str(),pChildInfo->GetName().c_str())==0){
|
---|
| 1040 | isMatch = true;
|
---|
[3] | 1041 | break;
|
---|
| 1042 | }
|
---|
| 1043 | }
|
---|
[624] | 1044 | if( isMatch ) continue;
|
---|
[3] | 1045 |
|
---|
[624] | 1046 | namesForDuplicationCheck.push_back( pChildInfo->GetName() );
|
---|
[3] | 1047 |
|
---|
[624] | 1048 | sprintf(buffer+i2,"Const %s=%d\r\n",pChildInfo->GetName().c_str(),i4);
|
---|
[3] | 1049 | i2+=lstrlen(buffer+i2);
|
---|
| 1050 | i4++;
|
---|
| 1051 |
|
---|
| 1052 | while(i2>65535*(size-1)){
|
---|
| 1053 | size++;
|
---|
| 1054 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size);
|
---|
| 1055 | }
|
---|
| 1056 | }
|
---|
| 1057 | }
|
---|
| 1058 |
|
---|
| 1059 | //メニューのIDを定義
|
---|
[624] | 1060 | GetMenuItemConstData(projectInfo.pMenuInfo,projectInfo.NumberOfMenu,&i4,namesForDuplicationCheck,buffer,&i2);
|
---|
[3] | 1061 |
|
---|
| 1062 | lstrcpy(buffer+i2,"\r\n");
|
---|
| 1063 | i2+=lstrlen(buffer+i2);
|
---|
| 1064 |
|
---|
| 1065 |
|
---|
| 1066 | //ハンドル変数を定義
|
---|
[624] | 1067 | BOOST_FOREACH( ActiveBasic::PM::WindowInfo *pWindowInfo, projectInfo.windowInfos )
|
---|
[612] | 1068 | {
|
---|
[617] | 1069 | sprintf(buffer+i2,"Dim %s As HWND\r\n",pWindowInfo->GetHandleName().c_str());
|
---|
[3] | 1070 | i2+=lstrlen(buffer+i2);
|
---|
[617] | 1071 | sprintf(buffer+i2,"Dim hFont_%s As HFONT\r\n",pWindowInfo->GetName().c_str());
|
---|
[3] | 1072 | i2+=lstrlen(buffer+i2);
|
---|
| 1073 | sprintf(buffer+i2,"hFont_%s=CreateFont(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\"%s\")\r\n",
|
---|
[617] | 1074 | pWindowInfo->GetName().c_str(),
|
---|
[615] | 1075 | pWindowInfo->LogFont.lfHeight,
|
---|
| 1076 | pWindowInfo->LogFont.lfWidth,
|
---|
| 1077 | pWindowInfo->LogFont.lfEscapement,
|
---|
| 1078 | pWindowInfo->LogFont.lfOrientation,
|
---|
| 1079 | pWindowInfo->LogFont.lfWeight,
|
---|
| 1080 | pWindowInfo->LogFont.lfItalic,
|
---|
| 1081 | pWindowInfo->LogFont.lfUnderline,
|
---|
| 1082 | pWindowInfo->LogFont.lfStrikeOut,
|
---|
| 1083 | pWindowInfo->LogFont.lfCharSet,
|
---|
| 1084 | pWindowInfo->LogFont.lfOutPrecision,
|
---|
| 1085 | pWindowInfo->LogFont.lfClipPrecision,
|
---|
| 1086 | pWindowInfo->LogFont.lfQuality,
|
---|
| 1087 | pWindowInfo->LogFont.lfPitchAndFamily,
|
---|
| 1088 | pWindowInfo->LogFont.lfFaceName);
|
---|
[3] | 1089 | i2+=lstrlen(buffer+i2);
|
---|
| 1090 |
|
---|
| 1091 | while(i2>65535*(size-1)){
|
---|
| 1092 | size++;
|
---|
| 1093 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size);
|
---|
| 1094 | }
|
---|
| 1095 | }
|
---|
| 1096 |
|
---|
| 1097 | //背景に使用するブラシを定義
|
---|
| 1098 | lstrcpy(buffer+i2,"Dim h3DFaceBrush As HBRUSH\r\n");
|
---|
| 1099 | i2+=lstrlen(buffer+i2);
|
---|
| 1100 | lstrcpy(buffer+i2,"h3DFaceBrush=CreateSolidBrush(GetSysColor(COLOR_3DFACE))\r\n");
|
---|
| 1101 | i2+=lstrlen(buffer+i2);
|
---|
[612] | 1102 | i=0;
|
---|
[624] | 1103 | BOOST_FOREACH( ActiveBasic::PM::WindowInfo *pWindowInfo, projectInfo.windowInfos )
|
---|
[612] | 1104 | {
|
---|
[624] | 1105 | if(pWindowInfo->GetBackgroundColor()<=0&&
|
---|
| 1106 | pWindowInfo->GetBackgroundColor()!=-(int)RGB(255,255,255)&&
|
---|
| 1107 | pWindowInfo->GetBackgroundColor()!=-(int)RGB(0,0,0)){
|
---|
[3] | 1108 | sprintf(buffer+i2,"Dim _RadSys_hBackBrush%d As HBRUSH\r\n",i);
|
---|
| 1109 | i2+=lstrlen(buffer+i2);
|
---|
[624] | 1110 | sprintf(buffer+i2,"_RadSys_hBackBrush%d=CreateSolidBrush(%d)\r\n",i,-pWindowInfo->GetBackgroundColor());
|
---|
[3] | 1111 | i2+=lstrlen(buffer+i2);
|
---|
| 1112 | }
|
---|
[624] | 1113 | if(pWindowInfo->GetBackgroundColor()>=0x1000){
|
---|
[3] | 1114 | sprintf(buffer+i2,"Dim _RadSys_hBackBrush%d As HBRUSH\r\n",i);
|
---|
| 1115 | i2+=lstrlen(buffer+i2);
|
---|
| 1116 | sprintf(buffer+i2,"_RadSys_hBackBrush%d=CreatePatternBrush(LoadImage(GetModuleHandle(0),%s,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE or LR_SHARED))\r\n",
|
---|
| 1117 | i,
|
---|
[624] | 1118 | projectInfo.resourceManager.bitmapResources[pWindowInfo->GetBackgroundColor()-0x1000].idName.c_str());
|
---|
[3] | 1119 | i2+=lstrlen(buffer+i2);
|
---|
| 1120 | }
|
---|
[612] | 1121 |
|
---|
| 1122 | i++;
|
---|
[3] | 1123 | }
|
---|
| 1124 |
|
---|
| 1125 | lstrcpy(buffer+i2,"\r\n");
|
---|
| 1126 | i2+=lstrlen(buffer+i2);
|
---|
| 1127 |
|
---|
| 1128 | //イメージ ボックス用の変数を定義
|
---|
[624] | 1129 | BOOST_FOREACH( ActiveBasic::PM::WindowInfo *pWindowInfo, projectInfo.windowInfos )
|
---|
[612] | 1130 | {
|
---|
[624] | 1131 | BOOST_FOREACH( const ActiveBasic::PM::ChildWindowInfo *pChildInfo, pWindowInfo->childWindowInfos )
|
---|
[616] | 1132 | {
|
---|
| 1133 | if(pChildInfo->Control==CT_IMAGEBOX){
|
---|
[624] | 1134 | if((pChildInfo->GetStyle()&0x000F)==SS_ICON||
|
---|
| 1135 | (pChildInfo->GetStyle()&0x000F)==SS_BITMAP){
|
---|
| 1136 | sprintf(buffer+i2,"Dim hImage_%s_%s As HANDLE\r\n",pWindowInfo->GetName().c_str(),pChildInfo->GetName().c_str());
|
---|
[3] | 1137 | i2+=lstrlen(buffer+i2);
|
---|
| 1138 |
|
---|
| 1139 | while(i2>65535*(size-1)){
|
---|
| 1140 | size++;
|
---|
| 1141 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size);
|
---|
| 1142 | }
|
---|
| 1143 | }
|
---|
| 1144 | }
|
---|
| 1145 | }
|
---|
| 1146 | }
|
---|
| 1147 |
|
---|
| 1148 | lstrcpy(buffer+i2,"\r\n");
|
---|
| 1149 | i2+=lstrlen(buffer+i2);
|
---|
| 1150 |
|
---|
| 1151 | //メニュー作成
|
---|
[618] | 1152 | for(i=0;i<projectInfo.NumberOfMenu;i++){
|
---|
| 1153 | sprintf(temporary,"hMenu_%s",projectInfo.pMenuInfo[i].IdName);
|
---|
[3] | 1154 |
|
---|
| 1155 | //InsertMenuItem郡
|
---|
[618] | 1156 | i2+=GetMakeMenuCommand(projectInfo.pMenuInfo[i].pMenuInfo,projectInfo.pMenuInfo[i].NumberOfMenu,temporary,buffer+i2,1);
|
---|
[3] | 1157 |
|
---|
| 1158 | lstrcpy(buffer+i2,"\r\n");
|
---|
| 1159 | i2+=lstrlen(buffer+i2);
|
---|
| 1160 |
|
---|
| 1161 | while(i2>65535*(size-1)){
|
---|
| 1162 | size++;
|
---|
| 1163 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size);
|
---|
| 1164 | }
|
---|
| 1165 | }
|
---|
| 1166 |
|
---|
| 1167 |
|
---|
| 1168 | //////////////////////////
|
---|
| 1169 | //オブジェクトの解放処理
|
---|
[619] | 1170 | sprintf(buffer+i2,"Sub %s_DestroyObjects()\r\n",projectInfo.GetName().c_str());
|
---|
[3] | 1171 | i2+=lstrlen(buffer+i2);
|
---|
| 1172 |
|
---|
| 1173 | //メニュー解放
|
---|
[618] | 1174 | for(i=0;i<projectInfo.NumberOfMenu;i++){
|
---|
| 1175 | sprintf(temporary,"hMenu_%s",projectInfo.pMenuInfo[i].IdName);
|
---|
| 1176 | i2+=GetDestroyMenuCommand(projectInfo.pMenuInfo[i].pMenuInfo,projectInfo.pMenuInfo[i].NumberOfMenu,temporary,buffer+i2);
|
---|
[3] | 1177 |
|
---|
| 1178 | while(i2>65535*(size-1)){
|
---|
| 1179 | size++;
|
---|
| 1180 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size);
|
---|
| 1181 | }
|
---|
| 1182 | }
|
---|
| 1183 |
|
---|
[624] | 1184 | BOOST_FOREACH( ActiveBasic::PM::WindowInfo *pWindowInfo, projectInfo.windowInfos )
|
---|
[612] | 1185 | {
|
---|
[3] | 1186 | //フォントハンドル解放
|
---|
[617] | 1187 | sprintf(buffer+i2,"\tDeleteObject(hFont_%s)\r\n",pWindowInfo->GetName().c_str());
|
---|
[3] | 1188 | i2+=lstrlen(buffer+i2);
|
---|
| 1189 |
|
---|
| 1190 | while(i2>65535*(size-1)){
|
---|
| 1191 | size++;
|
---|
| 1192 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size);
|
---|
| 1193 | }
|
---|
| 1194 | }
|
---|
| 1195 |
|
---|
| 1196 | //背景ブラシを解放
|
---|
| 1197 | lstrcpy(buffer+i2,"\tDeleteObject(h3DFaceBrush)\r\n");
|
---|
| 1198 | i2+=lstrlen(buffer+i2);
|
---|
[612] | 1199 | i=0;
|
---|
[624] | 1200 | BOOST_FOREACH( ActiveBasic::PM::WindowInfo *pWindowInfo, projectInfo.windowInfos )
|
---|
[612] | 1201 | {
|
---|
[624] | 1202 | if(pWindowInfo->GetBackgroundColor()<=0&&
|
---|
| 1203 | pWindowInfo->GetBackgroundColor()!=-(int)RGB(255,255,255)&&
|
---|
| 1204 | pWindowInfo->GetBackgroundColor()!=-(int)RGB(0,0,0)){
|
---|
[3] | 1205 | sprintf(buffer+i2,"\tDeleteObject(_RadSys_hBackBrush%d)\r\n",i);
|
---|
| 1206 | i2+=lstrlen(buffer+i2);
|
---|
| 1207 | }
|
---|
[612] | 1208 | i++;
|
---|
[3] | 1209 | }
|
---|
| 1210 |
|
---|
| 1211 | sprintf(buffer+i2,"End Sub\r\n\r\n");
|
---|
| 1212 | i2+=lstrlen(buffer+i2);
|
---|
| 1213 |
|
---|
| 1214 | //ユーザー定義のコールバック関数が存在するかどうか
|
---|
| 1215 | BOOL bAvailUserProc[MAX_WNDNUM];
|
---|
| 1216 |
|
---|
| 1217 |
|
---|
[612] | 1218 | i=0;
|
---|
[624] | 1219 | BOOST_FOREACH( ActiveBasic::PM::WindowInfo *pWindowInfo, projectInfo.windowInfos )
|
---|
[612] | 1220 | {
|
---|
[3] | 1221 | if(i!=0){
|
---|
| 1222 | lstrcpy(buffer+i2,"\r\n");
|
---|
| 1223 | i2+=lstrlen(buffer+i2);
|
---|
| 1224 | }
|
---|
| 1225 |
|
---|
| 1226 | //////////////////////////
|
---|
| 1227 | //コールバック関数を生成
|
---|
| 1228 |
|
---|
| 1229 | //処理メッセージを抽出
|
---|
| 1230 | ITEMEVENTINFO *pItemEventInfo;
|
---|
[624] | 1231 | char **ppNames=GetProcedureNamesOfMessageCall(i,&pItemEventInfo,&i3,&bAvailUserProc[i]);
|
---|
[3] | 1232 |
|
---|
[617] | 1233 | sprintf(buffer+i2,"Function EventCall_%s(hWnd As HWND, message As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT\r\n",pWindowInfo->GetName().c_str());
|
---|
[3] | 1234 | i2+=lstrlen(buffer+i2);
|
---|
| 1235 |
|
---|
| 1236 | lstrcpy(buffer+i2,"\tSelect Case message\r\n");
|
---|
| 1237 | i2+=lstrlen(buffer+i2);
|
---|
| 1238 |
|
---|
| 1239 | //通常メッセージ郡
|
---|
| 1240 | for(i4=0,sw1=0,sw2=0,sw3=0,sw4=0;i4<i3;i4++){
|
---|
| 1241 | i5=GetCommandByMessage(i,ppNames[i4],1,buffer+i2,"\t\t");
|
---|
| 1242 | i2+=lstrlen(buffer+i2);
|
---|
| 1243 | if(i5==WM_CREATE) sw1=1;
|
---|
| 1244 | else if(i5==WM_DESTROY) sw2=1;
|
---|
| 1245 | else if(i5==WM_CLOSE) sw3=1;
|
---|
| 1246 | else if(i5==WM_NOTIFY) sw4=1;
|
---|
| 1247 | HeapDefaultFree(ppNames[i4]);
|
---|
| 1248 | }
|
---|
| 1249 | HeapDefaultFree(ppNames);
|
---|
| 1250 |
|
---|
| 1251 | //WM_CREATE、WM_DESTROY、WM_PAINTが呼び出されていない場合
|
---|
| 1252 | if(!sw1){
|
---|
| 1253 | GetCommandByMessage(i,"Create",0,buffer+i2,"\t\t");
|
---|
| 1254 | i2+=lstrlen(buffer+i2);
|
---|
| 1255 | }
|
---|
| 1256 | if(!sw2){
|
---|
| 1257 | GetCommandByMessage(i,"Destroy",0,buffer+i2,"\t\t");
|
---|
| 1258 | i2+=lstrlen(buffer+i2);
|
---|
| 1259 | }
|
---|
| 1260 | if(!sw3){
|
---|
| 1261 | GetCommandByMessage(i,"QueryClose",0,buffer+i2,"\t\t");
|
---|
| 1262 | i2+=lstrlen(buffer+i2);
|
---|
| 1263 | }
|
---|
| 1264 |
|
---|
| 1265 | //アイテムメッセージ郡(WM_NOTIFY)
|
---|
| 1266 | if(pItemEventInfo[0].IdName){
|
---|
| 1267 | i3=i2;
|
---|
| 1268 | lstrcpy(buffer+i2,"\t\tCase WM_NOTIFY\r\n");
|
---|
| 1269 | i2+=lstrlen(buffer+i2);
|
---|
| 1270 | if(sw4){
|
---|
[617] | 1271 | sprintf(buffer+i2,"\t\t\t%s_Notify(ByVal (lParam As *NMHDR))\r\n",pWindowInfo->GetName().c_str());
|
---|
[3] | 1272 | i2+=lstrlen(buffer+i2);
|
---|
| 1273 | }
|
---|
| 1274 | lstrcpy(buffer+i2,"\t\t\tDim pnmHdr As *NMHDR\r\n");
|
---|
| 1275 | i2+=lstrlen(buffer+i2);
|
---|
| 1276 | lstrcpy(buffer+i2,"\t\t\tpnmHdr=lParam As *NMHDR\r\n");
|
---|
| 1277 | i2+=lstrlen(buffer+i2);
|
---|
| 1278 | lstrcpy(buffer+i2,"\t\t\tSelect Case LOWORD(wParam)\r\n");
|
---|
| 1279 | i2+=lstrlen(buffer+i2);
|
---|
| 1280 |
|
---|
[615] | 1281 | if(GetNotifyCommandByItemMessage(pWindowInfo,pItemEventInfo,buffer+i2,"\t\t\t\t")){
|
---|
[3] | 1282 | i2+=lstrlen(buffer+i2);
|
---|
| 1283 |
|
---|
| 1284 | lstrcpy(buffer+i2,"\t\t\tEnd Select\r\n");
|
---|
| 1285 | i2+=lstrlen(buffer+i2);
|
---|
| 1286 | }
|
---|
| 1287 | else{
|
---|
| 1288 | //WM_NOTIFYを削除
|
---|
| 1289 | i2=i3;
|
---|
| 1290 | if(sw4) goto DefaultNotifyEvent;
|
---|
| 1291 | }
|
---|
| 1292 | }
|
---|
| 1293 | else if(sw4){
|
---|
| 1294 | DefaultNotifyEvent:
|
---|
| 1295 | lstrcpy(buffer+i2,"\t\tCase WM_NOTIFY\r\n");
|
---|
| 1296 | i2+=lstrlen(buffer+i2);
|
---|
[617] | 1297 | sprintf(buffer+i2,"\t\t\t%s_Notify(ByVal (lParam As *NMHDR))\r\n",pWindowInfo->GetName().c_str());
|
---|
[3] | 1298 | i2+=lstrlen(buffer+i2);
|
---|
| 1299 | }
|
---|
| 1300 |
|
---|
| 1301 | //アイテムメッセージ郡(WM_COMMAND)
|
---|
| 1302 | if(pItemEventInfo[0].IdName){
|
---|
| 1303 | lstrcpy(buffer+i2,"\t\tCase WM_COMMAND\r\n");
|
---|
| 1304 | i2+=lstrlen(buffer+i2);
|
---|
| 1305 | lstrcpy(buffer+i2,"\t\t\tSelect Case LOWORD(wParam)\r\n");
|
---|
| 1306 | i2+=lstrlen(buffer+i2);
|
---|
| 1307 |
|
---|
| 1308 | //pItemEventInfoのIdName、EventNameメンバのメモリ解放はこの関数内で行う
|
---|
[615] | 1309 | GetCommandByItemMessage(pWindowInfo,pItemEventInfo,buffer+i2,"\t\t\t\t");
|
---|
[3] | 1310 | i2+=lstrlen(buffer+i2);
|
---|
| 1311 |
|
---|
| 1312 | lstrcpy(buffer+i2,"\t\t\tEnd Select\r\n");
|
---|
| 1313 | i2+=lstrlen(buffer+i2);
|
---|
| 1314 | }
|
---|
| 1315 | HeapDefaultFree(pItemEventInfo);
|
---|
| 1316 |
|
---|
| 1317 | // DefWindowProc関数
|
---|
| 1318 | lstrcpy(buffer+i2,"\t\tCase Else\r\n");
|
---|
| 1319 | i2+=lstrlen(buffer+i2);
|
---|
[617] | 1320 | sprintf(buffer+i2,"\t\t\tEventCall_%s=DefWindowProc(hWnd,message,wParam,lParam)\r\n",pWindowInfo->GetName().c_str());
|
---|
[3] | 1321 | i2+=lstrlen(buffer+i2);
|
---|
| 1322 | lstrcpy(buffer+i2,"\t\t\tExit Function\r\n");
|
---|
| 1323 | i2+=lstrlen(buffer+i2);
|
---|
| 1324 |
|
---|
| 1325 | lstrcpy(buffer+i2,"\tEnd Select\r\n");
|
---|
| 1326 | i2+=lstrlen(buffer+i2);
|
---|
| 1327 |
|
---|
[617] | 1328 | sprintf(buffer+i2,"\tEventCall_%s=0\r\n",pWindowInfo->GetName().c_str());
|
---|
[3] | 1329 | i2+=lstrlen(buffer+i2);
|
---|
| 1330 | lstrcpy(buffer+i2,"End Function\r\n");
|
---|
| 1331 | i2+=lstrlen(buffer+i2);
|
---|
| 1332 |
|
---|
| 1333 | while(i2>65535*(size-1)){
|
---|
| 1334 | size++;
|
---|
| 1335 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size);
|
---|
| 1336 | }
|
---|
[612] | 1337 |
|
---|
| 1338 | i++;
|
---|
[3] | 1339 | }
|
---|
| 1340 |
|
---|
| 1341 |
|
---|
| 1342 | //////////////////////////
|
---|
| 1343 | //ダイアログボックス関連
|
---|
| 1344 |
|
---|
| 1345 | //クラス登録
|
---|
| 1346 | lstrcpy(buffer+i2,"\r\nFunction DefaultCallProc(hWnd As HWND, message As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT\r\n");
|
---|
| 1347 | i2+=lstrlen(buffer+i2);
|
---|
| 1348 | lstrcpy(buffer+i2,"\tDefaultCallProc=DefWindowProc(hWnd,message,wParam,lParam)\r\n");
|
---|
| 1349 | i2+=lstrlen(buffer+i2);
|
---|
| 1350 | lstrcpy(buffer+i2,"End Function\r\n");
|
---|
| 1351 | i2+=lstrlen(buffer+i2);
|
---|
| 1352 | lstrcpy(buffer+i2,"\r\nDim _RadSys_dlgwcl As WNDCLASSEX\r\n");
|
---|
| 1353 | i2+=lstrlen(buffer+i2);
|
---|
| 1354 | lstrcpy(buffer+i2,"FillMemory(VarPtr(_RadSys_dlgwcl),Len(_RadSys_dlgwcl),0)\r\n");
|
---|
| 1355 | i2+=lstrlen(buffer+i2);
|
---|
| 1356 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.cbSize=Len(_RadSys_dlgwcl)\r\n");
|
---|
| 1357 | i2+=lstrlen(buffer+i2);
|
---|
| 1358 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.hInstance=GetModuleHandle(0)\r\n");
|
---|
| 1359 | i2+=lstrlen(buffer+i2);
|
---|
| 1360 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.style=CS_HREDRAW or CS_VREDRAW or CS_DBLCLKS\r\n");
|
---|
| 1361 | i2+=lstrlen(buffer+i2);
|
---|
| 1362 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.hIcon=LoadIcon(NULL,MAKEINTRESOURCE(IDI_APPLICATION))\r\n");
|
---|
| 1363 | i2+=lstrlen(buffer+i2);
|
---|
| 1364 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.hIconSm=LoadIcon(NULL,MAKEINTRESOURCE(IDI_WINLOGO))\r\n");
|
---|
| 1365 | i2+=lstrlen(buffer+i2);
|
---|
| 1366 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.hCursor=LoadCursor(NULL,MAKEINTRESOURCE(IDC_ARROW))\r\n");
|
---|
| 1367 | i2+=lstrlen(buffer+i2);
|
---|
| 1368 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.lpszClassName=\"NORMALDLG\"\r\n");
|
---|
| 1369 | i2+=lstrlen(buffer+i2);
|
---|
| 1370 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.hbrBackground=h3DFaceBrush\r\n");
|
---|
| 1371 | i2+=lstrlen(buffer+i2);
|
---|
| 1372 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.lpfnWndProc=AddressOf(DefaultCallProc)\r\n");
|
---|
| 1373 | i2+=lstrlen(buffer+i2);
|
---|
| 1374 | lstrcpy(buffer+i2,"RegisterClassEx(_RadSys_dlgwcl)\r\n");
|
---|
| 1375 | i2+=lstrlen(buffer+i2);
|
---|
| 1376 |
|
---|
| 1377 | //DialogBox関数
|
---|
| 1378 | lstrcpy(buffer+i2,"\r\nFunction DialogBox(hOwnerWnd As HWND, TemplateName As LPSTR) As LONG_PTR\r\n");
|
---|
| 1379 | i2+=lstrlen(buffer+i2);
|
---|
| 1380 | lstrcpy(buffer+i2,"\tDim hDlg As HWND\r\n");
|
---|
| 1381 | i2+=lstrlen(buffer+i2);
|
---|
[612] | 1382 | sw1=0;
|
---|
| 1383 | i=0;
|
---|
[624] | 1384 | BOOST_FOREACH( ActiveBasic::PM::WindowInfo *pWindowInfo, projectInfo.windowInfos )
|
---|
[612] | 1385 | {
|
---|
[625] | 1386 | if( pWindowInfo->IsModalDlg() )
|
---|
| 1387 | {
|
---|
[3] | 1388 | if(sw1==0){
|
---|
[617] | 1389 | sprintf(buffer+i2,"\tIf lstrcmp(TemplateName,\"%s\")=0 Then\r\n",pWindowInfo->GetName().c_str());
|
---|
[3] | 1390 | i2+=lstrlen(buffer+i2);
|
---|
| 1391 | sw1=1;
|
---|
| 1392 | }
|
---|
| 1393 | else{
|
---|
[617] | 1394 | sprintf(buffer+i2,"\tElseIf lstrcmp(TemplateName,\"%s\")=0 Then\r\n",pWindowInfo->GetName().c_str());
|
---|
[3] | 1395 | i2+=lstrlen(buffer+i2);
|
---|
| 1396 | }
|
---|
[624] | 1397 | sprintf(buffer+i2,"\t\t%s=CreateWindowEx(&H%08x,\"NORMALDLG\",\"%s\",&H%08x,%d,%d,%d,%d,hOwnerWnd,NULL As HMENU,GetModuleHandle(0),0)\r\n",
|
---|
[617] | 1398 | pWindowInfo->GetHandleName().c_str(),
|
---|
[624] | 1399 | pWindowInfo->GetExStyle(),
|
---|
| 1400 | pWindowInfo->GetCaption().c_str(),
|
---|
| 1401 | pWindowInfo->GetStyle(),
|
---|
[615] | 1402 | pWindowInfo->pos.x,
|
---|
| 1403 | pWindowInfo->pos.y,
|
---|
| 1404 | pWindowInfo->size.cx,
|
---|
[624] | 1405 | pWindowInfo->size.cy);
|
---|
[3] | 1406 | i2+=lstrlen(buffer+i2);
|
---|
| 1407 | sprintf(buffer+i2,"\t\thDlg=%s\r\n",
|
---|
[617] | 1408 | pWindowInfo->GetHandleName().c_str());
|
---|
[3] | 1409 | i2+=lstrlen(buffer+i2);
|
---|
| 1410 | if(bAvailUserProc[i]){
|
---|
| 1411 | sprintf(buffer+i2,"\t\tSetWindowLongPtr(%s,GWLP_WNDPROC,AddressOf(%s) As LONG_PTR)\r\n",
|
---|
[617] | 1412 | pWindowInfo->GetHandleName().c_str(),
|
---|
[625] | 1413 | pWindowInfo->GetCallbackName().c_str());
|
---|
[3] | 1414 | }
|
---|
| 1415 | else{
|
---|
| 1416 | sprintf(buffer+i2,"\t\tSetWindowLongPtr(%s,GWLP_WNDPROC,AddressOf(EventCall_%s) As LONG_PTR)\r\n",
|
---|
[617] | 1417 | pWindowInfo->GetHandleName().c_str(),
|
---|
| 1418 | pWindowInfo->GetName().c_str());
|
---|
[3] | 1419 | }
|
---|
| 1420 | i2+=lstrlen(buffer+i2);
|
---|
[617] | 1421 | sprintf(buffer+i2,"\t\tSendMessage(%s,WM_INITDIALOG,0,0)\r\n",pWindowInfo->GetHandleName().c_str());
|
---|
[3] | 1422 | i2+=lstrlen(buffer+i2);
|
---|
[624] | 1423 | if( pWindowInfo->HasIcon() )
|
---|
| 1424 | {
|
---|
| 1425 | sprintf(buffer+i2,"\t\tSendMessage(%s,WM_SETICON,ICON_SMALL,LoadIcon(GetModuleHandle(0),MAKEINTRESOURCE(%s)) As LPARAM)\r\n",pWindowInfo->GetHandleName().c_str(),pWindowInfo->GetIconResourceName().c_str());
|
---|
[3] | 1426 | i2+=lstrlen(buffer+i2);
|
---|
| 1427 | }
|
---|
[617] | 1428 | sprintf(buffer+i2,"\t\tShowWindow(%s,SW_SHOW)\r\n",pWindowInfo->GetHandleName().c_str());
|
---|
[3] | 1429 | i2+=lstrlen(buffer+i2);
|
---|
| 1430 | }
|
---|
| 1431 | while(i2>65535*(size-1)){
|
---|
| 1432 | size++;
|
---|
| 1433 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size);
|
---|
| 1434 | }
|
---|
[612] | 1435 | i++;
|
---|
[3] | 1436 | }
|
---|
| 1437 | if(sw1){
|
---|
| 1438 | lstrcpy(buffer+i2,"\tElse\r\n");
|
---|
| 1439 | i2+=lstrlen(buffer+i2);
|
---|
| 1440 | lstrcpy(buffer+i2,"\t\tExit Function\r\n");
|
---|
| 1441 | i2+=lstrlen(buffer+i2);
|
---|
| 1442 | lstrcpy(buffer+i2,"\tEnd If\r\n");
|
---|
| 1443 | i2+=lstrlen(buffer+i2);
|
---|
| 1444 | lstrcpy(buffer+i2,"\tEnableWindow(hOwnerWnd,0)\r\n\r\n");
|
---|
| 1445 | i2+=lstrlen(buffer+i2);
|
---|
| 1446 | lstrcpy(buffer+i2,"\tDim msg As MSG, iResult As Long\r\n");
|
---|
| 1447 | i2+=lstrlen(buffer+i2);
|
---|
| 1448 | lstrcpy(buffer+i2,"\tDo\r\n");
|
---|
| 1449 | i2+=lstrlen(buffer+i2);
|
---|
| 1450 | lstrcpy(buffer+i2,"\t\tiResult=GetMessage(msg,0,0,0)\r\n");
|
---|
| 1451 | i2+=lstrlen(buffer+i2);
|
---|
| 1452 | lstrcpy(buffer+i2,"\t\tIf iResult=0 or iResult=-1 Then Exit Do\r\n");
|
---|
| 1453 | i2+=lstrlen(buffer+i2);
|
---|
| 1454 | lstrcpy(buffer+i2,"\t\tIf IsDialogMessage(hDlg,msg) Then Continue\r\n");
|
---|
| 1455 | i2+=lstrlen(buffer+i2);
|
---|
| 1456 | lstrcpy(buffer+i2,"\t\tTranslateMessage(msg)\r\n");
|
---|
| 1457 | i2+=lstrlen(buffer+i2);
|
---|
| 1458 | lstrcpy(buffer+i2,"\t\tDispatchMessage(msg)\r\n");
|
---|
| 1459 | i2+=lstrlen(buffer+i2);
|
---|
| 1460 | lstrcpy(buffer+i2,"\tLoop\r\n");
|
---|
| 1461 | i2+=lstrlen(buffer+i2);
|
---|
| 1462 | lstrcpy(buffer+i2,"\tDialogBox=msg.wParam\r\n");
|
---|
| 1463 | i2+=lstrlen(buffer+i2);
|
---|
| 1464 | }
|
---|
| 1465 | lstrcpy(buffer+i2,"End Function\r\n");
|
---|
| 1466 | i2+=lstrlen(buffer+i2);
|
---|
| 1467 |
|
---|
| 1468 | //EndDialog関数
|
---|
| 1469 | lstrcpy(buffer+i2,"Sub EndDialog(hWnd As HWND, lResult As Long)\r\n");
|
---|
| 1470 | i2+=lstrlen(buffer+i2);
|
---|
| 1471 | lstrcpy(buffer+i2,"\tEnableWindow(GetWindow(hWnd,GW_OWNER),1)\r\n");
|
---|
| 1472 | i2+=lstrlen(buffer+i2);
|
---|
| 1473 | lstrcpy(buffer+i2,"\tDestroyWindow(hWnd)\r\n");
|
---|
| 1474 | i2+=lstrlen(buffer+i2);
|
---|
| 1475 | lstrcpy(buffer+i2,"\tPostMessage(0,WM_QUIT,lResult,0)\r\n");
|
---|
| 1476 | i2+=lstrlen(buffer+i2);
|
---|
| 1477 | lstrcpy(buffer+i2,"End Sub\r\n");
|
---|
| 1478 | i2+=lstrlen(buffer+i2);
|
---|
| 1479 |
|
---|
| 1480 | //CreateDialog関数
|
---|
| 1481 | lstrcpy(buffer+i2,"\r\nFunction CreateDialog(hOwnerWnd As HWND, TemplateName As LPSTR) As HWND\r\n");
|
---|
| 1482 | i2+=lstrlen(buffer+i2);
|
---|
[612] | 1483 | i=0;
|
---|
[624] | 1484 | BOOST_FOREACH( ActiveBasic::PM::WindowInfo *pWindowInfo, projectInfo.windowInfos )
|
---|
[612] | 1485 | {
|
---|
[625] | 1486 | if( pWindowInfo->IsModelessDlg() )
|
---|
| 1487 | {
|
---|
[617] | 1488 | sprintf(buffer+i2,"\tIf lstrcmp(TemplateName,\"%s\")=0 Then\r\n",pWindowInfo->GetName().c_str());
|
---|
[3] | 1489 | i2+=lstrlen(buffer+i2);
|
---|
| 1490 |
|
---|
[624] | 1491 | sprintf(buffer+i2,"\t\t%s=CreateWindowEx(&H%08x,\"NORMALDLG\",\"%s\",&H%08x,%d,%d,%d,%d,hOwnerWnd,NULL As HMENU,GetModuleHandle(0),0)\r\n",
|
---|
[617] | 1492 | pWindowInfo->GetHandleName().c_str(),
|
---|
[624] | 1493 | pWindowInfo->GetExStyle(),
|
---|
| 1494 | pWindowInfo->GetCaption().c_str(),
|
---|
| 1495 | pWindowInfo->GetStyle(),
|
---|
[615] | 1496 | pWindowInfo->pos.x,
|
---|
| 1497 | pWindowInfo->pos.y,
|
---|
| 1498 | pWindowInfo->size.cx,
|
---|
[624] | 1499 | pWindowInfo->size.cy);
|
---|
[3] | 1500 | i2+=lstrlen(buffer+i2);
|
---|
[617] | 1501 | sprintf(buffer+i2,"\t\tCreateDialog=%s\r\n",pWindowInfo->GetHandleName().c_str());
|
---|
[3] | 1502 | i2+=lstrlen(buffer+i2);
|
---|
| 1503 | if(bAvailUserProc[i]){
|
---|
| 1504 | sprintf(buffer+i2,"\t\tSetWindowLongPtr(%s,GWLP_WNDPROC,AddressOf(%s) As LONG_PTR)\r\n",
|
---|
[617] | 1505 | pWindowInfo->GetHandleName().c_str(),
|
---|
[625] | 1506 | pWindowInfo->GetCallbackName().c_str());
|
---|
[3] | 1507 | }
|
---|
| 1508 | else{
|
---|
| 1509 | sprintf(buffer+i2,"\t\tSetWindowLongPtr(%s,GWLP_WNDPROC,AddressOf(EventCall_%s) As LONG_PTR)\r\n",
|
---|
[617] | 1510 | pWindowInfo->GetHandleName().c_str(),
|
---|
| 1511 | pWindowInfo->GetName().c_str());
|
---|
[3] | 1512 | }
|
---|
| 1513 | i2+=lstrlen(buffer+i2);
|
---|
[617] | 1514 | sprintf(buffer+i2,"\t\tSendMessage(%s,WM_INITDIALOG,0,0)\r\n",pWindowInfo->GetHandleName().c_str());
|
---|
[3] | 1515 | i2+=lstrlen(buffer+i2);
|
---|
[624] | 1516 | if( pWindowInfo->HasIcon() )
|
---|
| 1517 | {
|
---|
| 1518 | sprintf(buffer+i2,"\t\tSendMessage(%s,WM_SETICON,ICON_SMALL,LoadIcon(GetModuleHandle(0),MAKEINTRESOURCE(%s)) As LPARAM)\r\n",pWindowInfo->GetHandleName().c_str(),pWindowInfo->GetIconResourceName().c_str());
|
---|
[3] | 1519 | i2+=lstrlen(buffer+i2);
|
---|
| 1520 | }
|
---|
[617] | 1521 | sprintf(buffer+i2,"\tEnd If\r\n",pWindowInfo->GetName().c_str());
|
---|
[3] | 1522 | i2+=lstrlen(buffer+i2);
|
---|
| 1523 | }
|
---|
| 1524 | while(i2>65535*(size-1)){
|
---|
| 1525 | size++;
|
---|
| 1526 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size);
|
---|
| 1527 | }
|
---|
[612] | 1528 | i++;
|
---|
[3] | 1529 | }
|
---|
| 1530 | lstrcpy(buffer+i2,"End Function\r\n");
|
---|
| 1531 | i2+=lstrlen(buffer+i2);
|
---|
| 1532 |
|
---|
| 1533 |
|
---|
| 1534 | ///////////////////////
|
---|
| 1535 | // 保存(Callback.wbp)
|
---|
[620] | 1536 | sprintf(temporary,"%sCallback.wbp",projectInfo.GetWorkDir().GetPath().c_str() );
|
---|
[3] | 1537 | WriteBuffer(temporary,buffer,i2);
|
---|
| 1538 |
|
---|
| 1539 |
|
---|
| 1540 |
|
---|
| 1541 | lstrcpy(buffer,"'このファイルはウィンドウ定義ファイル(*.wnd)をもとに生成されています\r\n\r\n");
|
---|
| 1542 | i2=lstrlen(buffer);
|
---|
| 1543 |
|
---|
| 1544 | lstrcpy(buffer+i2,"Dim _RadSys_wcl As WNDCLASSEX\r\n");
|
---|
| 1545 | i2+=lstrlen(buffer+i2);
|
---|
| 1546 | lstrcpy(buffer+i2,"FillMemory(VarPtr(_RadSys_wcl),Len(_RadSys_wcl),0)\r\n");
|
---|
| 1547 | i2+=lstrlen(buffer+i2);
|
---|
| 1548 | lstrcpy(buffer+i2,"_RadSys_wcl.cbSize=Len(_RadSys_wcl)\r\n");
|
---|
| 1549 | i2+=lstrlen(buffer+i2);
|
---|
| 1550 | lstrcpy(buffer+i2,"_RadSys_wcl.hInstance=GetModuleHandle(0)\r\n");
|
---|
| 1551 | i2+=lstrlen(buffer+i2);
|
---|
| 1552 | lstrcpy(buffer+i2,"_RadSys_wcl.style=CS_HREDRAW or CS_VREDRAW or CS_DBLCLKS\r\n");
|
---|
| 1553 | i2+=lstrlen(buffer+i2);
|
---|
| 1554 | lstrcpy(buffer+i2,"_RadSys_wcl.hCursor=LoadCursor(NULL,MAKEINTRESOURCE(IDC_ARROW))\r\n");
|
---|
| 1555 | i2+=lstrlen(buffer+i2);
|
---|
| 1556 |
|
---|
[612] | 1557 | i=0;
|
---|
[624] | 1558 | BOOST_FOREACH( ActiveBasic::PM::WindowInfo *pWindowInfo, projectInfo.windowInfos )
|
---|
[612] | 1559 | {
|
---|
[625] | 1560 | if( pWindowInfo->IsDefaultWindow() )
|
---|
| 1561 | {
|
---|
[3] | 1562 | //////////////////////
|
---|
| 1563 | //通常ウィンドウ作成
|
---|
| 1564 |
|
---|
| 1565 | lstrcpy(buffer+i2,"\r\n");
|
---|
| 1566 | i2+=2;
|
---|
| 1567 |
|
---|
[624] | 1568 | if( pWindowInfo->HasIcon() )
|
---|
| 1569 | {
|
---|
| 1570 | sprintf(buffer+i2,"_RadSys_wcl.hIcon=LoadIcon(_RadSys_wcl.hInstance,MAKEINTRESOURCE(%s))\r\n",pWindowInfo->GetIconResourceName().c_str());
|
---|
[3] | 1571 | i2+=lstrlen(buffer+i2);
|
---|
[624] | 1572 | sprintf(buffer+i2,"_RadSys_wcl.hIconSm=LoadIcon(_RadSys_wcl.hInstance,MAKEINTRESOURCE(%s))\r\n",pWindowInfo->GetIconResourceName().c_str());
|
---|
[3] | 1573 | i2+=lstrlen(buffer+i2);
|
---|
| 1574 | }
|
---|
| 1575 | else{
|
---|
[624] | 1576 | lstrcpy(buffer+i2,"_RadSys_wcl.hIcon=LoadIcon(NULL,MAKEINTRESOURCE(IDI_APPLICATION))\r\n");
|
---|
[3] | 1577 | i2+=lstrlen(buffer+i2);
|
---|
[624] | 1578 | lstrcpy(buffer+i2,"_RadSys_wcl.hIconSm=LoadIcon(NULL,MAKEINTRESOURCE(IDI_WINLOGO))\r\n");
|
---|
[3] | 1579 | i2+=lstrlen(buffer+i2);
|
---|
| 1580 | }
|
---|
| 1581 |
|
---|
| 1582 | sprintf(buffer+i2,"_RadSys_wcl.lpszClassName=\"NORMAL%d\"\r\n",i);
|
---|
| 1583 | i2+=lstrlen(buffer+i2);
|
---|
| 1584 | if(bAvailUserProc[i])
|
---|
[625] | 1585 | sprintf(buffer+i2,"_RadSys_wcl.lpfnWndProc=AddressOf(%s)\r\n",pWindowInfo->GetCallbackName().c_str());
|
---|
[617] | 1586 | else sprintf(buffer+i2,"_RadSys_wcl.lpfnWndProc=AddressOf(EventCall_%s)\r\n",pWindowInfo->GetName().c_str());
|
---|
[3] | 1587 | i2+=lstrlen(buffer+i2);
|
---|
[624] | 1588 | if(pWindowInfo->GetBackgroundColor()==COLOR_3DFACE)
|
---|
[3] | 1589 | lstrcpy(buffer+i2,"_RadSys_wcl.hbrBackground=h3DFaceBrush\r\n");
|
---|
[624] | 1590 | else if(pWindowInfo->GetBackgroundColor()==-(int)RGB(255,255,255))
|
---|
[3] | 1591 | lstrcpy(buffer+i2,"_RadSys_wcl.hbrBackground=GetStockObject(WHITE_BRUSH)\r\n");
|
---|
[624] | 1592 | else if(pWindowInfo->GetBackgroundColor()==-(int)RGB(0,0,0))
|
---|
[3] | 1593 | lstrcpy(buffer+i2,"_RadSys_wcl.hbrBackground=GetStockObject(BLACK_BRUSH)\r\n");
|
---|
[624] | 1594 | else if(pWindowInfo->GetBackgroundColor()<=0||
|
---|
| 1595 | pWindowInfo->GetBackgroundColor()>=0x1000){
|
---|
[3] | 1596 | //色指定またはビットマップ
|
---|
| 1597 | sprintf(buffer+i2,"_RadSys_wcl.hbrBackground=_RadSys_hBackBrush%d\r\n",i);
|
---|
| 1598 | }
|
---|
| 1599 | i2+=lstrlen(buffer+i2);
|
---|
| 1600 | lstrcpy(buffer+i2,"RegisterClassEx(_RadSys_wcl)\r\n");
|
---|
| 1601 | i2+=lstrlen(buffer+i2);
|
---|
| 1602 | sprintf(buffer+i2,"CreateWindowEx(&H%08x,\"%s%d\",\"%s\",&H%08x,%d,%d,%d,%d,0,0,GetModuleHandle(0),0)\r\n",
|
---|
[624] | 1603 | pWindowInfo->GetExStyle(),
|
---|
| 1604 | pWindowInfo->GetClassName().c_str(), i,
|
---|
| 1605 | pWindowInfo->GetCaption().c_str(),
|
---|
| 1606 | pWindowInfo->GetStyle(),
|
---|
[615] | 1607 | pWindowInfo->pos.x,
|
---|
| 1608 | pWindowInfo->pos.y,
|
---|
| 1609 | pWindowInfo->size.cx,
|
---|
| 1610 | pWindowInfo->size.cy);
|
---|
[3] | 1611 | i2+=lstrlen(buffer+i2);
|
---|
| 1612 | }
|
---|
| 1613 |
|
---|
| 1614 | while(i2>65535*(size-1)){
|
---|
| 1615 | size++;
|
---|
| 1616 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size);
|
---|
| 1617 | }
|
---|
[612] | 1618 |
|
---|
| 1619 | i++;
|
---|
[3] | 1620 | }
|
---|
| 1621 |
|
---|
| 1622 |
|
---|
| 1623 | /////////////////////////
|
---|
| 1624 | // 保存(MakeWindow.wbp)
|
---|
[620] | 1625 | sprintf(temporary,"%sMakeWindow.wbp",projectInfo.GetWorkDir().GetPath().c_str());
|
---|
[3] | 1626 | WriteBuffer(temporary,buffer,i2);
|
---|
| 1627 | HeapDefaultFree(buffer);
|
---|
| 1628 | }
|
---|
| 1629 | int GetSaveMenuData(char *buffer,int SpaceNum,MENU_INFO *pMenuInfo,int ItemNum){
|
---|
| 1630 | int i,i2;
|
---|
| 1631 | char spaces[MAX_PATH];
|
---|
| 1632 |
|
---|
| 1633 | memset(spaces,' ',SpaceNum*4);
|
---|
| 1634 | spaces[SpaceNum*4]=0;
|
---|
| 1635 |
|
---|
| 1636 | for(i=0,i2=0;i<ItemNum;i++){
|
---|
| 1637 | if(pMenuInfo[i].pMenuInfo){
|
---|
| 1638 | sprintf(buffer+i2,"%sPOPUP = \"%s\",%d\r\n",spaces,pMenuInfo[i].caption,pMenuInfo[i].state);
|
---|
| 1639 | i2+=lstrlen(buffer+i2);
|
---|
| 1640 | i2+=GetSaveMenuData(buffer+i2,SpaceNum+1,pMenuInfo[i].pMenuInfo,pMenuInfo[i].NumberOfMenu);
|
---|
| 1641 | sprintf(buffer+i2,"%sEND\r\n",spaces);
|
---|
| 1642 | i2+=lstrlen(buffer+i2);
|
---|
| 1643 | }
|
---|
| 1644 | else if(pMenuInfo[i].type==MFT_STRING){
|
---|
| 1645 | sprintf(buffer+i2,"%sITEM = %s,\"%s\",%d\r\n",spaces,pMenuInfo[i].IdName,pMenuInfo[i].caption,pMenuInfo[i].state);
|
---|
| 1646 | i2+=lstrlen(buffer+i2);
|
---|
| 1647 | }
|
---|
| 1648 | else if(pMenuInfo[i].type==MFT_SEPARATOR){
|
---|
| 1649 | sprintf(buffer+i2,"%sSEPARATOR\r\n",spaces);
|
---|
| 1650 | i2+=lstrlen(buffer+i2);
|
---|
| 1651 | }
|
---|
| 1652 | }
|
---|
| 1653 | return i2;
|
---|
| 1654 | }
|
---|
[700] | 1655 | void SaveWindowFile( char const *path, const ActiveBasic::PM::WindowInfos &windowInfos )
|
---|
[609] | 1656 | {
|
---|
[3] | 1657 | extern HANDLE hHeap;
|
---|
[616] | 1658 | int i,i2,size;
|
---|
[3] | 1659 | char *buffer,*temporary;
|
---|
| 1660 |
|
---|
| 1661 | size=2;
|
---|
| 1662 | buffer=(char *)HeapAlloc(hHeap,0,GENERAL_SIZE*size);
|
---|
[612] | 1663 | i2=0;
|
---|
[625] | 1664 | BOOST_FOREACH( ActiveBasic::PM::WindowInfo *pWindowInfo, windowInfos )
|
---|
[612] | 1665 | {
|
---|
[617] | 1666 | sprintf(buffer+i2,"WINDOW:%s\r\n",pWindowInfo->GetName().c_str());
|
---|
[3] | 1667 | i2+=lstrlen(buffer+i2);
|
---|
[615] | 1668 | sprintf(buffer+i2," POINT = %d,%d\r\n",pWindowInfo->pos.x,pWindowInfo->pos.y);
|
---|
[3] | 1669 | i2+=lstrlen(buffer+i2);
|
---|
[615] | 1670 | sprintf(buffer+i2," SIZE = %d,%d\r\n",pWindowInfo->size.cx,pWindowInfo->size.cy);
|
---|
[3] | 1671 | i2+=lstrlen(buffer+i2);
|
---|
[624] | 1672 | sprintf(buffer+i2," CAPTION = \"%s\"\r\n",pWindowInfo->GetCaption().c_str());
|
---|
[3] | 1673 | i2+=lstrlen(buffer+i2);
|
---|
[624] | 1674 | sprintf(buffer+i2," STYLE = &H%08x\r\n",pWindowInfo->GetStyle());
|
---|
[3] | 1675 | i2+=lstrlen(buffer+i2);
|
---|
[624] | 1676 | sprintf(buffer+i2," EXSTYLE = &H%08x\r\n",pWindowInfo->GetExStyle());
|
---|
[3] | 1677 | i2+=lstrlen(buffer+i2);
|
---|
[624] | 1678 | if( pWindowInfo->HasMenu() )
|
---|
| 1679 | {
|
---|
| 1680 | sprintf(buffer+i2," MENUID = %s\r\n",pWindowInfo->GetMenuIdName().c_str());
|
---|
[3] | 1681 | i2+=lstrlen(buffer+i2);
|
---|
| 1682 | }
|
---|
[624] | 1683 | sprintf(buffer+i2," BGCOLOR = %d\r\n",pWindowInfo->GetBackgroundColor());
|
---|
[3] | 1684 | i2+=lstrlen(buffer+i2);
|
---|
| 1685 | sprintf(buffer+i2," FONT = %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\"%s\"\r\n",
|
---|
[615] | 1686 | pWindowInfo->LogFont.lfHeight,
|
---|
| 1687 | pWindowInfo->LogFont.lfWidth,
|
---|
| 1688 | pWindowInfo->LogFont.lfEscapement,
|
---|
| 1689 | pWindowInfo->LogFont.lfOrientation,
|
---|
| 1690 | pWindowInfo->LogFont.lfWeight,
|
---|
| 1691 | pWindowInfo->LogFont.lfItalic,
|
---|
| 1692 | pWindowInfo->LogFont.lfUnderline,
|
---|
| 1693 | pWindowInfo->LogFont.lfStrikeOut,
|
---|
| 1694 | pWindowInfo->LogFont.lfCharSet,
|
---|
| 1695 | pWindowInfo->LogFont.lfOutPrecision,
|
---|
| 1696 | pWindowInfo->LogFont.lfClipPrecision,
|
---|
| 1697 | pWindowInfo->LogFont.lfQuality,
|
---|
| 1698 | pWindowInfo->LogFont.lfPitchAndFamily,
|
---|
| 1699 | pWindowInfo->LogFont.lfFaceName);
|
---|
[3] | 1700 | i2+=lstrlen(buffer+i2);
|
---|
[624] | 1701 | if( pWindowInfo->HasIcon() )
|
---|
| 1702 | {
|
---|
| 1703 | sprintf(buffer+i2," ICONID = %s\r\n",pWindowInfo->GetIconResourceName().c_str());
|
---|
[3] | 1704 | i2+=lstrlen(buffer+i2);
|
---|
| 1705 | }
|
---|
[624] | 1706 | sprintf(buffer+i2," CLASS = \"%s\"\r\n",pWindowInfo->GetClassName().c_str());
|
---|
[3] | 1707 | i2+=lstrlen(buffer+i2);
|
---|
[625] | 1708 | sprintf(buffer+i2," TYPE = %d\r\n",(DWORD)pWindowInfo->GetType());
|
---|
[3] | 1709 | i2+=lstrlen(buffer+i2);
|
---|
[624] | 1710 | BOOST_FOREACH( const ActiveBasic::PM::ChildWindowInfo *pChildInfo, pWindowInfo->childWindowInfos )
|
---|
[616] | 1711 | {
|
---|
[624] | 1712 | temporary=SetCaptionSequence(pChildInfo->GetCaption().c_str());
|
---|
[3] | 1713 | sprintf(buffer+i2," ITEM = %s,%d,%d,%d,%d,\"%s\",&H%08x,&H%08x,%d",
|
---|
[624] | 1714 | pChildInfo->GetName().c_str(),
|
---|
[616] | 1715 | pChildInfo->pos.x,pChildInfo->pos.y,
|
---|
| 1716 | pChildInfo->size.cx,pChildInfo->size.cy,
|
---|
[3] | 1717 | temporary,
|
---|
[624] | 1718 | pChildInfo->GetStyle(),
|
---|
| 1719 | pChildInfo->GetExStyle(),
|
---|
[616] | 1720 | pChildInfo->Control
|
---|
[3] | 1721 | );
|
---|
| 1722 | i2+=lstrlen(buffer+i2);
|
---|
| 1723 | HeapDefaultFree(temporary);
|
---|
[616] | 1724 | if(pChildInfo->Control==CT_IMAGEBOX){
|
---|
[624] | 1725 | sprintf(buffer+i2,",%d,\"%s\"",pChildInfo->image.type,pChildInfo->image.path.c_str());
|
---|
[3] | 1726 | i2+=lstrlen(buffer+i2);
|
---|
| 1727 | }
|
---|
| 1728 | lstrcpy(buffer+i2,"\r\n");
|
---|
| 1729 | i2+=lstrlen(buffer+i2);
|
---|
| 1730 | if(i2-GENERAL_SIZE<GENERAL_SIZE){
|
---|
| 1731 | size++;
|
---|
| 1732 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,GENERAL_SIZE*size);
|
---|
| 1733 | }
|
---|
| 1734 | }
|
---|
[617] | 1735 | sprintf(buffer+i2,"END\r\n",pWindowInfo->GetName().c_str());
|
---|
[3] | 1736 | i2+=lstrlen(buffer+i2);
|
---|
| 1737 | if(i2-GENERAL_SIZE<GENERAL_SIZE){
|
---|
| 1738 | size++;
|
---|
| 1739 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,GENERAL_SIZE*size);
|
---|
| 1740 | }
|
---|
| 1741 | }
|
---|
[618] | 1742 | for(i=0;i<projectInfo.NumberOfMenu;i++){
|
---|
| 1743 | sprintf(buffer+i2,"MENU:%s\r\n",projectInfo.pMenuInfo[i].IdName);
|
---|
[3] | 1744 | i2+=lstrlen(buffer+i2);
|
---|
[618] | 1745 | i2+=GetSaveMenuData(buffer+i2,1,projectInfo.pMenuInfo[i].pMenuInfo,projectInfo.pMenuInfo[i].NumberOfMenu);
|
---|
[617] | 1746 | sprintf(buffer+i2,"END\r\n",windowInfos[i]->GetName().c_str());
|
---|
[3] | 1747 | i2+=lstrlen(buffer+i2);
|
---|
| 1748 | if(i2-GENERAL_SIZE<GENERAL_SIZE){
|
---|
| 1749 | size++;
|
---|
| 1750 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,GENERAL_SIZE*size);
|
---|
| 1751 | }
|
---|
| 1752 | }
|
---|
| 1753 | WriteBuffer(path,buffer,i2);
|
---|
| 1754 | HeapDefaultFree(buffer);
|
---|
| 1755 |
|
---|
[618] | 1756 | projectInfo.ModifyOfMaterial=0;
|
---|
[3] | 1757 | }
|
---|
| 1758 |
|
---|
| 1759 | MENU_INFO *GetMenuData(char *buffer,int *pPos,int *pMenuNum){
|
---|
| 1760 | extern HANDLE hHeap;
|
---|
| 1761 | int i,i2,i3,i4;
|
---|
| 1762 | char temporary[MAX_PATH],*temp2,temp3[MAX_PATH];
|
---|
| 1763 | MENU_INFO *pMenuInfo;
|
---|
| 1764 |
|
---|
| 1765 | temp2=(char *)HeapAlloc(hHeap,0,lstrlen(buffer)+1);
|
---|
| 1766 |
|
---|
| 1767 | *pMenuNum=0;
|
---|
| 1768 | pMenuInfo=(MENU_INFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
|
---|
| 1769 |
|
---|
| 1770 | for(i=*pPos;;i++){
|
---|
| 1771 | if(buffer[i]=='\0') return 0;
|
---|
| 1772 | if((buffer[i]=='\r'&&buffer[i+1]=='\n')||i==0){
|
---|
| 1773 | if(buffer[i]=='\r'&&buffer[i+1]=='\n') i+=2;
|
---|
| 1774 | for(i2=0;;i++,i2++){
|
---|
| 1775 | if(!IsVariableChar(buffer[i])){
|
---|
| 1776 | temporary[i2]=0;
|
---|
| 1777 | break;
|
---|
| 1778 | }
|
---|
| 1779 | temporary[i2]=buffer[i];
|
---|
| 1780 | }
|
---|
| 1781 | if(i2==0){
|
---|
| 1782 | i--;
|
---|
| 1783 | continue;
|
---|
| 1784 | }
|
---|
| 1785 | if(buffer[i]=='='){
|
---|
| 1786 | for(i++,i2=0;;i++,i2++){
|
---|
| 1787 | if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
|
---|
| 1788 | temp2[i2]=0;
|
---|
| 1789 | break;
|
---|
| 1790 | }
|
---|
| 1791 | temp2[i2]=buffer[i];
|
---|
| 1792 | }
|
---|
| 1793 | }
|
---|
| 1794 | else{
|
---|
| 1795 | temp2[0]=0;
|
---|
| 1796 | i2=0;
|
---|
| 1797 | }
|
---|
| 1798 |
|
---|
| 1799 |
|
---|
| 1800 | if(lstrcmpi(temporary,"POPUP")==0){
|
---|
| 1801 | (*pMenuNum)++;
|
---|
| 1802 | pMenuInfo=(MENU_INFO *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,pMenuInfo,(*pMenuNum)*sizeof(MENU_INFO));
|
---|
| 1803 | i3=*pMenuNum-1;
|
---|
| 1804 |
|
---|
| 1805 | i4=GetOneParameter(temp2,0,temp3);
|
---|
| 1806 | RemoveStringQuotes(temp3);
|
---|
| 1807 | pMenuInfo[i3].caption=(char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1);
|
---|
| 1808 | lstrcpy(pMenuInfo[i3].caption,temp3);
|
---|
| 1809 |
|
---|
| 1810 | i4=GetOneParameter(temp2,i4,temp3);
|
---|
| 1811 | pMenuInfo[i3].state=GetValue(temp3);
|
---|
| 1812 |
|
---|
| 1813 | pMenuInfo[i3].pMenuInfo=GetMenuData(buffer,&i,&pMenuInfo[i3].NumberOfMenu);
|
---|
| 1814 | }
|
---|
| 1815 | else if(lstrcmpi(temporary,"ITEM")==0){
|
---|
| 1816 | (*pMenuNum)++;
|
---|
| 1817 | pMenuInfo=(MENU_INFO *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,pMenuInfo,(*pMenuNum)*sizeof(MENU_INFO));
|
---|
| 1818 | i3=*pMenuNum-1;
|
---|
| 1819 |
|
---|
| 1820 | i4=GetOneParameter(temp2,0,temp3);
|
---|
| 1821 | pMenuInfo[i3].IdName=(char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1);
|
---|
| 1822 | lstrcpy(pMenuInfo[i3].IdName,temp3);
|
---|
| 1823 |
|
---|
| 1824 | i4=GetOneParameter(temp2,i4,temp3);
|
---|
| 1825 | RemoveStringQuotes(temp3);
|
---|
| 1826 | pMenuInfo[i3].caption=(char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1);
|
---|
| 1827 | lstrcpy(pMenuInfo[i3].caption,temp3);
|
---|
| 1828 |
|
---|
| 1829 | i4=GetOneParameter(temp2,i4,temp3);
|
---|
| 1830 | pMenuInfo[i3].state=GetValue(temp3);
|
---|
| 1831 |
|
---|
| 1832 | pMenuInfo[i3].type=0;
|
---|
| 1833 | }
|
---|
| 1834 | else if(lstrcmpi(temporary,"SEPARATOR")==0){
|
---|
| 1835 | (*pMenuNum)++;
|
---|
| 1836 | pMenuInfo=(MENU_INFO *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,pMenuInfo,(*pMenuNum)*sizeof(MENU_INFO));
|
---|
| 1837 | i3=*pMenuNum-1;
|
---|
| 1838 |
|
---|
| 1839 | pMenuInfo[i3].type=MFT_SEPARATOR;
|
---|
| 1840 | }
|
---|
| 1841 | else if(lstrcmpi(temporary,"END")==0) break;
|
---|
| 1842 | i--;
|
---|
| 1843 | }
|
---|
| 1844 | }
|
---|
| 1845 | *pPos=i;
|
---|
| 1846 |
|
---|
| 1847 | HeapDefaultFree(temp2);
|
---|
| 1848 |
|
---|
| 1849 | return pMenuInfo;
|
---|
| 1850 | }
|
---|
| 1851 | _int8 OpenWindowFile(char *path){
|
---|
| 1852 | extern HANDLE hHeap;
|
---|
| 1853 | int i,i2,i3,i4,i5;
|
---|
| 1854 | char *buffer,temporary[MAX_PATH],*temp2,temp3[MAX_PATH];
|
---|
| 1855 |
|
---|
| 1856 | buffer=ReadBuffer(path);
|
---|
| 1857 | if(!buffer) return 0;
|
---|
| 1858 | temp2=(char *)HeapAlloc(hHeap,0,lstrlen(buffer)+1);
|
---|
| 1859 | ChangeOrSignToDivision(temp2,buffer);
|
---|
| 1860 | KillSpaces(temp2,buffer);
|
---|
| 1861 | //temp2はこの後の処理の一時保存バッファにも利用するので解放しない
|
---|
| 1862 |
|
---|
[618] | 1863 | projectInfo.NumberOfMenu=0;
|
---|
| 1864 | projectInfo.pMenuInfo=(MENU_INFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
|
---|
[3] | 1865 |
|
---|
[618] | 1866 | projectInfo.windowInfos.Clear();
|
---|
[3] | 1867 |
|
---|
| 1868 | for(i=0,i3=0;;i++){
|
---|
| 1869 | if(buffer[i]=='\0') break;
|
---|
| 1870 | if((buffer[i]=='\r'&&buffer[i+1]=='\n')||i==0){
|
---|
| 1871 | if(buffer[i]=='\r'&&buffer[i+1]=='\n') i+=2;
|
---|
| 1872 | for(i2=0;;i++,i2++){
|
---|
| 1873 | if(!IsVariableChar(buffer[i])){
|
---|
| 1874 | temporary[i2]=0;
|
---|
| 1875 | break;
|
---|
| 1876 | }
|
---|
| 1877 | temporary[i2]=buffer[i];
|
---|
| 1878 | }
|
---|
| 1879 | if(i2==0){
|
---|
| 1880 | i--;
|
---|
| 1881 | continue;
|
---|
| 1882 | }
|
---|
| 1883 | if(buffer[i]==':'||buffer[i]=='='){
|
---|
| 1884 | for(i++,i2=0;;i++,i2++){
|
---|
| 1885 | if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
|
---|
| 1886 | temp2[i2]=0;
|
---|
| 1887 | break;
|
---|
| 1888 | }
|
---|
| 1889 | temp2[i2]=buffer[i];
|
---|
| 1890 | }
|
---|
| 1891 | }
|
---|
| 1892 | else{
|
---|
| 1893 | temp2[0]=0;
|
---|
| 1894 | i2=0;
|
---|
| 1895 | }
|
---|
| 1896 |
|
---|
| 1897 |
|
---|
| 1898 | //////////////
|
---|
| 1899 | //ウィンドウ
|
---|
| 1900 | if(lstrcmpi(temporary,"WINDOW")==0&&i3==0){
|
---|
[624] | 1901 | projectInfo.windowInfos.push_back( new ActiveBasic::PM::WindowInfo() );
|
---|
[3] | 1902 | i3=1;
|
---|
| 1903 |
|
---|
[618] | 1904 | projectInfo.windowInfos.back()->SetName( temp2 );
|
---|
[3] | 1905 | }
|
---|
| 1906 | else if(lstrcmpi(temporary,"HANDLE")==0&&i3==1){
|
---|
[625] | 1907 | //無視
|
---|
[3] | 1908 | }
|
---|
| 1909 | else if(lstrcmpi(temporary,"POINT")==0&&i3==1){
|
---|
| 1910 | sscanf(temp2,"%d,%d",
|
---|
[618] | 1911 | &projectInfo.windowInfos.back()->pos.x,
|
---|
| 1912 | &projectInfo.windowInfos.back()->pos.y);
|
---|
| 1913 | if(projectInfo.windowInfos.back()->pos.x==-1) projectInfo.windowInfos.back()->pos.x=CW_USEDEFAULT;
|
---|
| 1914 | if(projectInfo.windowInfos.back()->pos.y==-1) projectInfo.windowInfos.back()->pos.y=CW_USEDEFAULT;
|
---|
[3] | 1915 | }
|
---|
| 1916 | else if(lstrcmpi(temporary,"SIZE")==0&&i3==1){
|
---|
| 1917 | sscanf(temp2,"%d,%d",
|
---|
[618] | 1918 | &projectInfo.windowInfos.back()->size.cx,
|
---|
| 1919 | &projectInfo.windowInfos.back()->size.cy);
|
---|
[3] | 1920 | }
|
---|
| 1921 | else if(lstrcmpi(temporary,"CAPTION")==0&&i3==1){
|
---|
| 1922 | if(temp2[0]=='\"'&&temp2[lstrlen(temp2)-1]=='\"'){
|
---|
| 1923 | temp2[lstrlen(temp2)-1]=0;
|
---|
[624] | 1924 | projectInfo.windowInfos.back()->SetCaption( temp2+1 );
|
---|
[3] | 1925 | }
|
---|
| 1926 | }
|
---|
[624] | 1927 | else if(lstrcmpi(temporary,"STYLE")==0&&i3==1) projectInfo.windowInfos.back()->SetStyle( GetValue(temp2) );
|
---|
| 1928 | else if(lstrcmpi(temporary,"EXSTYLE")==0&&i3==1) projectInfo.windowInfos.back()->SetExStyle( GetValue(temp2) );
|
---|
[3] | 1929 | else if(lstrcmpi(temporary,"MENUID")==0&&i3==1){
|
---|
[624] | 1930 | projectInfo.windowInfos.back()->SetMenuIdName( temp2 );
|
---|
[3] | 1931 | }
|
---|
[624] | 1932 | else if(lstrcmpi(temporary,"ID")==0&&i3==1)
|
---|
| 1933 | {
|
---|
| 1934 | // 無視
|
---|
| 1935 | }
|
---|
[3] | 1936 | else if(lstrcmpi(temporary,"BGCOLOR")==0&&i3==1){
|
---|
[624] | 1937 | projectInfo.windowInfos.back()->SetBackgroundColor( GetValue(temp2) );
|
---|
[618] | 1938 | if(projectInfo.dwVersion<=3){
|
---|
[3] | 1939 | //プロジェクトバージョンが3以前のときは新値に変換する
|
---|
[624] | 1940 | if(projectInfo.windowInfos.back()->GetBackgroundColor()==-1)
|
---|
| 1941 | projectInfo.windowInfos.back()->SetBackgroundColor( -(int)RGB(255,255,255) );
|
---|
[3] | 1942 | }
|
---|
| 1943 | }
|
---|
| 1944 | else if(lstrcmpi(temporary,"FONT")==0&&i3==1){
|
---|
| 1945 | i5=GetOneParameter(temp2,0,temp3);
|
---|
[618] | 1946 | projectInfo.windowInfos.back()->LogFont.lfHeight=GetValue(temp3);
|
---|
[3] | 1947 |
|
---|
| 1948 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[618] | 1949 | projectInfo.windowInfos.back()->LogFont.lfWidth=GetValue(temp3);
|
---|
[3] | 1950 |
|
---|
| 1951 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[618] | 1952 | projectInfo.windowInfos.back()->LogFont.lfEscapement=GetValue(temp3);
|
---|
[3] | 1953 |
|
---|
| 1954 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[618] | 1955 | projectInfo.windowInfos.back()->LogFont.lfOrientation=GetValue(temp3);
|
---|
[3] | 1956 |
|
---|
| 1957 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[618] | 1958 | projectInfo.windowInfos.back()->LogFont.lfWeight=GetValue(temp3);
|
---|
[3] | 1959 |
|
---|
| 1960 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[618] | 1961 | projectInfo.windowInfos.back()->LogFont.lfItalic=(BYTE)GetValue(temp3);
|
---|
[3] | 1962 |
|
---|
| 1963 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[618] | 1964 | projectInfo.windowInfos.back()->LogFont.lfUnderline=(BYTE)GetValue(temp3);
|
---|
[3] | 1965 |
|
---|
| 1966 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[618] | 1967 | projectInfo.windowInfos.back()->LogFont.lfStrikeOut=(BYTE)GetValue(temp3);
|
---|
[3] | 1968 |
|
---|
| 1969 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[618] | 1970 | projectInfo.windowInfos.back()->LogFont.lfCharSet=(BYTE)GetValue(temp3);
|
---|
[3] | 1971 |
|
---|
| 1972 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[618] | 1973 | projectInfo.windowInfos.back()->LogFont.lfOutPrecision=(BYTE)GetValue(temp3);
|
---|
[3] | 1974 |
|
---|
| 1975 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[618] | 1976 | projectInfo.windowInfos.back()->LogFont.lfClipPrecision=(BYTE)GetValue(temp3);
|
---|
[3] | 1977 |
|
---|
| 1978 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[618] | 1979 | projectInfo.windowInfos.back()->LogFont.lfQuality=(BYTE)GetValue(temp3);
|
---|
[3] | 1980 |
|
---|
| 1981 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[618] | 1982 | projectInfo.windowInfos.back()->LogFont.lfPitchAndFamily=(BYTE)GetValue(temp3);
|
---|
[3] | 1983 |
|
---|
| 1984 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
| 1985 | RemoveStringQuotes(temp3);
|
---|
[618] | 1986 | lstrcpy(projectInfo.windowInfos.back()->LogFont.lfFaceName,temp3);
|
---|
[3] | 1987 | }
|
---|
| 1988 | else if(lstrcmpi(temporary,"ICONID")==0&&i3==1){
|
---|
[624] | 1989 | projectInfo.windowInfos.back()->SetIconResourceName( temp2 );
|
---|
[3] | 1990 | }
|
---|
| 1991 | else if(lstrcmpi(temporary,"CLASS")==0&&i3==1){
|
---|
| 1992 | if(temp2[0]=='\"'&&temp2[lstrlen(temp2)-1]=='\"'){
|
---|
| 1993 | temp2[lstrlen(temp2)-1]=0;
|
---|
[624] | 1994 | projectInfo.windowInfos.back()->SetClassName( temp2+1 );
|
---|
[3] | 1995 | }
|
---|
| 1996 | }
|
---|
[625] | 1997 | else if(lstrcmpi(temporary,"CALLBACK")==0&&i3==1)
|
---|
| 1998 | {
|
---|
| 1999 | // 無視
|
---|
[3] | 2000 | }
|
---|
| 2001 |
|
---|
| 2002 | //以前のバージョンとの互換用
|
---|
[625] | 2003 | else if(lstrcmpi(temporary,"DLGTMP")==0&&i3==1) projectInfo.windowInfos.back()->SetType( (ActiveBasic::PM::WindowType::EnumType)GetValue(temp2) );
|
---|
[3] | 2004 |
|
---|
[625] | 2005 | else if(lstrcmpi(temporary,"TYPE")==0&&i3==1) projectInfo.windowInfos.back()->SetType( (ActiveBasic::PM::WindowType::EnumType)GetValue(temp2) );
|
---|
| 2006 | else if(lstrcmpi(temporary,"FILEPATH")==0&&i3==1)
|
---|
| 2007 | {
|
---|
| 2008 | // 無視
|
---|
[3] | 2009 | }
|
---|
| 2010 | else if(lstrcmpi(temporary,"ITEM")==0&&i3==1){
|
---|
[624] | 2011 | ActiveBasic::PM::ChildWindowInfo *pChildInfo = new ActiveBasic::PM::ChildWindowInfo();
|
---|
[3] | 2012 |
|
---|
| 2013 | //ID
|
---|
| 2014 | i5=GetOneParameter(temp2,0,temp3);
|
---|
[624] | 2015 | pChildInfo->SetName( temp3 );
|
---|
[3] | 2016 |
|
---|
| 2017 | //位置
|
---|
| 2018 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
| 2019 | pChildInfo->pos.x=GetValue(temp3);
|
---|
| 2020 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
| 2021 | pChildInfo->pos.y=GetValue(temp3);
|
---|
| 2022 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
| 2023 | pChildInfo->size.cx=GetValue(temp3);
|
---|
| 2024 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
| 2025 | pChildInfo->size.cy=GetValue(temp3);
|
---|
| 2026 |
|
---|
| 2027 | //テキスト
|
---|
| 2028 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
| 2029 | RemoveStringQuotes(temp3);
|
---|
| 2030 | RestoreCaptionSequence(temp3);
|
---|
[624] | 2031 | pChildInfo->SetCaption( temp3 );
|
---|
[3] | 2032 |
|
---|
| 2033 | //スタイル
|
---|
| 2034 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[624] | 2035 | pChildInfo->SetStyle( GetValue(temp3) );
|
---|
[3] | 2036 |
|
---|
| 2037 | //拡張スタイル
|
---|
| 2038 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[624] | 2039 | pChildInfo->SetExStyle( GetValue(temp3) );
|
---|
[3] | 2040 |
|
---|
| 2041 | //クラス
|
---|
| 2042 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
| 2043 | pChildInfo->Control=GetValue(temp3);
|
---|
| 2044 |
|
---|
| 2045 | if(pChildInfo->Control==CT_IMAGEBOX){
|
---|
| 2046 | //イメージ ボックスの場合
|
---|
| 2047 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
[624] | 2048 | pChildInfo->image.type = (ActiveBasic::PM::ImageReferenceType::EnumType)GetValue(temp3);
|
---|
[3] | 2049 | i5=GetOneParameter(temp2,i5,temp3);
|
---|
| 2050 | RemoveStringQuotes(temp3);
|
---|
[624] | 2051 | pChildInfo->image.path = temp3;
|
---|
[3] | 2052 | }
|
---|
| 2053 |
|
---|
[618] | 2054 | projectInfo.windowInfos.back()->childWindowInfos.push_back( pChildInfo );
|
---|
[3] | 2055 | }
|
---|
| 2056 |
|
---|
| 2057 |
|
---|
| 2058 | ////////////
|
---|
| 2059 | //メニュー
|
---|
| 2060 | else if(lstrcmpi(temporary,"MENU")==0&&i3==0){
|
---|
[618] | 2061 | projectInfo.NumberOfMenu++;
|
---|
| 2062 | projectInfo.pMenuInfo=(MENU_INFO *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,projectInfo.pMenuInfo,projectInfo.NumberOfMenu*sizeof(MENU_INFO));
|
---|
| 2063 | i4=projectInfo.NumberOfMenu-1;
|
---|
[3] | 2064 |
|
---|
| 2065 | //ID名
|
---|
[618] | 2066 | projectInfo.pMenuInfo[i4].IdName=(char *)HeapAlloc(hHeap,0,lstrlen(temp2)+1);
|
---|
| 2067 | lstrcpy(projectInfo.pMenuInfo[i4].IdName,temp2);
|
---|
| 2068 | projectInfo.pMenuInfo[i4].pMenuInfo=GetMenuData(buffer,&i,&projectInfo.pMenuInfo[i4].NumberOfMenu);
|
---|
| 2069 | if(!projectInfo.pMenuInfo[i4].pMenuInfo){
|
---|
[3] | 2070 | //"ウィンドウ定義ファイルが壊れています。\n\n%s"
|
---|
| 2071 | sprintf(temporary,STRING_ERROR_BROKEN_WNDFILE,path);
|
---|
| 2072 | MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
|
---|
| 2073 |
|
---|
| 2074 | HeapDefaultFree(temp2);
|
---|
| 2075 | HeapDefaultFree(buffer);
|
---|
| 2076 | return 0;
|
---|
| 2077 | }
|
---|
| 2078 | }
|
---|
| 2079 |
|
---|
| 2080 |
|
---|
| 2081 | else if(lstrcmpi(temporary,"END")==0&&i3) i3=0;
|
---|
| 2082 | else{
|
---|
| 2083 | //"ウィンドウ定義ファイルが壊れています。\n\n%s"
|
---|
| 2084 | sprintf(temporary,STRING_ERROR_BROKEN_WNDFILE,path);
|
---|
| 2085 | MessageBox(hOwner,temporary,APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
|
---|
| 2086 |
|
---|
| 2087 | HeapDefaultFree(temp2);
|
---|
| 2088 | HeapDefaultFree(buffer);
|
---|
| 2089 | return 0;
|
---|
| 2090 | }
|
---|
| 2091 | i--;
|
---|
| 2092 | }
|
---|
| 2093 | }
|
---|
| 2094 |
|
---|
| 2095 | HeapDefaultFree(temp2);
|
---|
| 2096 | HeapDefaultFree(buffer);
|
---|
| 2097 | return 1;
|
---|
| 2098 | }
|
---|
| 2099 |
|
---|
| 2100 | struct NEW_WINDOW{
|
---|
| 2101 | char name[MAX_PATH];
|
---|
[625] | 2102 | ActiveBasic::PM::WindowType::EnumType type;
|
---|
[3] | 2103 | };
|
---|
| 2104 | NEW_WINDOW NewWindow;
|
---|
| 2105 | BOOL CALLBACK DlgProject_NewWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
| 2106 | char temporary[MAX_PATH],temp2[MAX_PATH];
|
---|
| 2107 | switch(message){
|
---|
| 2108 | case WM_INITDIALOG:
|
---|
| 2109 | SetPosCenter(hwnd);
|
---|
| 2110 | SendDlgItemMessage(hwnd,IDC_MODALDLG,BM_SETCHECK,BST_CHECKED,0);
|
---|
| 2111 | break;
|
---|
| 2112 | case WM_COMMAND:
|
---|
| 2113 | switch(LOWORD(wParam)){
|
---|
| 2114 | case IDOK:
|
---|
| 2115 | GetDlgItemText(hwnd,IDC_WINDOWNAME,NewWindow.name,MAX_PATH);
|
---|
| 2116 | if(SendDlgItemMessage(hwnd,IDC_DEFWINDOW,BM_GETCHECK,0,0))
|
---|
[625] | 2117 | {
|
---|
| 2118 | NewWindow.type = ActiveBasic::PM::WindowType::Default;
|
---|
| 2119 | }
|
---|
[3] | 2120 | else if(SendDlgItemMessage(hwnd,IDC_MODALDLG,BM_GETCHECK,0,0))
|
---|
[625] | 2121 | {
|
---|
| 2122 | NewWindow.type = ActiveBasic::PM::WindowType::ModalDlg;
|
---|
| 2123 | }
|
---|
[3] | 2124 | else if(SendDlgItemMessage(hwnd,IDC_MODELESSDLG,BM_GETCHECK,0,0))
|
---|
[625] | 2125 | {
|
---|
| 2126 | NewWindow.type = ActiveBasic::PM::WindowType::ModelessDlg;
|
---|
| 2127 | }
|
---|
[3] | 2128 | EndDialog(hwnd,1);
|
---|
| 2129 | return 1;
|
---|
| 2130 | case IDCANCEL:
|
---|
| 2131 | EndDialog(hwnd,0);
|
---|
| 2132 | return 1;
|
---|
| 2133 | case IDC_WINDOWNAME:
|
---|
[625] | 2134 | if(HIWORD(wParam)==EN_CHANGE)
|
---|
| 2135 | {
|
---|
[3] | 2136 | GetDlgItemText(hwnd,IDC_WINDOWNAME,temporary,MAX_PATH);
|
---|
| 2137 | if(temporary[0]){
|
---|
| 2138 | sprintf(temp2,"h%s",temporary);
|
---|
| 2139 | SetDlgItemText(hwnd,IDC_WINDOWHANDLE,temp2);
|
---|
| 2140 | sprintf(temp2,"%sProc",temporary);
|
---|
| 2141 | SetDlgItemText(hwnd,IDC_WINDOWPROC,temp2);
|
---|
| 2142 | }
|
---|
| 2143 | else{
|
---|
| 2144 | SetDlgItemText(hwnd,IDC_WINDOWHANDLE,"");
|
---|
| 2145 | SetDlgItemText(hwnd,IDC_WINDOWPROC,"");
|
---|
| 2146 | }
|
---|
| 2147 | }
|
---|
| 2148 | return 1;
|
---|
| 2149 | }
|
---|
| 2150 | break;
|
---|
| 2151 | }
|
---|
| 2152 | return 0;
|
---|
| 2153 | }
|
---|
| 2154 | void GetDefaultWindowFont(LOGFONT *LogFont){
|
---|
| 2155 | LogFont->lfHeight=-12;
|
---|
| 2156 | LogFont->lfWidth=0;
|
---|
| 2157 | LogFont->lfEscapement=0;
|
---|
| 2158 | LogFont->lfOrientation=0;
|
---|
| 2159 | LogFont->lfWeight=FW_REGULAR;
|
---|
| 2160 | LogFont->lfItalic=0;
|
---|
| 2161 | LogFont->lfUnderline=0;
|
---|
| 2162 | LogFont->lfStrikeOut=0;
|
---|
| 2163 | LogFont->lfCharSet=SHIFTJIS_CHARSET;
|
---|
| 2164 | LogFont->lfOutPrecision=OUT_STROKE_PRECIS;
|
---|
| 2165 | LogFont->lfClipPrecision=CLIP_STROKE_PRECIS;
|
---|
| 2166 | LogFont->lfQuality=DRAFT_QUALITY;
|
---|
| 2167 | LogFont->lfPitchAndFamily=FF_SWISS;
|
---|
| 2168 | lstrcpy(LogFont->lfFaceName,"MS Pゴシック");
|
---|
| 2169 | }
|
---|
| 2170 | void Project_Window_Insert(void){
|
---|
| 2171 | extern HANDLE hHeap;
|
---|
[625] | 2172 | char temporary[MAX_PATH],temp2[1024];
|
---|
[3] | 2173 |
|
---|
[794] | 2174 | if (!ActiveBasic::Resource::DialogBoxAlt(hResInst, IDD_PROJECT_NEWWINDOW, hOwner, DlgProject_NewWindow))
|
---|
| 2175 | {
|
---|
| 2176 | return;
|
---|
| 2177 | }
|
---|
[3] | 2178 |
|
---|
| 2179 | //重複チェック
|
---|
| 2180 | sprintf(temporary,"%s.sbp",NewWindow.name);
|
---|
[655] | 2181 | if(projectInfo.fileSystem.root.IsExistFile(temporary)){
|
---|
[3] | 2182 | sprintf(temp2,"\"%s\" ファイルは既にプロジェクト内に存在します。",temporary);
|
---|
| 2183 | MessageBox(hOwner,temp2,APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
|
---|
| 2184 | return;
|
---|
| 2185 | }
|
---|
[624] | 2186 | BOOST_FOREACH( ActiveBasic::PM::WindowInfo *pWindowInfo, projectInfo.windowInfos )
|
---|
[612] | 2187 | {
|
---|
[617] | 2188 | if(lstrcmpi(NewWindow.name,pWindowInfo->GetName().c_str())==0){
|
---|
[3] | 2189 | //"\"%s\" ウィンドウは既にプロジェクト内に存在します。"
|
---|
[617] | 2190 | sprintf(temporary,STRING_DUPLICATIONERROR_WINDOW_IN_PROJECT,pWindowInfo->GetName().c_str());
|
---|
[3] | 2191 | MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
|
---|
| 2192 | return;
|
---|
| 2193 | }
|
---|
| 2194 | }
|
---|
| 2195 |
|
---|
[618] | 2196 | //projectInfo.windowInfos構造体コレクションに追加
|
---|
[624] | 2197 | projectInfo.windowInfos.push_back( new ActiveBasic::PM::WindowInfo() );
|
---|
[3] | 2198 |
|
---|
| 2199 |
|
---|
| 2200 | ///////////////////////////////////////
|
---|
[618] | 2201 | //projectInfo.windowInfos構造体を設定
|
---|
[3] | 2202 |
|
---|
| 2203 | //ウィンドウ名
|
---|
[618] | 2204 | projectInfo.windowInfos.back()->SetName( NewWindow.name );
|
---|
[3] | 2205 |
|
---|
| 2206 | //位置情報
|
---|
[618] | 2207 | projectInfo.windowInfos.back()->pos.x=-1;
|
---|
| 2208 | projectInfo.windowInfos.back()->pos.y=-1;
|
---|
| 2209 | projectInfo.windowInfos.back()->size.cx=480;
|
---|
| 2210 | projectInfo.windowInfos.back()->size.cy=360;
|
---|
[3] | 2211 |
|
---|
| 2212 | //ウィンドウテキスト
|
---|
[624] | 2213 | projectInfo.windowInfos.back()->SetCaption( NewWindow.name );
|
---|
[3] | 2214 |
|
---|
| 2215 | //スタイル
|
---|
| 2216 | switch(NewWindow.type){
|
---|
[625] | 2217 | case ActiveBasic::PM::WindowType::Default:
|
---|
[3] | 2218 | //通常ウィンドウ
|
---|
[624] | 2219 | projectInfo.windowInfos.back()->SetStyle( WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX );
|
---|
[3] | 2220 | break;
|
---|
[625] | 2221 | case ActiveBasic::PM::WindowType::ModalDlg:
|
---|
| 2222 | case ActiveBasic::PM::WindowType::ModelessDlg:
|
---|
[3] | 2223 | //ダイアログ テンプレート(最大化、最小化ボタンをなくして、細枠にする)
|
---|
[624] | 2224 | projectInfo.windowInfos.back()->SetStyle( WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU );
|
---|
[3] | 2225 | break;
|
---|
| 2226 | }
|
---|
| 2227 |
|
---|
| 2228 | //拡張スタイル
|
---|
[624] | 2229 | projectInfo.windowInfos.back()->SetExStyle( 0 );
|
---|
[3] | 2230 |
|
---|
| 2231 | //メニュー
|
---|
[624] | 2232 | projectInfo.windowInfos.back()->SetMenuIdName( "" );
|
---|
[3] | 2233 |
|
---|
| 2234 | //背景色
|
---|
[624] | 2235 | projectInfo.windowInfos.back()->SetBackgroundColor( COLOR_3DFACE );
|
---|
[3] | 2236 |
|
---|
| 2237 | //フォント
|
---|
[618] | 2238 | GetDefaultWindowFont(&projectInfo.windowInfos.back()->LogFont);
|
---|
[3] | 2239 |
|
---|
| 2240 | //アイコン
|
---|
[624] | 2241 | projectInfo.windowInfos.back()->SetIconResourceName( "" );
|
---|
[3] | 2242 |
|
---|
| 2243 | //クラス名
|
---|
| 2244 | lstrcpy(temporary,"NORMAL");
|
---|
[624] | 2245 | projectInfo.windowInfos.back()->SetClassName( temporary );
|
---|
[3] | 2246 |
|
---|
| 2247 | //タイプ識別
|
---|
[625] | 2248 | projectInfo.windowInfos.back()->SetType( NewWindow.type );
|
---|
[3] | 2249 |
|
---|
| 2250 |
|
---|
| 2251 |
|
---|
| 2252 | //////////////////////////
|
---|
| 2253 | // メッセージ処理ファイル
|
---|
| 2254 | //////////////////////////
|
---|
| 2255 |
|
---|
[625] | 2256 | // テンプレートを使ってMainWnd.abを生成する
|
---|
| 2257 | const std::string resultStr = PermutationWndPgmTemplate(
|
---|
| 2258 | ActiveBasic::Common::Environment::GetAbdevSystemDirPath() + "\\new_window_template.sbp",
|
---|
| 2259 | projectInfo.GetName(),
|
---|
| 2260 | (std::string)NewWindow.name,
|
---|
| 2261 | (std::string)"h" + NewWindow.name,
|
---|
| 2262 | (std::string)NewWindow.name + "Proc"
|
---|
| 2263 | );
|
---|
[3] | 2264 |
|
---|
[620] | 2265 | sprintf(temporary,"%s%s.ab",projectInfo.GetWorkDir().GetPath().c_str(),projectInfo.windowInfos.back()->GetName().c_str());
|
---|
[3] | 2266 |
|
---|
| 2267 | //書き込み
|
---|
[625] | 2268 | WriteBuffer(temporary,resultStr.c_str(),resultStr.size());
|
---|
[3] | 2269 | Project_File_Insert(temporary);
|
---|
| 2270 |
|
---|
| 2271 |
|
---|
| 2272 |
|
---|
| 2273 | //////////////////////
|
---|
| 2274 | //ツリービューに追加
|
---|
| 2275 |
|
---|
| 2276 | extern HWND hMaterialTreeView;
|
---|
| 2277 | TV_INSERTSTRUCT tv;
|
---|
| 2278 | tv.hInsertAfter=TVI_SORT;
|
---|
| 2279 | tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
|
---|
| 2280 | tv.item.iImage=2;
|
---|
| 2281 | tv.item.iSelectedImage=2;
|
---|
[618] | 2282 | tv.hParent=projectInfo.hWindowTreeItem;
|
---|
| 2283 | lstrcpy( temp2, projectInfo.windowInfos.back()->GetName().c_str() );
|
---|
[617] | 2284 | tv.item.pszText = temp2;
|
---|
[3] | 2285 |
|
---|
[618] | 2286 | projectInfo.windowInfos.back()->hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv);
|
---|
[3] | 2287 |
|
---|
[618] | 2288 | TreeView_SelectItem(hMaterialTreeView,projectInfo.windowInfos.back()->hTreeItem);
|
---|
[3] | 2289 |
|
---|
| 2290 |
|
---|
[618] | 2291 | projectInfo.ModifyOfMaterial=1;
|
---|
[3] | 2292 |
|
---|
[618] | 2293 | NewRadWindow( *projectInfo.windowInfos.back() );
|
---|
[3] | 2294 | }
|
---|
| 2295 | void Project_Window_Delete(int WndInfoNum){
|
---|
| 2296 | extern HANDLE hHeap;
|
---|
| 2297 | int i;
|
---|
| 2298 |
|
---|
[624] | 2299 | ActiveBasic::PM::WindowInfo *pWindowInfo = projectInfo.windowInfos[WndInfoNum];
|
---|
[609] | 2300 |
|
---|
[3] | 2301 | //ウィンドウが開かれている場合は閉じる
|
---|
[625] | 2302 | for(i=0;i<MdiInfo.size();i++){
|
---|
[629] | 2303 | if(MdiInfo[i]->hwnd&&lstrcmpi(pWindowInfo->GetName().c_str(),MdiInfo[i]->path.c_str())==0){
|
---|
| 2304 | SendMessage(MdiInfo[i]->hwnd,WM_CLOSE,0,0);
|
---|
[3] | 2305 | break;
|
---|
| 2306 | }
|
---|
| 2307 | }
|
---|
| 2308 |
|
---|
| 2309 | //子ウィンドウのメモリを解放
|
---|
[624] | 2310 | BOOST_FOREACH( ActiveBasic::PM::ChildWindowInfo *pChildWindowInfo, pWindowInfo->childWindowInfos )
|
---|
| 2311 | {
|
---|
| 2312 | delete pChildWindowInfo;
|
---|
[3] | 2313 | }
|
---|
[616] | 2314 | pWindowInfo->childWindowInfos.clear();
|
---|
[3] | 2315 |
|
---|
| 2316 | //ツリービューから削除
|
---|
| 2317 | extern HWND hMaterialTreeView;
|
---|
[609] | 2318 | TreeView_DeleteItem(hMaterialTreeView,pWindowInfo->hTreeItem);
|
---|
[3] | 2319 |
|
---|
[618] | 2320 | //projectInfo.windowInfos構造体から削除
|
---|
| 2321 | projectInfo.windowInfos.Erase( WndInfoNum );
|
---|
[3] | 2322 |
|
---|
[618] | 2323 | projectInfo.ModifyOfMaterial=1;
|
---|
[3] | 2324 | }
|
---|