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