source: dev/trunk/ab5.0/abdev/abdev/src/ProjectManager/ProjectManager.cpp@ 621

Last change on this file since 621 was 621, checked in by dai_9181, 16 years ago

Projectクラスをリファクタリング中。

File size: 19.9 KB
Line 
1#include "stdafx.h"
2
3using namespace ActiveBasic::IDE;
4
5void OpenWorkfile( const std::string &path );
6
7void Project::Load( char *path )
8{
9 extern HANDLE hHeap;
10 int i,i2;
11 char *buffer,temporary[MAX_PATH],temp2[MAX_PATH];
12
13 //既にプロジェクトが開かれている場合は閉じる
14 if( this->IsOpened() ){
15 if(!this->Close()) return;
16 }
17 //memset(&projectInfo,0,sizeof(PROJECTINFO));
18
19 //プロジェクトの作業ディレクトリを取得
20 _splitpath(path,temporary,temp2,0,0);
21 lstrcat( temporary, temp2 );
22 this->workDir = Jenga::Common::Directory( temporary );
23
24 //ファイルを開く、保存の初期ディレクトリをセット
25 lstrcpy(pobj_nv->DefSaveDir,this->GetWorkDir().GetPath().c_str());
26
27
28 //////////////////////////////////////////
29 // リソースデータ用領域を確保
30 this->res.pCursorResInfo=(RESITEMINFO *)HeapAlloc(hHeap,0,1);
31 this->res.NumberOfCursorRes=0;
32 this->res.pBitmapResInfo=(RESITEMINFO *)HeapAlloc(hHeap,0,1);
33 this->res.NumberOfBitmapRes=0;
34 this->res.pIconResInfo=(RESITEMINFO *)HeapAlloc(hHeap,0,1);
35 this->res.NumberOfIconRes=0;
36
37
38 //////////////////////////////////////////
39 //プロジェクトファイル(*.pj)をオープン
40 buffer=ReadBuffer(path);
41 if(!buffer) return;
42
43 //解析
44 this->pobj_DBFileInfo=new CDBFileInfo();
45 bool isUseWindow = false;
46 for(i=0;;i++){
47 if(buffer[i]=='\0') break;
48 if(buffer[i]=='\r'&&buffer[i+1]=='\n'&&buffer[i+2]=='#'){
49 for(i+=3,i2=0;;i++,i2++){
50 if(!IsVariableChar(buffer[i])){
51 temporary[i2]=0;
52 break;
53 }
54 temporary[i2]=buffer[i];
55 }
56 if(lstrcmpi(temporary,"VERSION")==0&&buffer[i]=='='){
57 for(i++,i2=0;;i++,i2++){
58 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
59 temporary[i2]=0;
60 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
61 break;
62 }
63 temporary[i2]=buffer[i];
64 }
65 this->dwVersion=GetValue(temporary);
66 }
67 else if(lstrcmpi(temporary,"MODULETYPE")==0&&buffer[i]=='='){
68 for(i++,i2=0;;i++,i2++){
69 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
70 temporary[i2]=0;
71 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
72 break;
73 }
74 temporary[i2]=buffer[i];
75 }
76 this->moduleType = (ActiveBasic::Common::TargetModuleType::EnumType)atoi(temporary);
77 }
78 else if(lstrcmpi(temporary,"NAME")==0&&buffer[i]=='='){
79 for(i++,i2=0;;i++,i2++){
80 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
81 temporary[i2]=0;
82 break;
83 }
84 temporary[i2]=buffer[i];
85 }
86 this->name = temporary;
87 }
88 else if(lstrcmpi(temporary,"PLATFORM")==0&&buffer[i]=='='){
89 for(i++,i2=0;;i++,i2++){
90 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
91 temporary[i2]=0;
92 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
93 break;
94 }
95 temporary[i2]=buffer[i];
96 }
97 i2=atoi(temporary);
98 extern HWND hSelectCompilerCombo;
99 if(i2==32){
100 //プラットフォームにWin32を選択
101 SendMessage(hSelectCompilerCombo,CB_SETCURSEL,0,0);
102 }
103 else if(i2==64){
104 //プラットフォームにWin64を選択
105 SendMessage(hSelectCompilerCombo,CB_SETCURSEL,1,0);
106 }
107 SendMessage(hSelectCompilerCombo,WM_COMMAND,MAKELONG(0,CBN_SELCHANGE),0);
108 }
109 else if(lstrcmpi(temporary,"USEWINDOW")==0&&buffer[i]=='='){
110 for(i++,i2=0;;i++,i2++){
111 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
112 temporary[i2]=0;
113 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
114 break;
115 }
116 temporary[i2]=buffer[i];
117 }
118 if( atoi(temporary) > 0 )
119 {
120 isUseWindow = true;
121 }
122 }
123 else if(lstrcmpi(temporary,"OPTION")==0&&buffer[i]=='='){
124 for(i++,i2=0;;i++,i2++){
125 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
126 temporary[i2]=0;
127 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
128 break;
129 }
130 temporary[i2]=buffer[i];
131 }
132 this->dwOption=GetValue(temporary);
133 }
134 else if(lstrcmpi(temporary,"OUTPUT_RELEASE")==0&&buffer[i]=='='){
135 for(i++,i2=0;;i++,i2++){
136 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
137 temporary[i2]=0;
138 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
139 break;
140 }
141 temporary[i2]=buffer[i];
142 }
143 lstrcpy(this->lpszOutput_Release,temporary);
144 }
145 else if(lstrcmpi(temporary,"OUTPUT_DEBUG")==0&&buffer[i]=='='){
146 for(i++,i2=0;;i++,i2++){
147 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
148 temporary[i2]=0;
149 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
150 break;
151 }
152 temporary[i2]=buffer[i];
153 }
154 lstrcpy(this->lpszOutput_Debug,temporary);
155 }
156 else if(lstrcmpi(temporary,"MANIFEST")==0&&buffer[i]=='='){
157 for(i++,i2=0;;i++,i2++){
158 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
159 temporary[i2]=0;
160 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
161 break;
162 }
163 temporary[i2]=buffer[i];
164 }
165 lstrcpy(this->szManifestPath,temporary);
166 }
167 else if(lstrcmpi(temporary,"DEBUG_CMD_LINE")==0&&buffer[i]=='='){
168 for(i++,i2=0;;i++,i2++){
169 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
170 temporary[i2]=0;
171 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
172 break;
173 }
174 temporary[i2]=buffer[i];
175 }
176 lstrcpy(this->szCmdLine,temporary);
177 }
178 else if(lstrcmpi(temporary,"DEBUG_EXE_PATH")==0&&buffer[i]=='='){
179 for(i++,i2=0;;i++,i2++){
180 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
181 temporary[i2]=0;
182 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
183 break;
184 }
185 temporary[i2]=buffer[i];
186 }
187 lstrcpy(this->szExePath,temporary);
188 }
189 else if(lstrcmpi(temporary,"RESOURCE")==0&&buffer[i]=='='){
190 for(i++,i2=0;;i++,i2++){
191 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
192 temporary[i2]=0;
193 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
194 break;
195 }
196 temporary[i2]=buffer[i];
197 }
198 if(temporary[0]!='\0'&&(!(temporary[0]=='0'&&temporary[1]=='\0'))){
199 lstrcpy(this->ResourceFileName,temporary);
200 GetResourceData();
201 }
202 else{
203 sprintf(this->ResourceFileName,"%s.rc",this->GetName().c_str());
204 }
205 }
206 else if(lstrcmpi(temporary,"SOURCE")==0&&buffer[i]=='\r'&&buffer[i+1]=='\n'){
207 while(1){
208 for(i+=2,i2=0;;i++,i2++){
209 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
210 temporary[i2]=0;
211 break;
212 }
213 temporary[i2]=buffer[i];
214 }
215 if(temporary[0]=='\0') break;
216 this->pobj_DBFileInfo->add(temporary,0);
217
218 if(buffer[i]=='\0') break;
219 }
220 }
221 else{
222 //不明なパラメータは無視
223 for(i++;;i++){
224 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
225 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
226 break;
227 }
228 }
229 }
230 if(buffer[i]=='\0') break;
231 }
232 }
233 HeapDefaultFree(buffer);
234
235 //古いバージョンファイルを考慮
236 if(this->dwVersion<=4){
237 if( this->GetModuleType() == ActiveBasic::Common::TargetModuleType::Dll )
238 {
239 sprintf(this->lpszOutput_Release,".\\%s.dll",this->GetName().c_str());
240 }
241 else
242 {
243 sprintf(this->lpszOutput_Release,".\\%s.exe",this->GetName().c_str());
244 }
245 sprintf(this->lpszOutput_Debug,".\\%s_debug.exe",this->GetName().c_str());
246 }
247
248 //ブレークポイントを初期化
249 this->pobj_DBBreakPoint=new CDBBreakPoint();
250
251
252 if( isUseWindow )
253 {
254 /////////////////////////////////////////////
255 //ウィンドウ定義ファイル(*.wnd)をオープン
256 sprintf(temp2,"%s%s.wnd",this->GetWorkDir().GetPath().c_str(),this->GetName().c_str());
257 if(!OpenWindowFile(temp2)) return;
258 }
259 else{
260 this->windowInfos.Clear();
261
262 this->NumberOfMenu=0;
263 this->pMenuInfo=(MENU_INFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
264 }
265
266 OpenWorkfile( this->GetWorkDir().GetPath() + this->GetName() + ".wrk" );
267
268 this->modify=0;
269 this->ModifyOfMaterial=0;
270 this->ModifuOfResource=0;
271}
272
273void SetStatusText(char *MenuText);
274void Project::Save()
275{
276 extern MDIINFO MdiInfo[MAX_WNDNUM];
277 int i,i2,i3,WndNum;
278 char temporary[MAX_PATH],buffer[32767];
279 HWND hChild;
280
281 SetStatusText( "プロジェクトを保存中..." );
282
283 //プロジェクトファイルのバージョンを設定
284 this->dwVersion=PROJECT_VERSION;
285
286 hChild=GetWindow(hClient,GW_CHILD);
287 while(hChild){
288 WndNum=GetWndNum(hChild);
289 if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){
290 if( MdiInfo[WndNum].pMdiTextEdit->IsModified() ){
291 for(i=0;i<this->pobj_DBFileInfo->iNum;i++){
292 this->pobj_DBFileInfo->ppobj_FileInfo[i]->GetFullPath(temporary);
293 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0){
294 SaveDocument(hChild,NULL);
295 break;
296 }
297 }
298 }
299 }
300 if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){
301 if(MdiInfo[WndNum].MdiIconEditInfo->bModify){
302 for(i=0;i<this->res.NumberOfIconRes;i++){
303 lstrcpy(temporary,this->res.pIconResInfo[i].path);
304 lstrcpy( temporary, this->GetWorkDir().GetFullPath( temporary ).c_str() );
305 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0){
306 SaveDocument(hChild,NULL);
307 break;
308 }
309 }
310 }
311 }
312 hChild=GetNextWindow(hChild,GW_HWNDNEXT);
313 }
314
315
316 //////////////////////////////////////
317 //プロジェクトファイル(*.pj)を作成
318 lstrcpy(buffer,"\' ActiveBasic Project file.\r\n\r\n");
319 i2=lstrlen(buffer);
320 sprintf(buffer+i2,"#VERSION=%d\r\n\r\n",this->dwVersion);
321 i2+=lstrlen(buffer+i2);
322 sprintf(buffer+i2,"#MODULETYPE=%d\r\n\r\n",(int)this->GetModuleType());
323 i2+=lstrlen(buffer+i2);
324 sprintf(buffer+i2,"#NAME=%s\r\n\r\n",this->GetName().c_str());
325 i2+=lstrlen(buffer+i2);
326 extern HWND hSelectCompilerCombo;
327 if(SendMessage(hSelectCompilerCombo,CB_GETCURSEL,0,0)==0){
328 sprintf(buffer+i2,"#PLATFORM=32\r\n\r\n",this->GetName().c_str());
329 i2+=lstrlen(buffer+i2);
330 }
331 else{
332 sprintf(buffer+i2,"#PLATFORM=64\r\n\r\n",this->GetName().c_str());
333 i2+=lstrlen(buffer+i2);
334 }
335 sprintf(buffer+i2,"#USEWINDOW=%d\r\n\r\n",this->windowInfos.size());
336 i2+=lstrlen(buffer+i2);
337 sprintf(buffer+i2,"#OPTION=&H%08x\r\n\r\n",this->dwOption);
338 i2+=lstrlen(buffer+i2);
339 sprintf(buffer+i2,"#OUTPUT_RELEASE=%s\r\n\r\n",this->lpszOutput_Release);
340 i2+=lstrlen(buffer+i2);
341 sprintf(buffer+i2,"#OUTPUT_DEBUG=%s\r\n\r\n",this->lpszOutput_Debug);
342 i2+=lstrlen(buffer+i2);
343 sprintf(buffer+i2,"#MANIFEST=%s\r\n\r\n",this->szManifestPath);
344 i2+=lstrlen(buffer+i2);
345 sprintf(buffer+i2,"#DEBUG_CMD_LINE=%s\r\n\r\n",this->szCmdLine);
346 i2+=lstrlen(buffer+i2);
347 sprintf(buffer+i2,"#DEBUG_EXE_PATH=%s\r\n\r\n",this->szExePath);
348 i2+=lstrlen(buffer+i2);
349 if(this->ResourceFileName[0]){
350 sprintf(buffer+i2,"#RESOURCE=%s\r\n\r\n",this->ResourceFileName);
351 i2+=lstrlen(buffer+i2);
352 }
353 else{
354 lstrcpy(buffer+i2,"#RESOURCE=0\r\n\r\n");
355 i2+=lstrlen(buffer+i2);
356 }
357 sprintf(buffer+i2,"#SOURCE\r\n");
358 i2+=lstrlen(buffer+i2);
359 for(i=0;i<this->pobj_DBFileInfo->iNum;i++){
360 sprintf(buffer+i2,"%s\r\n",this->pobj_DBFileInfo->ppobj_FileInfo[i]->m_path);
361 i2+=lstrlen(buffer+i2);
362 }
363
364 //保存
365 sprintf(temporary,"%s%s.pj",this->GetWorkDir().GetPath().c_str(),this->GetName().c_str());
366 WriteBuffer(temporary,buffer,i2);
367
368
369 //////////////////////////////////
370 // リソースファイル(*.rc、resource.ab)を作成
371 if(this->ResourceFileName[0]){
372 i2=0;
373 i3=101;
374 for(i=0;i<this->res.NumberOfCursorRes;i++,i3++){
375 sprintf(buffer+i2,"Const %s=%d\r\n",
376 this->res.pCursorResInfo[i].IdName,
377 i3);
378 i2+=lstrlen(buffer+i2);
379 }
380 for(i=0;i<this->res.NumberOfBitmapRes;i++,i3++){
381 sprintf(buffer+i2,"Const %s=%d\r\n",
382 this->res.pBitmapResInfo[i].IdName,
383 i3);
384 i2+=lstrlen(buffer+i2);
385 }
386 for(i=0;i<this->res.NumberOfIconRes;i++,i3++){
387 sprintf(buffer+i2,"Const %s=%d\r\n",
388 this->res.pIconResInfo[i].IdName,
389 i3);
390 i2+=lstrlen(buffer+i2);
391 }
392
393 //保存(resource.ab)
394 lstrcpy(temporary,"resource.ab");
395 lstrcpy( temporary, this->GetWorkDir().GetFullPath( temporary ).c_str() );
396 WriteBuffer(temporary,buffer,i2);
397
398 i2=0;
399 for(i=0;i<this->res.NumberOfCursorRes;i++){
400 sprintf(buffer+i2,"%s CURSOR \"%s\"\r\n",
401 this->res.pCursorResInfo[i].IdName,
402 this->res.pCursorResInfo[i].path);
403 i2+=lstrlen(buffer+i2);
404 }
405 for(i=0;i<this->res.NumberOfBitmapRes;i++){
406 sprintf(buffer+i2,"%s BITMAP \"%s\"\r\n",
407 this->res.pBitmapResInfo[i].IdName,
408 this->res.pBitmapResInfo[i].path);
409 i2+=lstrlen(buffer+i2);
410 }
411 for(i=0;i<this->res.NumberOfIconRes;i++){
412 sprintf(buffer+i2,"%s ICON \"%s\"\r\n",
413 this->res.pIconResInfo[i].IdName,
414 this->res.pIconResInfo[i].path);
415 i2+=lstrlen(buffer+i2);
416 }
417
418 //マニフェスト
419 if(this->dwOption&PJ_OP_RC_MANIFEST){
420 sprintf(buffer+i2,"CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST \"%s\"\r\n",
421 this->szManifestPath);
422 i2+=lstrlen(buffer+i2);
423 }
424
425 //保存
426 lstrcpy(temporary,this->ResourceFileName);
427 lstrcpy( temporary, this->GetWorkDir().GetFullPath( temporary ).c_str() );
428 WriteBuffer(temporary,buffer,i2);
429 }
430
431
432 ///////////////////////////////////////
433 //インデックスファイル(*.idx)を作成
434 buffer[0]=0;
435 lstrcpy(buffer,"' インデックス プログラム\r\n");
436 i2=lstrlen(buffer);
437 if(this->dwOption&PJ_OP_SOURCE_MASK){
438 if(this->dwOption&PJ_OP_STRICT){
439 /* #strictディレクティブは今は使われていない
440 lstrcpy(buffer+i2,"\r\n");
441 i2+=lstrlen(buffer+i2);
442 lstrcpy(buffer+i2,"#strict");
443 i2+=lstrlen(buffer+i2);
444 lstrcpy(buffer+i2,"\r\n");
445 i2+=lstrlen(buffer+i2);
446 */
447 }
448 lstrcpy(buffer+i2,"\r\n");
449 i2+=lstrlen(buffer+i2);
450 lstrcpy(buffer+i2,"'Win32APIの定義ファイル\r\n");
451 i2+=lstrlen(buffer+i2);
452 if(this->dwOption&PJ_OP_MMSYSTEM){
453 lstrcpy(buffer+i2,"#include <api_mmsys.sbp>\r\n");
454 i2+=lstrlen(buffer+i2);
455 }
456 if(this->dwOption&PJ_OP_COMMCTRL){
457 lstrcpy(buffer+i2,"#include <api_commctrl.sbp>\r\n");
458 i2+=lstrlen(buffer+i2);
459 }
460 if(this->dwOption&PJ_OP_RICHEDIT){
461 lstrcpy(buffer+i2,"#include <api_richedit.sbp>\r\n");
462 i2+=lstrlen(buffer+i2);
463 }
464 if(this->dwOption&PJ_OP_WINSOCK){
465 lstrcpy(buffer+i2,"#include <api_winsock2.sbp>\r\n");
466 i2+=lstrlen(buffer+i2);
467 }
468 }
469 if( !this->windowInfos.empty() )
470 {
471 lstrcpy(buffer+i2,"\r\n");
472 i2+=lstrlen(buffer+i2);
473 lstrcpy(buffer+i2,"'RADツールが生成するウィンドウ制御プログラム\r\n");
474 i2+=lstrlen(buffer+i2);
475 sprintf(buffer+i2,"#include \"Callback.wbp\"\r\n");
476 i2+=lstrlen(buffer+i2);
477 }
478 if(this->pobj_DBFileInfo->iNum>1){
479 lstrcpy(buffer+i2,"\r\n");
480 i2+=lstrlen(buffer+i2);
481 lstrcpy(buffer+i2,"'プロジェクト内のプログラム ファイル\r\n");
482 i2+=lstrlen(buffer+i2);
483 for(i=1;i<this->pobj_DBFileInfo->iNum;i++){
484 //メインファイルは含まない
485 sprintf(buffer+i2,"#include \"%s\"\r\n",this->pobj_DBFileInfo->ppobj_FileInfo[i]->m_path);
486 i2+=lstrlen(buffer+i2);
487 lstrcpy(buffer+i2,"_ClearNamespaceImported\r\n");
488 i2+=lstrlen(buffer+i2);
489 }
490 }
491 if( !this->windowInfos.empty() )
492 {
493 lstrcpy(buffer+i2,"\r\n");
494 i2+=lstrlen(buffer+i2);
495 lstrcpy(buffer+i2,"'RADツールが生成するウィンドウ生成プログラム\r\n");
496 i2+=lstrlen(buffer+i2);
497 sprintf(buffer+i2,"#include \"MakeWindow.wbp\"\r\n");
498 i2+=lstrlen(buffer+i2);
499 }
500 if(this->ResourceFileName[0]){
501 //リソースファイルが含まれる場合
502 lstrcpy(buffer+i2,"\r\n");
503 i2+=lstrlen(buffer+i2);
504 lstrcpy(buffer+i2,"'リソースファイル\r\n");
505 i2+=lstrlen(buffer+i2);
506 lstrcpy(buffer+i2,"#include \"resource.ab\"\r\n");
507 i2+=lstrlen(buffer+i2);
508 sprintf(buffer+i2,"#resource \"%s.rc\"\r\n",this->GetName().c_str());
509 i2+=lstrlen(buffer+i2);
510 }
511
512 //保存
513 sprintf(temporary,"%s%s.idx",this->GetWorkDir().GetPath().c_str(),this->GetName().c_str());
514 WriteBuffer(temporary,buffer,i2);
515
516
517 if( !this->windowInfos.empty() )
518 {
519 /////////////////////////////////////////////////////
520 //ウィンドウ関連ファイル(*.wnd)を作成、保存
521 if(this->ModifyOfMaterial){
522 sprintf(temporary,"%s%s.wnd",this->GetWorkDir().GetPath().c_str(),this->GetName().c_str());
523 SaveWindowFile( temporary, this->windowInfos );
524 }
525
526 //.wbpファイルを生成
527 SaveWindowProgram();
528 }
529
530
531 MakeWorkFile();
532
533 SetStatusText("");
534
535 this->modify=0;
536 this->ModifuOfResource=0;
537}
538
539bool Project::Close()
540{
541 extern HANDLE hHeap;
542 extern MDIINFO MdiInfo[MAX_WNDNUM];
543 int i,i2,WndNum;
544 HWND hChild,hCloseChild;
545 char temporary[MAX_PATH];
546
547
548 //保存確認
549 i=ProjectModifyCheck(0);
550 if(i==0) return false;
551 else if(i==2) MakeWorkFile();
552
553 //プロジェクトに関するMDIウィンドウをすべて閉じる
554 hChild=GetWindow(hClient,GW_CHILD);
555 while(hChild){
556 hCloseChild=hChild;
557 hChild=GetNextWindow(hChild,GW_HWNDNEXT);
558 WndNum=GetWndNum(hCloseChild);
559 if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){
560 for(i=0;i<this->pobj_DBFileInfo->iNum;i++){
561 this->pobj_DBFileInfo->ppobj_FileInfo[i]->GetFullPath(temporary);
562 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0){
563
564 //変更フラグをオフにする
565 MdiInfo[WndNum].pMdiTextEdit->UnModify();
566
567 SendMessage(hCloseChild,WM_CLOSE,0,0);
568 break;
569 }
570 }
571 }
572 else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD)
573 {
574 BOOST_FOREACH( const WindowInfo *pWindowInfo, windowInfos )
575 {
576 if( pWindowInfo->GetName() == MdiInfo[WndNum].path ){
577 SendMessage(hCloseChild,WM_CLOSE,0,0);
578 break;
579 }
580 }
581 }
582 else if(MdiInfo[WndNum].DocType==WNDTYPE_MENU){
583 for(i=0;i<this->NumberOfMenu;i++){
584 if(lstrcmp(MdiInfo[WndNum].path,this->pMenuInfo[i].IdName)==0){
585 SendMessage(hCloseChild,WM_CLOSE,0,0);
586 break;
587 }
588 }
589 }
590 else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){
591 for(i=0;this->res.NumberOfIconRes;i++){
592 lstrcpy(temporary,this->res.pIconResInfo[i].path);
593 lstrcpy( temporary, this->GetWorkDir().GetFullPath( temporary ).c_str() );
594 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0){
595 SendMessage(hCloseChild,WM_CLOSE,0,0);
596 break;
597 }
598 }
599 }
600 }
601
602 //ファイル情報のメモリを解放
603 delete this->pobj_DBFileInfo;
604
605 //ブレークポイントのオブジェクトを解放
606 delete this->pobj_DBBreakPoint;
607
608 //ウィンドウ情報のメモリを解放
609 BOOST_FOREACH( WindowInfo *pWindowInfo, windowInfos )
610 {
611 HeapDefaultFree(pWindowInfo->caption);
612 HeapDefaultFree(pWindowInfo->ClassName);
613 HeapDefaultFree(pWindowInfo->CallBackName);
614 HeapDefaultFree(pWindowInfo->filepath);
615 if(pWindowInfo->MenuID)
616 HeapDefaultFree(pWindowInfo->MenuID);
617 if(pWindowInfo->IconResName)
618 HeapDefaultFree(pWindowInfo->IconResName);
619
620 //子ウィンドウのメモリを解放
621 for(i2=0;i2<pWindowInfo->childWindowInfos.size();i2++){
622 HeapDefaultFree(pWindowInfo->childWindowInfos[i2]->IdName);
623 HeapDefaultFree(pWindowInfo->childWindowInfos[i2]->caption);
624 if(pWindowInfo->childWindowInfos[i2]->Control==CT_IMAGEBOX){
625 //イメージ ボックスの場合
626 HeapDefaultFree(pWindowInfo->childWindowInfos[i2]->ImageCtrlInfo.path);
627 }
628
629 delete pWindowInfo->childWindowInfos[i2];
630 }
631 pWindowInfo->childWindowInfos.clear();
632 }
633 this->windowInfos.Clear();
634
635 //メニュー情報のメモリを解放
636 HeapMenuDataFree(this->pMenuInfo,this->NumberOfMenu,0);
637 HeapDefaultFree(this->pMenuInfo);
638
639 //リソースのメモリを解放
640 for(i=0;i<this->res.NumberOfCursorRes;i++){
641 HeapDefaultFree(this->res.pCursorResInfo[i].IdName);
642 HeapDefaultFree(this->res.pCursorResInfo[i].path);
643 }
644 HeapDefaultFree(this->res.pCursorResInfo);
645 for(i=0;i<this->res.NumberOfBitmapRes;i++){
646 HeapDefaultFree(this->res.pBitmapResInfo[i].IdName);
647 HeapDefaultFree(this->res.pBitmapResInfo[i].path);
648 }
649 HeapDefaultFree(this->res.pBitmapResInfo);
650 for(i=0;i<this->res.NumberOfIconRes;i++){
651 HeapDefaultFree(this->res.pIconResInfo[i].IdName);
652 HeapDefaultFree(this->res.pIconResInfo[i].path);
653 }
654 HeapDefaultFree(this->res.pIconResInfo);
655
656 //プロジェクト ビューを非表示にする
657 extern HWND hProjectView;
658 if(IsWindowVisible(hProjectView)) SendMessage(hOwner,WM_COMMAND,IDM_PROJECTVIEW,0);
659 SetWindowText(hProjectView,"Project View");
660
661 extern HWND hProcedureTreeView;
662 extern HWND hMaterialTreeView;
663 TreeView_DeleteAllItems(pobj_FileTree->hTree);
664 TreeView_DeleteAllItems(hProcedureTreeView);
665 TreeView_DeleteAllItems(hMaterialTreeView);
666
667 //ウィンドウ タイトルを変更
668 SetWindowText(hOwner,APPLICATION_NAME);
669
670 this->name = "";
671
672 //メニュー状態を設定
673 ResetState_DocMenu();
674
675 return true;
676}
Note: See TracBrowser for help on using the repository browser.