source: dev/trunk/ab5.0/abdev/abdev/ProjectControl.cpp@ 613

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

"extern PROJECTINFO ProjectInfo;" をすべて除去した。
PROJECTINFO構造体の定義位置を移動した。

File size: 78.8 KB
Line 
1#include "stdafx.h"
2
3#include "Common.h"
4
5using namespace ActiveBasic::IDE;
6
7#if defined(JPN)
8//日本語
9#include "pj_msg_jpn.h"
10#else
11//英語
12#include "pj_msg_eng.h"
13#endif
14
15HWND hProjectViewTab;
16HWND hProcedureTreeView,hMaterialTreeView;
17HIMAGELIST hProcedureTreeViewImageList,hMaterialTreeViewImageList;
18WNDPROC OldProcedureTreeViewProc,OldMaterialTreeViewProc;
19WNDPROC OldTabProc;
20
21LRESULT CALLBACK ProcedureTreeViewProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
22 if(message==WM_CHAR&&wParam==VK_RETURN){
23 SendMessage(hProjectViewTab,WM_COMMAND,IDM_PROCEDURETREE_SHOW,0);
24 //デフォルトのメッセージ処理をするとビープ音がしてしまうので避ける
25 return 0;
26 }
27 else if(message==WM_LBUTTONDBLCLK){
28 SendMessage(hProjectViewTab,WM_COMMAND,IDM_PROCEDURETREE_SHOW,0);
29 return 0;
30 }
31 return CallWindowProc(OldProcedureTreeViewProc,hwnd,message,wParam,lParam);
32}
33LRESULT CALLBACK MaterialTreeViewProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
34 if(message==WM_CHAR&&wParam==VK_RETURN){
35 SendMessage(hProjectViewTab,WM_COMMAND,IDM_MATERIALTREE_OPEN,0);
36 //デフォルトのメッセージ処理をするとビープ音がしてしまうので避ける
37 return 0;
38 }
39 if(message==WM_KEYDOWN&&wParam==VK_DELETE) SendMessage(hProjectViewTab,WM_COMMAND,IDM_MATERIALTREE_DELETE,0);
40 return CallWindowProc(OldMaterialTreeViewProc,hwnd,message,wParam,lParam);
41}
42LRESULT CALLBACK TabProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
43 extern HANDLE hHeap;
44 extern MDIINFO MdiInfo[MAX_WNDNUM];
45 extern LPSTR DefFileFilter;
46 int i,i2,WndNum;
47 char str[MAX_PATH],temporary[MAX_PATH];
48 HWND hTree,hChild;
49 HTREEITEM hTreeItem,hTreeItem2;
50 TV_HITTESTINFO tvHitTestInfo;
51 TVITEM tvItem;
52
53 switch(message){
54 case WM_CONTEXTMENU:
55 i=TabCtrl_GetCurSel(hwnd);
56 if(i==0){
57 //ファイルツリー
58 POINT pos;
59 pos.x=LOWORD(lParam);
60 pos.y=HIWORD(lParam);
61 pobj_FileTree->ContextMenu(&pos);
62 return 0;
63 }
64 else if(i==1) hTree=hProcedureTreeView;
65 else if(i==2) hTree=hMaterialTreeView;
66 tvHitTestInfo.pt.x=LOWORD(lParam);
67 tvHitTestInfo.pt.y=HIWORD(lParam);
68 ScreenToClient(hTree,&tvHitTestInfo.pt);
69 hTreeItem=TreeView_HitTest(hTree,&tvHitTestInfo);
70 if(hTreeItem){
71 TreeView_SelectItem(hTree,hTreeItem);
72 if(i==1){
73 extern HMENU hProcedureTreeMenuBase;
74 if(TreeView_GetRoot(hTree)!=hTreeItem)
75 TrackPopupMenu(GetSubMenu(hProcedureTreeMenuBase,1),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
76 }
77 else if(i==2){
78 extern HMENU hMaterialTreeMenuBase;
79 hTreeItem2=TreeView_GetRoot(hTree);
80 for(i2=0;;i2++){
81 if(hTreeItem2==hTreeItem) break;
82 hTreeItem2=TreeView_GetNextSibling(hTree,hTreeItem2);
83 if(!hTreeItem2) break;
84 }
85 if(hTreeItem2){
86 if(i2==0)
87 TrackPopupMenu(GetSubMenu(hMaterialTreeMenuBase,0),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
88 else if(i2==1)
89 TrackPopupMenu(GetSubMenu(hMaterialTreeMenuBase,2),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
90 else if(i2==2)
91 TrackPopupMenu(GetSubMenu(hMaterialTreeMenuBase,4),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
92 else if(i2==3)
93 TrackPopupMenu(GetSubMenu(hMaterialTreeMenuBase,6),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
94 else if(i2==4)
95 TrackPopupMenu(GetSubMenu(hMaterialTreeMenuBase,8),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
96 }
97 else{
98 hTreeItem=TreeView_GetNextItem(hTree,hTreeItem,TVGN_PARENT);
99 hTreeItem2=TreeView_GetRoot(hTree);
100 for(i2=0;;i2++){
101 if(hTreeItem2==hTreeItem) break;
102 hTreeItem2=TreeView_GetNextSibling(hTree,hTreeItem2);
103 if(!hTreeItem2) break;
104 }
105 if(hTreeItem2){
106 if(i2==0)
107 TrackPopupMenu(GetSubMenu(hMaterialTreeMenuBase,1),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
108 else if(i2==1)
109 TrackPopupMenu(GetSubMenu(hMaterialTreeMenuBase,3),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
110 else if(i2==2)
111 TrackPopupMenu(GetSubMenu(hMaterialTreeMenuBase,5),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
112 else if(i2==3)
113 TrackPopupMenu(GetSubMenu(hMaterialTreeMenuBase,7),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
114 else if(i2==4)
115 TrackPopupMenu(GetSubMenu(hMaterialTreeMenuBase,9),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
116 }
117 }
118 }
119 }
120 break;
121 case WM_COMMAND:
122 switch(LOWORD(wParam)){
123
124 case IDM_PROCEDURETREE_SHOW:
125 extern BOOL bSearchingClasses;
126 if(bSearchingClasses){
127 pobj_ClassTreeView->bShowSwitch=1;
128 break;
129 }
130
131 hTreeItem=TreeView_GetSelection(hProcedureTreeView);
132 for(i=0;i<pobj_ClassTreeView->NumberOfProcedures;i++){
133 if(pobj_ClassTreeView->pProcInfo[i].hTreeItem==hTreeItem){
134
135 if( ProjectInfo.name[0] ){
136 // 対象ファイルを開く
137 lstrcpy(temporary,
138 ProjectInfo.pobj_DBFileInfo->ppobj_FileInfo[pobj_ClassTreeView->pProcInfo[i].FileNum]->m_path);
139 GetFullPath(temporary,ProjectInfo.dir);
140 hChild=OpenFileWithExtension(temporary);
141 }
142 else{
143 hChild = GetWindow(hClient,GW_CHILD);
144 }
145
146 //プロシージャの行を選択する
147 //ResetScrollbarが再描画時に呼び出されるので、再描画する
148 WndNum=GetWndNum(hChild);
149 InvalidateRect(MdiInfo[WndNum].pMdiTextEdit->hEdit,NULL,0);
150 UpdateWindow(MdiInfo[WndNum].pMdiTextEdit->hEdit);
151 TextEdit_SelectOneLine(WndNum,pobj_ClassTreeView->pProcInfo[i].code_pos,TRUE);
152
153 //タイマーをセット
154 // ※フォーカスをエディタにセットするため
155 // ※タイミングを遅らせてSetFocusを実行する必要あり
156 SetTimer(hwnd,100,10,NULL);
157
158 break;
159 }
160 }
161
162 break;
163
164 case IDM_MATERIALTREE_INSERTCURSOR:
165 Project_CursorResInsert();
166 break;
167 case IDM_MATERIALTREE_INSERTBITMAP:
168 Project_BitmapResInsert();
169 break;
170 case IDM_MATERIALTREE_INSERTICON:
171 Project_IconResInsert();
172 break;
173 case IDM_MATERIALTREE_INSERTMENU:
174 Project_Menu_Insert();
175 break;
176 case IDM_MATERIALTREE_INSERTWINDOW:
177 Project_Window_Insert();
178 break;
179 case IDM_MATERIALTREE_OPEN:
180 hTreeItem=TreeView_GetSelection(hMaterialTreeView);
181 for(i=0;i<static_cast<int>(ProjectInfo.windowInfos.size());i++){
182 if(ProjectInfo.windowInfos[i].hTreeItem==hTreeItem){
183 NewRadWindow( ProjectInfo.windowInfos[i] );
184 break;
185 }
186 }
187 for(i=0;i<ProjectInfo.NumberOfMenu;i++){
188 if(ProjectInfo.pMenuInfo[i].hTreeItem==hTreeItem){
189 NewMenuWindow(&ProjectInfo.pMenuInfo[i]);
190 break;
191 }
192 }
193 for(i=0;i<ProjectInfo.res.NumberOfIconRes;i++){
194 if(ProjectInfo.res.pIconResInfo[i].hTreeItem==hTreeItem){
195 lstrcpy(temporary,ProjectInfo.res.pIconResInfo[i].path);
196 GetFullPath(temporary,ProjectInfo.dir);
197 NewIconEditWindow(temporary);
198 break;
199 }
200 }
201 break;
202 case IDM_MATERIALTREE_DELETE:
203 hTreeItem=TreeView_GetSelection(hMaterialTreeView);
204 for(i=0;i<ProjectInfo.res.NumberOfCursorRes;i++){
205 if(ProjectInfo.res.pCursorResInfo[i].hTreeItem==hTreeItem){
206
207 //"%s カーソルをプロジェクトから削除します。よろしいですか?"
208 sprintf(str,STRING_PJ_CHECK_DELETECURSOR,ProjectInfo.res.pCursorResInfo[i].IdName);
209 if(IDCANCEL==MessageBox(hOwner,str,APPLICATION_NAME,MB_OKCANCEL|MB_ICONEXCLAMATION)) break;
210
211 Project_Cursor_Delete(i);
212 break;
213 }
214 }
215 for(i=0;i<ProjectInfo.res.NumberOfBitmapRes;i++){
216 if(ProjectInfo.res.pBitmapResInfo[i].hTreeItem==hTreeItem){
217
218 //"%s ビットマップをプロジェクトから削除します。よろしいですか?"
219 sprintf(str,STRING_PJ_CHECK_DELETEBITMAP,ProjectInfo.res.pBitmapResInfo[i].IdName);
220 if(IDCANCEL==MessageBox(hOwner,str,APPLICATION_NAME,MB_OKCANCEL|MB_ICONEXCLAMATION)) break;
221
222 Project_Bitmap_Delete(i);
223 break;
224 }
225 }
226 for(i=0;i<ProjectInfo.res.NumberOfIconRes;i++){
227 if(ProjectInfo.res.pIconResInfo[i].hTreeItem==hTreeItem){
228
229 //"%s アイコンをプロジェクトから削除します。よろしいですか?"
230 sprintf(str,STRING_PJ_CHECK_DELETEICON,ProjectInfo.res.pIconResInfo[i].IdName);
231 if(IDCANCEL==MessageBox(hOwner,str,APPLICATION_NAME,MB_OKCANCEL|MB_ICONEXCLAMATION)) break;
232
233 Project_Icon_Delete(i);
234 break;
235 }
236 }
237 for(i=0;i<ProjectInfo.NumberOfMenu;i++){
238 if(ProjectInfo.pMenuInfo[i].hTreeItem==hTreeItem){
239
240 //"%s メニューをプロジェクトから削除します。よろしいですか?"
241 sprintf(str,STRING_PJ_CHECK_DELETEMENU,ProjectInfo.pMenuInfo[i].IdName);
242 if(IDCANCEL==MessageBox(hOwner,str,APPLICATION_NAME,MB_OKCANCEL|MB_ICONEXCLAMATION)) break;
243
244 Project_Menu_Delete(i);
245 break;
246 }
247 }
248 for(i=0;i<static_cast<int>(ProjectInfo.windowInfos.size());i++){
249 if(ProjectInfo.windowInfos[i].hTreeItem==hTreeItem){
250
251 //"%s ウィンドウをプロジェクトから削除します。よろしいですか?"
252 sprintf(str,STRING_PJ_CHECK_DELETEWINDOW,ProjectInfo.windowInfos[i].name);
253 if(IDCANCEL==MessageBox(hOwner,str,APPLICATION_NAME,MB_OKCANCEL|MB_ICONEXCLAMATION)) break;
254
255 Project_Window_Delete(i);
256 break;
257 }
258 }
259 break;
260 case IDM_MENUTREE_RENAMEID:
261 extern char NewIdName[MAX_PATH];
262 hTreeItem=TreeView_GetSelection(hMaterialTreeView);
263 for(i=0;i<ProjectInfo.res.NumberOfCursorRes;i++){
264 if(ProjectInfo.res.pCursorResInfo[i].hTreeItem==hTreeItem){
265 Project_Cursor_RenameID(i);
266 break;
267 }
268 }
269 for(i=0;i<ProjectInfo.res.NumberOfBitmapRes;i++){
270 if(ProjectInfo.res.pBitmapResInfo[i].hTreeItem==hTreeItem){
271 Project_Bitmap_RenameID(i);
272 break;
273 }
274 }
275 for(i=0;i<ProjectInfo.res.NumberOfIconRes;i++){
276 if(ProjectInfo.res.pIconResInfo[i].hTreeItem==hTreeItem){
277 Project_Icon_RenameID(i);
278 }
279 }
280 for(i=0;i<ProjectInfo.NumberOfMenu;i++){
281 if(ProjectInfo.pMenuInfo[i].hTreeItem==hTreeItem){
282 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_MenuID_Input,(long)ProjectInfo.pMenuInfo[i].IdName)) break;
283
284 //重複チェック
285 for(i2=0;i2<ProjectInfo.NumberOfMenu;i2++){
286 if(i2==i) continue;
287 if(lstrcmp(NewIdName,ProjectInfo.pMenuInfo[i2].IdName)==0){
288 //"ID \"%s\" は既にプロジェクト内に存在します。"
289 sprintf(temporary,STRING_DUPLICATIONERROR_ID_IN_PROJECT,NewIdName);
290 MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
291 return 0;
292 }
293 }
294
295 HeapDefaultFree(ProjectInfo.pMenuInfo[i].IdName);
296 ProjectInfo.pMenuInfo[i].IdName=(char *)HeapAlloc(hHeap,0,lstrlen(NewIdName)+1);
297 lstrcpy(ProjectInfo.pMenuInfo[i].IdName,NewIdName);
298
299 tvItem.hItem=hTreeItem;
300 tvItem.mask=TVIF_TEXT;
301 tvItem.pszText=ProjectInfo.pMenuInfo[i].IdName;
302 tvItem.cchTextMax=lstrlen(ProjectInfo.pMenuInfo[i].IdName)+1;
303 TreeView_SetItem(hMaterialTreeView,&tvItem);
304
305 ProjectInfo.ModifyOfMaterial=1;
306
307 TreeView_SortChildren(hMaterialTreeView,
308 TreeView_GetParent(hMaterialTreeView,hTreeItem),
309 0);
310 break;
311 }
312 }
313 break;
314 case IDM_MATERIALTREE_ICON_SETMAIN:
315 RESITEMINFO TempIconResInfo;
316 hTreeItem=TreeView_GetSelection(hMaterialTreeView);
317 for(i=0;i<ProjectInfo.res.NumberOfIconRes;i++){
318 if(ProjectInfo.res.pIconResInfo[i].hTreeItem==hTreeItem){
319 if(i==0) break;
320
321 TempIconResInfo=ProjectInfo.res.pIconResInfo[i];
322 for(;i>0;i--)
323 ProjectInfo.res.pIconResInfo[i]=ProjectInfo.res.pIconResInfo[i-1];
324 ProjectInfo.res.pIconResInfo[0]=TempIconResInfo;
325
326 tvItem.hItem=ProjectInfo.res.pIconResInfo[1].hTreeItem;
327 tvItem.mask=TVIF_TEXT;
328 tvItem.pszText=ProjectInfo.res.pIconResInfo[1].IdName;
329 tvItem.cchTextMax=lstrlen(ProjectInfo.res.pIconResInfo[1].IdName)+1;
330 TreeView_SetItem(hMaterialTreeView,&tvItem);
331
332 tvItem.hItem=ProjectInfo.res.pIconResInfo[0].hTreeItem;
333 tvItem.mask=TVIF_TEXT;
334 sprintf(temporary,"%s (Main)",ProjectInfo.res.pIconResInfo[0].IdName);
335 tvItem.pszText=temporary;
336 tvItem.cchTextMax=lstrlen(temporary)+1;
337 TreeView_SetItem(hMaterialTreeView,&tvItem);
338
339 ProjectInfo.ModifuOfResource=1;
340 break;
341 }
342 }
343 break;
344 }
345 break;
346 case WM_TIMER:
347 KillTimer(hwnd,wParam);
348
349 //フォーカスをエディタにセット
350 SetFocus(GetWindow(GetWindow(hClient,GW_CHILD),GW_CHILD));
351 break;
352 case WM_NOTIFY:
353 NMHDR *hdr;
354 hdr=(NMHDR *)lParam;
355 if(hdr->code==NM_DBLCLK){
356 if(hdr->hwndFrom==hProcedureTreeView) SendMessage(hwnd,WM_COMMAND,IDM_PROCEDURETREE_SHOW,0);
357 else if(hdr->hwndFrom==hMaterialTreeView) SendMessage(hwnd,WM_COMMAND,IDM_MATERIALTREE_OPEN,0);
358 }
359 if(hdr->code==TVN_ITEMEXPANDEDW||hdr->code==TVN_ITEMEXPANDED){
360 NMTREEVIEW *nmTreeView;
361 TVITEM tvItem;
362 nmTreeView=(NMTREEVIEW *)lParam;
363 tvItem.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
364 tvItem.hItem=nmTreeView->itemNew.hItem;
365 TreeView_GetItem(nmTreeView->hdr.hwndFrom,&tvItem);
366 if(tvItem.iImage==0||tvItem.iImage==1){
367 if(nmTreeView->action==TVE_EXPAND){
368 tvItem.iImage=1;
369 tvItem.iSelectedImage=1;
370 }
371 else if(nmTreeView->action==TVE_COLLAPSE){
372 tvItem.iImage=0;
373 tvItem.iSelectedImage=0;
374 }
375 tvItem.hItem=nmTreeView->itemNew.hItem;
376 TreeView_SetItem(nmTreeView->hdr.hwndFrom,&tvItem);
377 }
378 }
379 break;
380 }
381 return CallWindowProc(OldTabProc,hwnd,message,wParam,lParam);
382}
383void ResizeProjectView_ToolWindow(void){
384 extern HWND hProjectView_ToolWindow;
385 RECT rect;
386 GetClientRect(hProjectView_ToolWindow,&rect);
387 SendMessage(hProjectView_ToolWindow,WM_SIZE,0,MAKELONG(rect.right,rect.bottom));
388}
389LRESULT CALLBACK ProjectView_ToolWindowProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
390 extern HWND hProjectView;
391 switch(message){
392 case WM_SIZE:
393 MoveWindow(hProjectView,0,0,
394 LOWORD(lParam),
395 HIWORD(lParam),1);
396 return 0;
397 case WM_CLOSE:
398 SendMessage(hOwner,WM_COMMAND,IDM_PROJECTVIEW,0);
399 return 0;
400 }
401 return DefWindowProc(hwnd,message,wParam,lParam);
402}
403void ShowFileView(){
404 TabCtrl_SetCurSel(hProjectViewTab,0);
405 ShowWindow(pobj_FileTree->hTree,SW_SHOW);
406 ShowWindow(hProcedureTreeView,SW_HIDE);
407 ShowWindow(hMaterialTreeView,SW_HIDE);
408}
409void ShowClassView(){
410 TabCtrl_SetCurSel(hProjectViewTab,1);
411 ShowWindow(pobj_FileTree->hTree,SW_HIDE);
412 ShowWindow(hMaterialTreeView,SW_HIDE);
413 ShowWindow(hProcedureTreeView,SW_SHOW);
414}
415void ShowMaterialView(){
416 TabCtrl_SetCurSel(hProjectViewTab,2);
417 ShowWindow(pobj_FileTree->hTree,SW_HIDE);
418 ShowWindow(hProcedureTreeView,SW_HIDE);
419 ShowWindow(hMaterialTreeView,SW_SHOW);
420}
421LRESULT CALLBACK ProjectViewProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
422 extern HINSTANCE hInst,hResInst;
423 extern HWND hTabOfProjectView;
424 extern HFONT hStatusFont;
425 extern HWND hProjectView_ToolWindow;
426 RECT rect;
427 HWND hButton;
428
429 switch(message){
430 case WM_CREATE:
431 hProjectViewTab=CreateWindow(WC_TABCONTROL,NULL,
432 WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE,
433 0,0,0,0,hwnd,0,hInst,0);
434 SendMessage(hProjectViewTab,WM_SETFONT,(long)hStatusFont,0);
435
436 hButton=CreateWindow("BUTTON","↓",WS_CHILD|WS_VISIBLE,
437 0,0,30,13,
438 hwnd,(HMENU)IDC_CLIP,hInst,0);
439 SendMessage(hButton,WM_SETFONT,(long)hStatusFont,0);
440
441 OldTabProc=(WNDPROC)GetWindowLongPtr(hProjectViewTab,GWLP_WNDPROC);
442 SetWindowLongPtr(hProjectViewTab,GWLP_WNDPROC,(long)TabProc);
443
444 //タブを設定
445 TC_ITEM tcItem;
446 tcItem.mask=TCIF_TEXT;
447 tcItem.pszText="File";
448 TabCtrl_InsertItem(hProjectViewTab,0,&tcItem);
449 tcItem.mask=TCIF_TEXT;
450 tcItem.pszText="Class";
451 TabCtrl_InsertItem(hProjectViewTab,1,&tcItem);
452 tcItem.mask=TCIF_TEXT;
453 tcItem.pszText="Material";
454 TabCtrl_InsertItem(hProjectViewTab,2,&tcItem);
455
456 //ファイルツリービューを作成
457 pobj_FileTree=new CFileTree(hProjectViewTab);
458
459 //クラスツリービューを作成
460 hProcedureTreeView=CreateWindowEx(WS_EX_CLIENTEDGE,WC_TREEVIEW,"",
461 WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT|TVS_SHOWSELALWAYS,
462 0,0,0,0,
463 hProjectViewTab,0,hInst,0);
464 OldProcedureTreeViewProc=(WNDPROC)GetWindowLongPtr(hProcedureTreeView,GWLP_WNDPROC);
465 SetWindowLongPtr(hProcedureTreeView,GWLP_WNDPROC,(long)ProcedureTreeViewProc);
466 //イメージリスト読み込み、設定
467 hProcedureTreeViewImageList=ImageList_Create(16,16,ILC_COLOR24|ILC_MASK,8,0);
468 ImageList_AddIcon(hProcedureTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_FOLDER_CLOSE)));
469 ImageList_AddIcon(hProcedureTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_FOLDER_OPEN)));
470 ImageList_AddIcon(hProcedureTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_PROCEDURE)));
471 ImageList_AddIcon(hProcedureTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_PROGRAM_FOLDER)));
472 ImageList_AddIcon(hProcedureTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_MEMBER_PUBLIC_VARIABLE)));
473 ImageList_AddIcon(hProcedureTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_MEMBER_PUBLIC_FUNCTION)));
474 ImageList_AddIcon(hProcedureTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_MEMBER_PRIVATE_VARIABLE)));
475 ImageList_AddIcon(hProcedureTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_MEMBER_PRIVATE_FUNCTION)));
476 TreeView_SetImageList(hProcedureTreeView,hProcedureTreeViewImageList,TVSIL_NORMAL);
477
478 //マテリアルツリービューを作成
479 hMaterialTreeView=CreateWindowEx(WS_EX_CLIENTEDGE,WC_TREEVIEW,"",
480 WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT|TVS_SHOWSELALWAYS,
481 0,0,0,0,
482 hProjectViewTab,0,hInst,0);
483 OldMaterialTreeViewProc=(WNDPROC)GetWindowLongPtr(hMaterialTreeView,GWLP_WNDPROC);
484 SetWindowLongPtr(hMaterialTreeView,GWLP_WNDPROC,(long)MaterialTreeViewProc);
485 //イメージリスト読み込み、設定
486 hMaterialTreeViewImageList=ImageList_Create(16,16,ILC_COLOR24|ILC_MASK,3,0);
487 ImageList_AddIcon(hMaterialTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_FOLDER_CLOSE)));
488 ImageList_AddIcon(hMaterialTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_FOLDER_OPEN)));
489 ImageList_AddIcon(hMaterialTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_WINDOW)));
490 ImageList_AddIcon(hMaterialTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_MENU)));
491 ImageList_AddIcon(hMaterialTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_FILE_ICON)));
492 ImageList_AddIcon(hMaterialTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_FILE_BMP)));
493 ImageList_AddIcon(hMaterialTreeViewImageList,LoadIcon(hResInst,MAKEINTRESOURCE(IDI_FILE_CURSOR)));
494 TreeView_SetImageList(hMaterialTreeView,hMaterialTreeViewImageList,TVSIL_NORMAL);
495
496 ShowWindow(pobj_FileTree->hTree,SW_SHOW);
497 GetClientRect(hwnd,&rect);
498 SendMessage(hwnd,WM_SIZE,0,MAKELONG(rect.right,rect.bottom));
499 return 0;
500 case WM_COMMAND:
501 switch(LOWORD(wParam)){
502 case IDC_CLIP:
503 if(pobj_nv->bClipProjectView==0){
504 pobj_nv->bClipProjectView=1;
505
506 SetWindowLongPtr(hwnd,GWL_EXSTYLE,WS_EX_STATICEDGE);
507 SetParent(hwnd,hOwner);
508 ResizeOwnerWnd();
509
510 ShowWindow(hProjectView_ToolWindow,SW_HIDE);
511 }
512 else{
513 pobj_nv->bClipProjectView=0;
514
515 SetWindowLongPtr(hwnd,GWL_EXSTYLE,0);
516
517 SetParent(hwnd,hProjectView_ToolWindow);
518
519 ResizeOwnerWnd();
520 ResizeProjectView_ToolWindow();
521
522 ShowWindow(hProjectView_ToolWindow,SW_SHOW);
523 }
524 return 0;
525 }
526 break;
527 case WM_NOTIFY:
528 NMHDR *hdr;
529 hdr=(NMHDR *)lParam;
530 if(hdr->hwndFrom==hProjectViewTab&&hdr->code==TCN_SELCHANGE){
531 switch( TabCtrl_GetCurSel(hProjectViewTab) ){
532 case 0:
533 ShowFileView();
534 break;
535 case 1:
536 ShowClassView();
537 break;
538 case 2:
539 ShowMaterialView();
540 break;
541 }
542 }
543 return 0;
544 case WM_PAINT:
545 PAINTSTRUCT ps;
546 HDC hdc;
547 HFONT hOldFont;
548 SIZE size;
549 HBRUSH hBrush,hOldBrush;
550 HPEN hPen,hOldPen;
551 char temporary[MAX_PATH];
552
553 if(pobj_nv->bClipProjectView==0) break;
554
555 hBrush=CreateSolidBrush(GetSysColor(COLOR_3DSHADOW));
556 hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DSHADOW));
557
558 hdc=BeginPaint(hwnd,&ps);
559
560 hOldFont=(HFONT)SelectObject(hdc,hStatusFont);
561 if( ProjectInfo.name[0] ){
562 sprintf(temporary,"%s \'%s\'",STRING_PROJECT,ProjectInfo.name);
563 }
564 else{
565 lstrcpy( temporary, "現在のドキュメント" );
566 }
567
568 GetTextExtentPoint32(hdc,temporary,lstrlen(temporary),&size);
569 GetClientRect(hwnd,&rect);
570 rect.left++;
571 rect.top++;
572 rect.right--;
573 rect.bottom=size.cy+2;
574
575 hOldBrush=(HBRUSH)SelectObject(hdc,hBrush);
576 hOldPen=(HPEN)SelectObject(hdc,hPen);
577 Rectangle(hdc,rect.left,rect.top,rect.right,rect.bottom);
578 SelectObject(hdc,hOldBrush);
579 SelectObject(hdc,hPen);
580
581 rect.top++;
582 rect.bottom--;
583 SetBkMode(hdc,OPAQUE);
584 SetBkColor(hdc,GetSysColor(COLOR_3DSHADOW));
585 SetTextColor(hdc,GetSysColor(COLOR_3DHILIGHT));
586 DrawText(hdc,temporary,lstrlen(temporary),&rect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
587
588 EndPaint(hwnd,&ps);
589
590 DeleteObject(hBrush);
591 DeleteObject(hPen);
592 return 0;
593 case WM_SIZE:
594 if(pobj_nv->bClipProjectView){
595 MoveWindow(hProjectViewTab,
596 LEVER_THICK,
597 LEVER_THICK+11,
598 LOWORD(lParam)-LEVER_THICK*2,
599 HIWORD(lParam)-LEVER_THICK*2-21,1);
600
601 GetClientRect(hProjectViewTab,&rect);
602 TabCtrl_AdjustRect(hProjectViewTab,FALSE,&rect);
603 rect.left-=2;
604 rect.right++;
605 rect.bottom++;
606
607 pobj_FileTree->resize(rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top);
608 MoveWindow(hProcedureTreeView,
609 rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,1);
610 MoveWindow(hMaterialTreeView,
611 rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,1);
612
613 GetClientRect(GetDlgItem(hwnd,IDC_CLIP),&rect);
614 MoveWindow(GetDlgItem(hwnd,IDC_CLIP),LOWORD(lParam)-rect.right,HIWORD(lParam)-rect.bottom,rect.right,rect.bottom,1);
615 InvalidateRect(GetDlgItem(hwnd,IDC_CLIP),NULL,0);
616 }
617 else{
618 MoveWindow(hProjectViewTab,0,0,
619 LOWORD(lParam),
620 HIWORD(lParam)-15,1);
621
622 GetClientRect(hProjectViewTab,&rect);
623 TabCtrl_AdjustRect(hProjectViewTab,FALSE,&rect);
624
625 pobj_FileTree->resize(rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top);
626 MoveWindow(hProcedureTreeView,
627 rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,1);
628 MoveWindow(hMaterialTreeView,
629 rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,1);
630
631 GetClientRect(GetDlgItem(hwnd,IDC_CLIP),&rect);
632 MoveWindow(GetDlgItem(hwnd,IDC_CLIP),LOWORD(lParam)-rect.right,HIWORD(lParam)-rect.bottom,rect.right,rect.bottom,1);
633 }
634 return 0;
635 case WM_CLOSE:
636 SendMessage(hOwner,WM_COMMAND,IDM_PROJECTVIEW,0);
637 return 0;
638 case WM_DESTROY:
639 delete pobj_FileTree;
640 ImageList_Destroy(hProcedureTreeViewImageList);
641 ImageList_Destroy(hMaterialTreeViewImageList);
642 return 0;
643 }
644 return DefWindowProc(hwnd,message,wParam,lParam);
645}
646
647void Project_File_Insert(char *path){
648 extern HANDLE hHeap;
649 char temporary[MAX_PATH],temp2[MAX_PATH];
650
651 GetRelationalPath(path,ProjectInfo.dir);
652
653 //重複チェック
654 if(ProjectInfo.pobj_DBFileInfo->dupli_check(path)){
655 //"\"%s\" ファイルは既にプロジェクト内に存在します。"
656 sprintf(temporary,STRING_DUPLICATIONERROR_FILE_IN_PROJECT,path);
657 MessageBox(hOwner,temporary,APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
658 return;
659 }
660
661
662 //////////////////////
663 //ツリービューに追加
664 HTREEITEM hTreeItem;
665 _splitpath(path,0,0,temporary,temp2);
666 lstrcat(temporary,temp2);
667 hTreeItem=pobj_FileTree->insert(temporary);
668
669
670 //ProjectInfo.ppobj_DBFileInfoオブジェクトに追加
671 ProjectInfo.pobj_DBFileInfo->add(path,hTreeItem);
672
673
674 ProjectInfo.modify=1;
675
676 //ファイル操作によるクラスビューの再表示
677 ResetClassTree(-1);
678}
679void Project_File_Delete(HTREEITEM hTreeItem){
680 extern HANDLE hHeap;
681
682 if(ProjectInfo.pobj_DBFileInfo->IsMainFile(hTreeItem)){
683 //"このファイルはプロジェクトのメイン ファイルです。プロジェクト内から削除することはできません。"
684 MessageBox(hOwner,STRING_ERROR_CANT_MAINFILE,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
685 return;
686 }
687
688 //ツリービューから削除
689 TreeView_DeleteItem(pobj_FileTree->hTree,hTreeItem);
690
691 //ProjectInfo.pobj_DBFileInfoオブジェクトから削除
692 ProjectInfo.pobj_DBFileInfo->del(hTreeItem);
693
694 ProjectInfo.modify=1;
695
696 //ファイル操作によるクラスビューの再表示
697 ResetClassTree(-1);
698}
699
700void MakeNewProject(){
701 extern HANDLE hHeap;
702 extern NEWPROJECTINFO NewProjectInfo;
703 int i;
704 char buffer[GENERAL_SIZE],dir[MAX_PATH],temporary[MAX_PATH],*pTemp;
705 HANDLE hFind;
706 WIN32_FIND_DATA wfd;
707
708 //既にプロジェクトが開かれている場合は閉じる
709 if(ProjectInfo.name[0]){
710 if(!CloseProject()) return;
711 }
712
713 //ワークディレクトリを作成
714 i=lstrlen(pobj_nv->ProjectSaveDir);
715 if(pobj_nv->ProjectSaveDir[i-1]=='\\'&&pobj_nv->ProjectSaveDir[i-2]!=':') pobj_nv->ProjectSaveDir[i-1]=0;
716 sprintf(dir,"%s\\%s\\",pobj_nv->ProjectSaveDir,NewProjectInfo.name);
717 i=0;
718 while(!(dir[i]==':'||(dir[i-1]=='\\'&&dir[i]=='\\'))) i++;
719 if(dir[i]==':') i++;
720 else{
721 i++;
722 while(dir[i]!='\\') i++;
723 }
724 for(i++;;i++){
725 if(dir[i]=='\\'){
726 lstrcpy(temporary,dir);
727 temporary[i]=0;
728 hFind=FindFirstFile(temporary,&wfd);
729 if(hFind==INVALID_HANDLE_VALUE){
730 if(!CreateDirectory(temporary,NULL)){
731 MessageBox(hOwner,"ディレクトリを作成できませんでした",APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
732 return;
733 }
734 }
735 else FindClose(hFind);
736 }
737 if(dir[i]=='\0') break;
738 }
739
740
741 //////////////////////////////////////
742 // プロジェクトファイル(*.pj)を作成
743 //////////////////////////////////////
744
745 // 出力先拡張子
746 const std::string outputFileExt
747 = ( NewProjectInfo.dwTypeID == IDC_DLL ) ? ".dll"
748 : ( NewProjectInfo.dwTypeID == IDC_SLL ) ? ".lib"
749 : ".exe";
750
751 //先頭の注釈
752 lstrcpy(buffer,"\' ActiveBasic Project file.\r\n\r\n");
753 i=lstrlen(buffer);
754
755 //プロジェクトのフォーマットバージョン
756 sprintf(buffer+i,"#VERSION=%d\r\n\r\n",PROJECT_VERSION);
757 i+=lstrlen(buffer+i);
758
759 //モジュールタイプ(EXEならば0、DLLならば1)
760 ActiveBasic::Common::TargetModuleType::EnumType moduleType
761 = ( NewProjectInfo.dwTypeID == IDC_DLL ) ? ActiveBasic::Common::TargetModuleType::Dll
762 : ( NewProjectInfo.dwTypeID == IDC_SLL ) ? ActiveBasic::Common::TargetModuleType::Sll
763 : ActiveBasic::Common::TargetModuleType::Exe;
764 lstrcpy(buffer+i,( (std::string)"#MODULETYPE=" + Jenga::Common::ToString( static_cast<int>(moduleType) ) + "\r\n\r\n" ).c_str());
765 i+=lstrlen(buffer+i);
766
767 //プロジェクト名
768 sprintf(buffer+i,"#NAME=%s\r\n\r\n",NewProjectInfo.name);
769 i+=lstrlen(buffer+i);
770
771 lstrcpy(buffer+i,"#PLATFORM=32\r\n\r\n");
772 i+=lstrlen(buffer+i);
773
774 //RADウィンドウの数
775 if(NewProjectInfo.dwTypeID==IDC_EXE_WINDOWBASE||
776 NewProjectInfo.dwTypeID==IDC_EXE_DIRECTX)
777 lstrcpy(buffer+i,"#USEWINDOW=1\r\n\r\n");
778 else lstrcpy(buffer+i,"#USEWINDOW=0\r\n\r\n");
779 i+=lstrlen(buffer+i);
780
781 //プロジェクトオプション
782 sprintf(buffer+i,"#OPTION=&H%08x\r\n\r\n",NewProjectInfo.dwOption);
783 i+=lstrlen(buffer+i);
784
785 //出力先(Release)
786 sprintf(buffer+i,"#OUTPUT_RELEASE=.\\%s%s\r\n\r\n",NewProjectInfo.name, outputFileExt.c_str());
787 i+=lstrlen(buffer+i);
788
789 //出力先(Debug)
790 sprintf(buffer+i,"#OUTPUT_DEBUG=.\\%s_debug%s\r\n\r\n",NewProjectInfo.name, outputFileExt.c_str());
791 i+=lstrlen(buffer+i);
792
793 //マニフェスト
794 sprintf(buffer+i,"#MANIFEST=%s.manifest.xml\r\n\r\n",NewProjectInfo.name);
795 i+=lstrlen(buffer+i);
796
797 //デバッグ用(コマンドライン)
798 lstrcpy(buffer+i,"#DEBUG_CMD_LINE=\r\n\r\n");
799 i+=lstrlen(buffer+i);
800
801 //デバッグ用(DLL用の実行ファイル)
802 lstrcpy(buffer+i,"#DEBUG_EXE_PATH=\r\n\r\n");
803 i+=lstrlen(buffer+i);
804
805 //リソースファイル
806 lstrcpy(buffer+i,"#RESOURCE=0\r\n\r\n");
807 i+=lstrlen(buffer+i);
808
809 //ソースファイル
810 sprintf(buffer+i,"#SOURCE\r\n%s.ab\r\n",NewProjectInfo.name);
811 i+=lstrlen(buffer+i);
812 if(NewProjectInfo.dwTypeID==IDC_EXE_WINDOWBASE||
813 NewProjectInfo.dwTypeID==IDC_EXE_DIRECTX){
814 lstrcpy(buffer+i,"MainWnd.ab\r\n");
815 i+=lstrlen(buffer+i);
816 }
817 if(NewProjectInfo.dwTypeID==IDC_EXE_DIRECTX){
818 lstrcpy(buffer+i,"dx_graphics.sbp\r\n");
819 i+=lstrlen(buffer+i);
820 lstrcpy(buffer+i,"dx_input.sbp\r\n");
821 i+=lstrlen(buffer+i);
822 lstrcpy(buffer+i,"dx_music.sbp\r\n");
823 i+=lstrlen(buffer+i);
824 }
825
826 //保存
827 sprintf(temporary,"%s%s.pj",dir,NewProjectInfo.name);
828 if(hFind=FindFirstFile(temporary,&wfd)){
829 if(hFind!=INVALID_HANDLE_VALUE){
830 FindClose(hFind);
831
832 //"指定したディレクトリにはすでにプロジェクトが存在します。上書きしますか?"
833 if(MessageBox(hOwner,STRING_ERROR_PROJECT_OVERWRITE,APPLICATION_NAME,MB_YESNO|MB_ICONEXCLAMATION)==IDNO) return;
834 }
835 }
836 if(!WriteBuffer(temporary,buffer,i)) return;
837
838
839 ///////////////////////////////////////////
840 //メインプログラムファイル(*.ab)を作成
841 if(NewProjectInfo.dwTypeID==IDC_EXE_WINDOWBASE){
842 sprintf(buffer,"#include \"%s.idx\"\r\n\r\n",NewProjectInfo.name);
843 i=lstrlen(buffer);
844 lstrcpy(buffer+i,"'---------------------------\r\n");
845 i+=lstrlen(buffer+i);
846 lstrcpy(buffer+i,"' Window Message Loop\r\n");
847 i+=lstrlen(buffer+i);
848 lstrcpy(buffer+i,"'---------------------------\r\n");
849 i+=lstrlen(buffer+i);
850 lstrcpy(buffer+i,"Dim msgMain As MSG, iResult As Long\r\n");
851 i+=lstrlen(buffer+i);
852 lstrcpy(buffer+i,"Do\r\n");
853 i+=lstrlen(buffer+i);
854 lstrcpy(buffer+i,"\tiResult=GetMessage(msgMain,0,0,0)\r\n");
855 i+=lstrlen(buffer+i);
856 lstrcpy(buffer+i,"\tIf iResult=0 or iResult=-1 Then Exit Do\r\n");
857 i+=lstrlen(buffer+i);
858 lstrcpy(buffer+i,"\tTranslateMessage(msgMain)\r\n");
859 i+=lstrlen(buffer+i);
860 lstrcpy(buffer+i,"\tDispatchMessage(msgMain)\r\n");
861 i+=lstrlen(buffer+i);
862 lstrcpy(buffer+i,"Loop\r\n\r\n");
863 i+=lstrlen(buffer+i);
864 lstrcpy(buffer+i,"' Call destructores and exit process\r\n");
865 i+=lstrlen(buffer+i);
866 lstrcpy(buffer+i,"End\r\n");
867 i+=lstrlen(buffer+i);
868 }
869 else if(NewProjectInfo.dwTypeID==IDC_EXE_PROMPTBASE){
870 sprintf(buffer,"#include \"%s.idx\"\r\n\r\n",NewProjectInfo.name);
871 i=lstrlen(buffer);
872 lstrcpy(buffer+i,"#N88BASIC\r\n\r\n");
873 i+=lstrlen(buffer+i);
874 lstrcpy(buffer+i,"' ↓ ここからプログラムが実行されます\r\n\r\n");
875 i+=lstrlen(buffer+i);
876 if(NewProjectInfo.ShowHelloWorld){
877 lstrcpy(buffer+i,"Print \"Hello World!\"\r\n");
878 i+=lstrlen(buffer+i);
879 }
880 }
881 else if(NewProjectInfo.dwTypeID==IDC_EXE_DOSPROMPTBASE){
882 sprintf(buffer,"#include \"%s.idx\"\r\n\r\n",NewProjectInfo.name);
883 i=lstrlen(buffer);
884 lstrcpy(buffer+i,"#console\r\n\r\n");
885 i+=lstrlen(buffer+i);
886 lstrcpy(buffer+i,"' ↓ ここからプログラムが実行されます\r\n\r\n");
887 i+=lstrlen(buffer+i);
888 if(NewProjectInfo.ShowHelloWorld){
889 lstrcpy(buffer+i,"Print \"Hello World!\"\r\n");
890 i+=lstrlen(buffer+i);
891 }
892 }
893 else if(NewProjectInfo.dwTypeID==IDC_EXE_NOBASE){
894 sprintf(buffer,"#include \"%s.idx\"\r\n\r\n",NewProjectInfo.name);
895 i=lstrlen(buffer);
896 lstrcpy(buffer+i,"' ↓ ここからプログラムが実行されます\r\n\r\n");
897 i+=lstrlen(buffer+i);
898 }
899 else if(NewProjectInfo.dwTypeID==IDC_EXE_DIRECTX){
900 const std::string mainExeDirectXAbpPath = ActiveBasic::Common::Environment::GetAbdevSystemDirPath() + "\\dx\\main_exe_directx.abp";
901 pTemp = ReadBuffer( mainExeDirectXAbpPath );
902
903 //#name#をプロジェクト名に置換
904 pTemp=PermutationWndPgmTemplate(pTemp,NewProjectInfo.name,0,0,0);
905 }
906 else if(NewProjectInfo.dwTypeID==IDC_DLL){
907 sprintf(buffer,"#include \"%s.idx\"\r\n\r\n",NewProjectInfo.name);
908 i=lstrlen(buffer);
909 lstrcpy(buffer+i,"'-------------------------------------------------------------------\r\n");
910 i+=lstrlen(buffer+i);
911 lstrcpy(buffer+i,"' メモ - このファイルには、DLLの構成要素を記述します。\r\n");
912 i+=lstrlen(buffer+i);
913 lstrcpy(buffer+i,"' (例:関数定義、グローバル変数、定数定義など)\r\n");
914 i+=lstrlen(buffer+i);
915 lstrcpy(buffer+i,"'\r\n");
916 i+=lstrlen(buffer+i);
917 lstrcpy(buffer+i,"' エクスポートが必要な関数には、\"Export\" 修飾子を指定します。\r\n");
918 i+=lstrlen(buffer+i);
919 lstrcpy(buffer+i,"' (例:Function Export FuncName() As Long)\r\n");
920 i+=lstrlen(buffer+i);
921 lstrcpy(buffer+i,"'-------------------------------------------------------------------\r\n");
922 i+=lstrlen(buffer+i);
923 lstrcpy(buffer+i,"\r\n");
924 i+=lstrlen(buffer+i);
925 lstrcpy(buffer+i,"Function Export DllMain(hinstDLL As HINSTANCE, fdwReason As DWord, lpvReserved As VoidPtr) As Long\r\n");
926 i+=lstrlen(buffer+i);
927 lstrcpy(buffer+i,"\t'DLLエントリポイント\r\n");
928 i+=lstrlen(buffer+i);
929 lstrcpy(buffer+i,"\tSelect Case fdwReason\r\n");
930 i+=lstrlen(buffer+i);
931 lstrcpy(buffer+i,"\t\tCase DLL_PROCESS_ATTACH\r\n");
932 i+=lstrlen(buffer+i);
933 lstrcpy(buffer+i,"\t\t\t'DLLがプロセス空間にロードされた時に実行されます。\r\n");
934 i+=lstrlen(buffer+i);
935 lstrcpy(buffer+i,"\t\t\t_System_StartupProgram()\r\n");
936 i+=lstrlen(buffer+i);
937 lstrcpy(buffer+i,"\t\t\tDllMain=1\r\n");
938 i+=lstrlen(buffer+i);
939 lstrcpy(buffer+i,"\t\tCase DLL_PROCESS_DETACH\r\n");
940 i+=lstrlen(buffer+i);
941 lstrcpy(buffer+i,"\t\t\t_System_Call_Destructor_of_GlobalObject()\r\n");
942 i+=lstrlen(buffer+i);
943 lstrcpy(buffer+i,"\tEnd Select\r\n");
944 i+=lstrlen(buffer+i);
945 lstrcpy(buffer+i,"End Function\r\n");
946 i+=lstrlen(buffer+i);
947 lstrcpy(buffer+i,"\r\n");
948 i+=lstrlen(buffer+i);
949 }
950 else if( NewProjectInfo.dwTypeID == IDC_SLL )
951 {
952 buffer[0] = 0;
953 }
954
955 //保存
956 if(NewProjectInfo.dwTypeID==IDC_EXE_DIRECTX){
957 sprintf(temporary,"%s%s.ab",dir,NewProjectInfo.name);
958 WriteBuffer(temporary,pTemp,lstrlen(pTemp));
959
960 HeapDefaultFree(pTemp);
961 }
962 else{
963 sprintf(temporary,"%s%s.ab",dir,NewProjectInfo.name);
964 if(!WriteBuffer(temporary,buffer,lstrlen(buffer))) return;
965 }
966
967
968 /////////////////////
969 // MainWnd.abを作成
970 /////////////////////
971
972 std::string mainWndSbpPath = "";
973 if(NewProjectInfo.dwTypeID==IDC_EXE_WINDOWBASE)
974 {
975 mainWndSbpPath = ActiveBasic::Common::Environment::GetAbdevSystemDirPath() + "\\MainWnd_exe_windowbase.sbp";
976 }
977 else if(NewProjectInfo.dwTypeID==IDC_EXE_DIRECTX)
978 {
979 mainWndSbpPath = ActiveBasic::Common::Environment::GetAbdevSystemDirPath() + "\\MainWnd_exe_directx.sbp";
980 }
981
982 if( !mainWndSbpPath.empty() ){
983 pTemp = ReadBuffer( mainWndSbpPath );
984
985 //#name#をプロジェクト名に置換
986 pTemp=PermutationWndPgmTemplate(pTemp,
987 NewProjectInfo.name,
988 "MainWnd",
989 "hMainWnd",
990 "MainWndProc");
991
992 if(NewProjectInfo.ShowHelloWorld){
993 //Hello World!表示
994 i=0;
995 lstrcpy(buffer+i,"\r\nSub MainWnd_Paint(hDC As HDC)\r\n");
996 i+=lstrlen(buffer+i);
997 lstrcpy(buffer+i,"\tDim rect As RECT\r\n");
998 i+=lstrlen(buffer+i);
999 lstrcpy(buffer+i,"\tGetClientRect(hMainWnd,rect)\r\n");
1000 i+=lstrlen(buffer+i);
1001 lstrcpy(buffer+i,"\tDrawText(hDC,\"Hello World!\",-1,rect,DT_CENTER or DT_VCENTER or DT_SINGLELINE)\r\n");
1002 i+=lstrlen(buffer+i);
1003 lstrcpy(buffer+i,"End Sub\r\n");
1004 i+=lstrlen(buffer+i);
1005
1006 pTemp=(char *)HeapReAlloc(hHeap,0,pTemp,lstrlen(pTemp)+lstrlen(buffer)+1);
1007 lstrcat(pTemp,buffer);
1008 }
1009
1010 sprintf(temporary,"%sMainWnd.ab",dir,NewProjectInfo.name);
1011 WriteBuffer(temporary,pTemp,lstrlen(pTemp));
1012
1013 HeapDefaultFree(pTemp);
1014 }
1015
1016
1017 if(NewProjectInfo.dwTypeID==IDC_EXE_DIRECTX){
1018 ///////////////////////////
1019 // DirextX対応アプリのとき
1020 ///////////////////////////
1021
1022 //dx_graphics.sbpをコピー
1023 const std::string dxGraphicsSbpPath = ActiveBasic::Common::Environment::GetAbdevSystemDirPath() + "\\dx\\dx_graphics.sbp";
1024 pTemp = ReadBuffer( dxGraphicsSbpPath );
1025 sprintf(temporary,"%sdx_graphics.sbp",dir,NewProjectInfo.name);
1026 WriteBuffer(temporary,pTemp,lstrlen(pTemp));
1027 HeapDefaultFree(pTemp);
1028
1029 //dx_input.sbpをコピー
1030 const std::string dxInputSbpPath = ActiveBasic::Common::Environment::GetAbdevSystemDirPath() + "\\dx\\dx_input.sbp";
1031 pTemp = ReadBuffer( dxInputSbpPath );
1032 sprintf(temporary,"%sdx_input.sbp",dir,NewProjectInfo.name);
1033 WriteBuffer(temporary,pTemp,lstrlen(pTemp));
1034 HeapDefaultFree(pTemp);
1035
1036 //dx_music.sbpをコピー
1037 const std::string dxMusicSbpPath = ActiveBasic::Common::Environment::GetAbdevSystemDirPath() + "\\dx\\dx_music.sbp";
1038 pTemp = ReadBuffer( dxMusicSbpPath );
1039 sprintf(temporary,"%sdx_music.sbp",dir,NewProjectInfo.name);
1040 WriteBuffer(temporary,pTemp,lstrlen(pTemp));
1041 HeapDefaultFree(pTemp);
1042
1043 //dx9abm.dllをコピー
1044 sprintf(temporary,"%sRuntime\\dx9abm.dll",pj_editor_Dir);
1045 sprintf(buffer,"%sdx9abm.dll",dir,NewProjectInfo.name);
1046 CopyFile(temporary,buffer,0);
1047 }
1048
1049
1050 if(NewProjectInfo.dwTypeID==IDC_EXE_WINDOWBASE||
1051 NewProjectInfo.dwTypeID==IDC_EXE_DIRECTX){
1052 /////////////////////////////////////////
1053 // ウィンドウ定義ファイル(*.wnd)を作成
1054 /////////////////////////////////////////
1055 std::vector<WINDOW_INFO> windowInfos;
1056 windowInfos.push_back( WINDOW_INFO() );
1057 windowInfos.back().name="MainWnd";
1058 windowInfos.back().HandleName="hMainWnd";
1059 windowInfos.back().pos.x=CW_USEDEFAULT;
1060 windowInfos.back().pos.y=CW_USEDEFAULT;
1061 windowInfos.back().size.cx=480;
1062 windowInfos.back().size.cy=360;
1063 windowInfos.back().caption=NewProjectInfo.name;
1064 if(NewProjectInfo.dwTypeID==IDC_EXE_WINDOWBASE)
1065 windowInfos.back().style=WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_VISIBLE;
1066 else if(NewProjectInfo.dwTypeID==IDC_EXE_DIRECTX)
1067 windowInfos.back().style=WS_OVERLAPPED|WS_THICKFRAME|WS_SYSMENU;
1068 windowInfos.back().ExStyle=0;
1069 windowInfos.back().MenuID=0;
1070 windowInfos.back().id=0;
1071 windowInfos.back().bgColor=COLOR_3DFACE;
1072 GetDefaultWindowFont(&windowInfos.back().LogFont);
1073 windowInfos.back().IconResName=0;
1074 windowInfos.back().ClassName="NORMAL";
1075 windowInfos.back().CallBackName="MainWndProc";
1076 windowInfos.back().type=WNDTYPE_DEFAULT;
1077 windowInfos.back().filepath="MainWnd.ab";
1078 windowInfos.back().NumberOfChildWindows=0;
1079 sprintf(temporary,"%s%s.wnd",dir,NewProjectInfo.name);
1080
1081 ProjectInfo.NumberOfMenu=0;
1082 SaveWindowFile( temporary, windowInfos );
1083 }
1084
1085
1086 ////////////////////////
1087 // ワークファイルを作成
1088 ////////////////////////
1089 lstrcpy(buffer,"case4\r\n\r\n");
1090 if(NewProjectInfo.dwTypeID==IDC_EXE_WINDOWBASE){
1091 lstrcat(buffer,"rad,MainWnd\r\n\r\n");
1092 }
1093 else{
1094 sprintf(buffer+lstrlen(buffer),"text,\"%s.ab\",0,0,0,0\r\n\r\n",NewProjectInfo.name);
1095 }
1096 lstrcat(buffer,"0\r\n0\r\n0\r\n0,0");
1097 //保存
1098 sprintf(temporary,"%s%s.wrk",dir,NewProjectInfo.name);
1099 if(!WriteBuffer(temporary,buffer,lstrlen(buffer))) return;
1100
1101
1102 //マニフェストを作成
1103 char temp2[MAX_PATH];
1104 const std::string manifestTempXmlPath = ActiveBasic::Common::Environment::GetAbdevSystemDirPath() + "\\manifest_temp.xml";
1105 sprintf(temp2,"%s%s.manifest.xml",dir,NewProjectInfo.name);
1106 CopyFile( manifestTempXmlPath.c_str(), temp2, 0 );
1107
1108
1109 sprintf(temporary,"%s%s.pj",dir,NewProjectInfo.name);
1110 OpenProject(temporary);
1111 SaveProject();
1112}
1113void SetTreeViewForProjectInfo(){
1114 extern HANDLE hHeap;
1115 extern HWND hProjectView;
1116 int i;
1117 char temporary[MAX_PATH];
1118 TV_INSERTSTRUCT tv;
1119
1120 sprintf(temporary,"%s ",ProjectInfo.name);
1121 lstrcat(temporary,STRING_PROJECT);
1122 SetWindowText(hProjectView,temporary);
1123
1124 tv.hInsertAfter=TVI_SORT;
1125 tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
1126
1127 //ファイル ツリー
1128 ProjectInfo.pobj_DBFileInfo->ResetTree();
1129
1130 //関数ツリー
1131 ResetClassTree(-1);
1132
1133 /////////////////////
1134 // マテリアル ツリー
1135
1136 //Cursorリソース フォルダ
1137 sprintf(temporary,"Cursor %s",STRING_RESOURCE);
1138 tv.hParent=TVI_ROOT;
1139 tv.item.iImage=0;
1140 tv.item.iSelectedImage=0;
1141 tv.item.pszText=temporary;
1142 tv.hParent=TreeView_InsertItem(hMaterialTreeView,&tv);
1143 ProjectInfo.res.hCursorTreeItem=tv.hParent;
1144 for(i=0;i<ProjectInfo.res.NumberOfCursorRes;i++){
1145 tv.item.iImage=6;
1146 tv.item.iSelectedImage=6;
1147 tv.item.pszText=ProjectInfo.res.pCursorResInfo[i].IdName;
1148 ProjectInfo.res.pCursorResInfo[i].hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv);
1149 }
1150
1151 //Bitmapリソース フォルダ
1152 sprintf(temporary,"Bitmap %s",STRING_RESOURCE);
1153 tv.hParent=TVI_ROOT;
1154 tv.item.iImage=0;
1155 tv.item.iSelectedImage=0;
1156 tv.item.pszText=temporary;
1157 tv.hParent=TreeView_InsertItem(hMaterialTreeView,&tv);
1158 ProjectInfo.res.hBitmapTreeItem=tv.hParent;
1159 for(i=0;i<ProjectInfo.res.NumberOfBitmapRes;i++){
1160 tv.item.iImage=5;
1161 tv.item.iSelectedImage=5;
1162 tv.item.pszText=ProjectInfo.res.pBitmapResInfo[i].IdName;
1163 ProjectInfo.res.pBitmapResInfo[i].hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv);
1164 }
1165
1166 //Iconリソース フォルダ
1167 sprintf(temporary,"Icon %s",STRING_RESOURCE);
1168 tv.hParent=TVI_ROOT;
1169 tv.item.iImage=0;
1170 tv.item.iSelectedImage=0;
1171 tv.item.pszText=temporary;
1172 tv.hParent=TreeView_InsertItem(hMaterialTreeView,&tv);
1173 ProjectInfo.res.hIconTreeItem=tv.hParent;
1174 for(i=0;i<ProjectInfo.res.NumberOfIconRes;i++){
1175 tv.item.iImage=4;
1176 tv.item.iSelectedImage=4;
1177 if(i==0){
1178 sprintf(temporary,"%s (Main)",ProjectInfo.res.pIconResInfo[i].IdName);
1179 tv.item.pszText=temporary;
1180 }
1181 else tv.item.pszText=ProjectInfo.res.pIconResInfo[i].IdName;
1182 ProjectInfo.res.pIconResInfo[i].hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv);
1183 }
1184
1185 //Menuフォルダ
1186 tv.hParent=TVI_ROOT;
1187 tv.item.iImage=0;
1188 tv.item.iSelectedImage=0;
1189 tv.item.pszText="Menu";
1190 tv.hParent=TreeView_InsertItem(hMaterialTreeView,&tv);
1191 ProjectInfo.hMenuTreeItem=tv.hParent;
1192 for(i=0;i<ProjectInfo.NumberOfMenu;i++){
1193 tv.item.iImage=3;
1194 tv.item.iSelectedImage=3;
1195 tv.item.pszText=ProjectInfo.pMenuInfo[i].IdName;
1196 ProjectInfo.pMenuInfo[i].hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv);
1197 }
1198
1199 //Windowフォルダ
1200 tv.hParent=TVI_ROOT;
1201 tv.item.iImage=0;
1202 tv.item.iSelectedImage=0;
1203 tv.item.pszText="Window";
1204 tv.hParent=TreeView_InsertItem(hMaterialTreeView,&tv);
1205 ProjectInfo.hWindowTreeItem=tv.hParent;
1206 BOOST_FOREACH( WINDOW_INFO &windowInfo, ProjectInfo.windowInfos )
1207 {
1208 tv.item.iImage=2;
1209 tv.item.iSelectedImage=2;
1210 tv.item.pszText = windowInfo.name;
1211 windowInfo.hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv);
1212 }
1213}
1214void OpenProject(char *path){
1215 extern HANDLE hHeap;
1216 int i,i2,i3;
1217 char *buffer,temporary[MAX_PATH],temp2[MAX_PATH];
1218
1219 //既にプロジェクトが開かれている場合は閉じる
1220 if(ProjectInfo.name[0]){
1221 if(!CloseProject()) return;
1222 }
1223 memset(&ProjectInfo,0,sizeof(PROJECTINFO));
1224
1225 //プロジェクトの作業ディレクトリを取得
1226 _splitpath(path,ProjectInfo.dir,temporary,0,0);
1227 lstrcat(ProjectInfo.dir,temporary);
1228
1229 //ファイルを開く、保存の初期ディレクトリをセット
1230 lstrcpy(pobj_nv->DefSaveDir,ProjectInfo.dir);
1231
1232
1233 //////////////////////////////////////////
1234 // リソースデータ用領域を確保
1235 ProjectInfo.res.pCursorResInfo=(RESITEMINFO *)HeapAlloc(hHeap,0,1);
1236 ProjectInfo.res.NumberOfCursorRes=0;
1237 ProjectInfo.res.pBitmapResInfo=(RESITEMINFO *)HeapAlloc(hHeap,0,1);
1238 ProjectInfo.res.NumberOfBitmapRes=0;
1239 ProjectInfo.res.pIconResInfo=(RESITEMINFO *)HeapAlloc(hHeap,0,1);
1240 ProjectInfo.res.NumberOfIconRes=0;
1241
1242
1243 //////////////////////////////////////////
1244 //プロジェクトファイル(*.pj)をオープン
1245 buffer=ReadBuffer(path);
1246 if(!buffer) return;
1247
1248 //解析
1249 ProjectInfo.pobj_DBFileInfo=new CDBFileInfo();
1250 bool isUseWindow = false;
1251 for(i=0;;i++){
1252 if(buffer[i]=='\0') break;
1253 if(buffer[i]=='\r'&&buffer[i+1]=='\n'&&buffer[i+2]=='#'){
1254 for(i+=3,i2=0;;i++,i2++){
1255 if(!IsVariableChar(buffer[i])){
1256 temporary[i2]=0;
1257 break;
1258 }
1259 temporary[i2]=buffer[i];
1260 }
1261 if(lstrcmpi(temporary,"VERSION")==0&&buffer[i]=='='){
1262 for(i++,i2=0;;i++,i2++){
1263 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1264 temporary[i2]=0;
1265 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
1266 break;
1267 }
1268 temporary[i2]=buffer[i];
1269 }
1270 ProjectInfo.dwVersion=GetValue(temporary);
1271 }
1272 else if(lstrcmpi(temporary,"MODULETYPE")==0&&buffer[i]=='='){
1273 for(i++,i2=0;;i++,i2++){
1274 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1275 temporary[i2]=0;
1276 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
1277 break;
1278 }
1279 temporary[i2]=buffer[i];
1280 }
1281 ProjectInfo.dwModuleType=atoi(temporary);
1282 }
1283 else if(lstrcmpi(temporary,"NAME")==0&&buffer[i]=='='){
1284 for(i++,i2=0;;i++,i2++){
1285 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1286 ProjectInfo.name[i2]=0;
1287 break;
1288 }
1289 ProjectInfo.name[i2]=buffer[i];
1290 }
1291 }
1292 else if(lstrcmpi(temporary,"PLATFORM")==0&&buffer[i]=='='){
1293 for(i++,i2=0;;i++,i2++){
1294 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1295 temporary[i2]=0;
1296 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
1297 break;
1298 }
1299 temporary[i2]=buffer[i];
1300 }
1301 i2=atoi(temporary);
1302 extern HWND hSelectCompilerCombo;
1303 if(i2==32){
1304 //プラットフォームにWin32を選択
1305 SendMessage(hSelectCompilerCombo,CB_SETCURSEL,0,0);
1306 }
1307 else if(i2==64){
1308 //プラットフォームにWin64を選択
1309 SendMessage(hSelectCompilerCombo,CB_SETCURSEL,1,0);
1310 }
1311 SendMessage(hSelectCompilerCombo,WM_COMMAND,MAKELONG(0,CBN_SELCHANGE),0);
1312 }
1313 else if(lstrcmpi(temporary,"USEWINDOW")==0&&buffer[i]=='='){
1314 for(i++,i2=0;;i++,i2++){
1315 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1316 temporary[i2]=0;
1317 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
1318 break;
1319 }
1320 temporary[i2]=buffer[i];
1321 }
1322 if( atoi(temporary) > 0 )
1323 {
1324 isUseWindow = true;
1325 }
1326 }
1327 else if(lstrcmpi(temporary,"OPTION")==0&&buffer[i]=='='){
1328 for(i++,i2=0;;i++,i2++){
1329 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1330 temporary[i2]=0;
1331 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
1332 break;
1333 }
1334 temporary[i2]=buffer[i];
1335 }
1336 ProjectInfo.dwOption=GetValue(temporary);
1337 }
1338 else if(lstrcmpi(temporary,"OUTPUT_RELEASE")==0&&buffer[i]=='='){
1339 for(i++,i2=0;;i++,i2++){
1340 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1341 temporary[i2]=0;
1342 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
1343 break;
1344 }
1345 temporary[i2]=buffer[i];
1346 }
1347 lstrcpy(ProjectInfo.lpszOutput_Release,temporary);
1348 }
1349 else if(lstrcmpi(temporary,"OUTPUT_DEBUG")==0&&buffer[i]=='='){
1350 for(i++,i2=0;;i++,i2++){
1351 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1352 temporary[i2]=0;
1353 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
1354 break;
1355 }
1356 temporary[i2]=buffer[i];
1357 }
1358 lstrcpy(ProjectInfo.lpszOutput_Debug,temporary);
1359 }
1360 else if(lstrcmpi(temporary,"MANIFEST")==0&&buffer[i]=='='){
1361 for(i++,i2=0;;i++,i2++){
1362 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1363 temporary[i2]=0;
1364 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
1365 break;
1366 }
1367 temporary[i2]=buffer[i];
1368 }
1369 lstrcpy(ProjectInfo.szManifestPath,temporary);
1370 }
1371 else if(lstrcmpi(temporary,"DEBUG_CMD_LINE")==0&&buffer[i]=='='){
1372 for(i++,i2=0;;i++,i2++){
1373 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1374 temporary[i2]=0;
1375 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
1376 break;
1377 }
1378 temporary[i2]=buffer[i];
1379 }
1380 lstrcpy(ProjectInfo.szCmdLine,temporary);
1381 }
1382 else if(lstrcmpi(temporary,"DEBUG_EXE_PATH")==0&&buffer[i]=='='){
1383 for(i++,i2=0;;i++,i2++){
1384 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1385 temporary[i2]=0;
1386 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
1387 break;
1388 }
1389 temporary[i2]=buffer[i];
1390 }
1391 lstrcpy(ProjectInfo.szExePath,temporary);
1392 }
1393 else if(lstrcmpi(temporary,"RESOURCE")==0&&buffer[i]=='='){
1394 for(i++,i2=0;;i++,i2++){
1395 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1396 temporary[i2]=0;
1397 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
1398 break;
1399 }
1400 temporary[i2]=buffer[i];
1401 }
1402 if(temporary[0]!='\0'&&(!(temporary[0]=='0'&&temporary[1]=='\0'))){
1403 lstrcpy(ProjectInfo.ResourceFileName,temporary);
1404 GetResourceData();
1405 }
1406 else{
1407 sprintf(ProjectInfo.ResourceFileName,"%s.rc",ProjectInfo.name);
1408 }
1409 }
1410 else if(lstrcmpi(temporary,"SOURCE")==0&&buffer[i]=='\r'&&buffer[i+1]=='\n'){
1411 while(1){
1412 for(i+=2,i2=0;;i++,i2++){
1413 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1414 temporary[i2]=0;
1415 break;
1416 }
1417 temporary[i2]=buffer[i];
1418 }
1419 if(temporary[0]=='\0') break;
1420 ProjectInfo.pobj_DBFileInfo->add(temporary,0);
1421
1422 if(buffer[i]=='\0') break;
1423 }
1424 }
1425 else{
1426 //不明なパラメータは無視
1427 for(i++;;i++){
1428 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1429 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i-=2;
1430 break;
1431 }
1432 }
1433 }
1434 if(buffer[i]=='\0') break;
1435 }
1436 }
1437 HeapDefaultFree(buffer);
1438
1439 //古いバージョンファイルを考慮
1440 if(ProjectInfo.dwVersion<=4){
1441 if(ProjectInfo.dwModuleType==MT_DLL)
1442 sprintf(ProjectInfo.lpszOutput_Release,".\\%s.dll",ProjectInfo.name);
1443 else sprintf(ProjectInfo.lpszOutput_Release,".\\%s.exe",ProjectInfo.name);
1444 sprintf(ProjectInfo.lpszOutput_Debug,".\\%s_debug.exe",ProjectInfo.name);
1445 }
1446
1447 //ブレークポイントを初期化
1448 ProjectInfo.pobj_DBBreakPoint=new CDBBreakPoint();
1449
1450
1451 if( isUseWindow )
1452 {
1453 /////////////////////////////////////////////
1454 //ウィンドウ定義ファイル(*.wnd)をオープン
1455 sprintf(temp2,"%s%s.wnd",ProjectInfo.dir,ProjectInfo.name);
1456 if(!OpenWindowFile(temp2)) return;
1457 }
1458 else{
1459 ProjectInfo.windowInfos.clear();
1460
1461 ProjectInfo.NumberOfMenu=0;
1462 ProjectInfo.pMenuInfo=(MENU_INFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
1463 }
1464
1465
1466 //プロジェクト ビューを設定、表示
1467 extern HWND hProjectView;
1468 SetTreeViewForProjectInfo();
1469 if(!IsWindowVisible(hProjectView)) SendMessage(hOwner,WM_COMMAND,IDM_PROJECTVIEW,0);
1470
1471
1472 //メニュー状態を設定
1473 ResetState_DocMenu();
1474
1475
1476 //////////////////////////////////////////
1477 //ワークファイル(*.wrk)をオープン
1478 extern MDIINFO MdiInfo[MAX_WNDNUM];
1479 HTREEITEM hTreeItem;
1480 HANDLE hFind;
1481 WIN32_FIND_DATA wfd;
1482 HWND hChild;
1483 int WndNum;
1484 sprintf(temp2,"%s%s.wrk",ProjectInfo.dir,ProjectInfo.name);
1485 hFind=FindFirstFile(temp2,&wfd);
1486 if(hFind!=INVALID_HANDLE_VALUE){
1487 FindClose(hFind);
1488 buffer=ReadBuffer(temp2);
1489 if(!buffer) return;
1490
1491 //解析、反映
1492 memcpy(temporary,buffer,5);
1493 temporary[5]=0;
1494 if(lstrcmp(temporary,"case4")==0){
1495
1496 LockWindowUpdate(hOwner);
1497 for(i=9,i2=0;;i++,i2++){
1498 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1499 if(i2!=0){
1500 temporary[i2]=0;
1501 for(i3=0;;i3++){
1502 if(temporary[i3]==','||temporary[i3]=='\0') break;
1503 }
1504 if(temporary[i3]=='\0') goto EndToSetWorkFile;
1505 lstrcpy(temp2,temporary+i3+1);
1506 temporary[i3]=0;
1507 if(lstrcmpi(temporary,"text")==0){
1508 if(temp2[0]!='\"') goto EndToSetWorkFile;
1509
1510 //ファイルを開く
1511 i2=1;
1512 for(i3=0;;i2++,i3++){
1513 if(temp2[i2]=='\"'||temp2[i2]=='\0'){
1514 temporary[i3]=0;
1515 break;
1516 }
1517 temporary[i3]=temp2[i2];
1518 }
1519 GetFullPath(temporary,ProjectInfo.dir);
1520 hChild=OpenFileWithExtension(temporary);
1521 WndNum=GetWndNum(hChild);
1522 if(WndNum==-1){
1523 goto EndToSetWorkFile;
1524 }
1525
1526 //ResetScrollbarが再描画時に呼び出されるので、再描画する
1527 InvalidateRect(MdiInfo[WndNum].pMdiTextEdit->hEdit,NULL,0);
1528 UpdateWindow(MdiInfo[WndNum].pMdiTextEdit->hEdit);
1529
1530 if(temp2[i2]=='\0') goto EndToSetWorkFile;
1531 if(temp2[i2+1]!=',') goto EndToSetWorkFile;
1532
1533 //以前のスクロール位置を復元
1534 SCROLLINFO si;
1535 POINT pos;
1536 for(i2+=2,i3=0;;i2++,i3++){
1537 if(temp2[i2]==','||temp2[i2]=='\0'){
1538 temporary[i3]=0;
1539 break;
1540 }
1541 temporary[i3]=temp2[i2];
1542 }
1543 sscanf(temporary,"%d",&pos.x);
1544 if(temp2[i2]=='\0') goto EndToSetWorkFile;
1545 for(i2++,i3=0;;i2++,i3++){
1546 if(temp2[i2]==','||temp2[i2]=='\0'){
1547 temporary[i3]=0;
1548 break;
1549 }
1550 temporary[i3]=temp2[i2];
1551 }
1552 sscanf(temporary,"%d",&pos.y);
1553 si.cbSize=sizeof(SCROLLINFO);
1554 si.fMask=SIF_POS;
1555 si.nPos=pos.x;
1556 SetScrollInfo(MdiInfo[WndNum].pMdiTextEdit->hEdit,SB_HORZ,&si,1);
1557 si.nPos=pos.y;
1558 SetScrollInfo(MdiInfo[WndNum].pMdiTextEdit->hEdit,SB_VERT,&si,1);
1559
1560 if(temp2[i2]=='\0') goto EndToSetWorkFile;
1561
1562 //キャレット位置をセット
1563 for(i2++,i3=0;;i2++,i3++){
1564 if(temp2[i2]==','||temp2[i2]=='\0'){
1565 temporary[i3]=0;
1566 break;
1567 }
1568 temporary[i3]=temp2[i2];
1569 }
1570 sscanf(temporary,"%d",&pos.x);
1571 if(temp2[i2]=='\0') goto EndToSetWorkFile;
1572 for(i2++,i3=0;;i2++,i3++){
1573 if(temp2[i2]==','||temp2[i2]=='\0'){
1574 temporary[i3]=0;
1575 break;
1576 }
1577 temporary[i3]=temp2[i2];
1578 }
1579 sscanf(temporary,"%d",&pos.y);
1580 TextEdit_SetSel(WndNum,pos.x,pos.y);
1581 }
1582 else if(lstrcmpi(temporary,"rad")==0){
1583 for(i3=0;i3<static_cast<int>(ProjectInfo.windowInfos.size());i3++){
1584 if(lstrcmpi(ProjectInfo.windowInfos[i3].name,temp2)==0){
1585 NewRadWindow( ProjectInfo.windowInfos[i3] );
1586 break;
1587 }
1588 }
1589 }
1590 else if(lstrcmpi(temporary,"menu")==0){
1591 for(i3=0;i3<ProjectInfo.NumberOfMenu;i3++){
1592 if(lstrcmpi(ProjectInfo.pMenuInfo[i3].IdName,temp2)==0){
1593 NewMenuWindow(&ProjectInfo.pMenuInfo[i3]);
1594 break;
1595 }
1596 }
1597 }
1598 else if(lstrcmpi(temporary,"icon")==0){
1599 for(i3=0;i3<ProjectInfo.res.NumberOfIconRes;i3++){
1600 if(lstrcmpi(ProjectInfo.res.pIconResInfo[i3].path,temp2)==0){
1601 GetFullPath(temp2,ProjectInfo.dir);
1602 NewIconEditWindow(temp2);
1603 break;
1604 }
1605 }
1606 }
1607 i++;
1608 i2=-1;
1609 continue;
1610 }
1611 else break;
1612 }
1613 temporary[i2]=buffer[i];
1614 }
1615
1616 for(i+=2,i2=0;;i++,i2++){
1617 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1618 temporary[i2]=0;
1619 break;
1620 }
1621 temporary[i2]=buffer[i];
1622 }
1623 sscanf(temporary,"%d",&i2);
1624
1625 switch( i2 ){
1626 case 0:
1627 ShowFileView();
1628 break;
1629 case 1:
1630 ShowClassView();
1631 break;
1632 case 2:
1633 ShowMaterialView();
1634 break;
1635 }
1636
1637 if(buffer[i]=='\0') goto EndToSetWorkFile;
1638
1639 for(i+=2,i2=0;;i++,i2++){
1640 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1641 temporary[i2]=0;
1642 break;
1643 }
1644 temporary[i2]=buffer[i];
1645 }
1646 if(temporary[0]=='1') TreeView_Expand(pobj_FileTree->hTree,TreeView_GetRoot(pobj_FileTree->hTree),TVE_EXPAND);
1647
1648 for(i+=2,i2=0;;i++,i2++){
1649 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1650 temporary[i2]=0;
1651 break;
1652 }
1653 temporary[i2]=buffer[i];
1654 }
1655 if(temporary[0]=='1') TreeView_Expand(hProcedureTreeView,TreeView_GetRoot(hProcedureTreeView),TVE_EXPAND);
1656
1657 for(i+=2,i2=0;;i++,i2++){
1658 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1659 temporary[i2]=0;
1660 break;
1661 }
1662 temporary[i2]=buffer[i];
1663 }
1664 hTreeItem=TreeView_GetRoot(hMaterialTreeView);
1665 i2=0;
1666 while(hTreeItem){
1667 i2=GetOneParameter(temporary,i2,temp2);
1668 if(GetValue(temp2)) TreeView_Expand(hMaterialTreeView,hTreeItem,TVE_EXPAND);
1669 hTreeItem=TreeView_GetNextSibling(hMaterialTreeView,hTreeItem);
1670 }
1671 }
1672 else if(lstrcmp(temporary,"case3")==0){
1673 ////////////////////////////////////////
1674 // 古いフォーマットのワークファイル
1675
1676 LockWindowUpdate(hOwner);
1677 for(i=9,i2=0;;i++,i2++){
1678 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1679 if(i2!=0){
1680 temporary[i2]=0;
1681 for(i3=0;;i3++){
1682 if(temporary[i3]==','||temporary[i3]=='\0') break;
1683 }
1684 if(temporary[i3]=='\0') goto EndToSetWorkFile;
1685 lstrcpy(temp2,temporary+i3+1);
1686 temporary[i3]=0;
1687 if(lstrcmpi(temporary,"text")==0){
1688 for(i3=0;;i3++){
1689 if(temp2[i3]==','||temp2[i3]=='\0') break;
1690 }
1691 if(temp2[i3]=='\0') goto EndToSetWorkFile;
1692 lstrcpy(temporary,temp2+i3+1);
1693 temp2[i3]=0;
1694 GetFullPath(temporary,ProjectInfo.dir);
1695 sscanf(temp2,"%d",&i3);
1696
1697 //ファイルを開く
1698 hChild=OpenFileWithExtension(temporary);
1699 WndNum=GetWndNum(hChild);
1700
1701 //キャレット位置をセット
1702 TextEdit_SetSel(WndNum,i3,i3);
1703 }
1704 else if(lstrcmpi(temporary,"rad")==0){
1705 for(i3=0;i3<static_cast<int>(ProjectInfo.windowInfos.size());i3++){
1706 if(lstrcmpi(ProjectInfo.windowInfos[i3].name,temp2)==0){
1707 NewRadWindow( ProjectInfo.windowInfos[i3] );
1708 break;
1709 }
1710 }
1711 }
1712 else if(lstrcmpi(temporary,"menu")==0){
1713 for(i3=0;i3<ProjectInfo.NumberOfMenu;i3++){
1714 if(lstrcmpi(ProjectInfo.pMenuInfo[i3].IdName,temp2)==0){
1715 NewMenuWindow(&ProjectInfo.pMenuInfo[i3]);
1716 break;
1717 }
1718 }
1719 }
1720 else if(lstrcmpi(temporary,"icon")==0){
1721 for(i3=0;i3<ProjectInfo.res.NumberOfIconRes;i3++){
1722 if(lstrcmpi(ProjectInfo.res.pIconResInfo[i3].path,temp2)==0){
1723 GetFullPath(temp2,ProjectInfo.dir);
1724 NewIconEditWindow(temp2);
1725 break;
1726 }
1727 }
1728 }
1729 i++;
1730 i2=-1;
1731 continue;
1732 }
1733 else break;
1734 }
1735 temporary[i2]=buffer[i];
1736 }
1737
1738 for(i+=2,i2=0;;i++,i2++){
1739 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1740 temporary[i2]=0;
1741 break;
1742 }
1743 temporary[i2]=buffer[i];
1744 }
1745 sscanf(temporary,"%d",&i2);
1746
1747 switch( i2 ){
1748 case 0:
1749 ShowFileView();
1750 break;
1751 case 1:
1752 ShowClassView();
1753 break;
1754 case 2:
1755 ShowMaterialView();
1756 break;
1757 }
1758
1759 if(buffer[i]=='\0') goto EndToSetWorkFile;
1760
1761 for(i+=2,i2=0;;i++,i2++){
1762 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1763 temporary[i2]=0;
1764 break;
1765 }
1766 temporary[i2]=buffer[i];
1767 }
1768 if(temporary[0]=='1') TreeView_Expand(pobj_FileTree->hTree,TreeView_GetRoot(pobj_FileTree->hTree),TVE_EXPAND);
1769
1770 for(i+=2,i2=0;;i++,i2++){
1771 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1772 temporary[i2]=0;
1773 break;
1774 }
1775 temporary[i2]=buffer[i];
1776 }
1777 if(temporary[0]=='1') TreeView_Expand(hProcedureTreeView,TreeView_GetRoot(hProcedureTreeView),TVE_EXPAND);
1778
1779 for(i+=2,i2=0;;i++,i2++){
1780 if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){
1781 temporary[i2]=0;
1782 break;
1783 }
1784 temporary[i2]=buffer[i];
1785 }
1786 hTreeItem=TreeView_GetRoot(hMaterialTreeView);
1787 i2=0;
1788 while(hTreeItem){
1789 i2=GetOneParameter(temporary,i2,temp2);
1790 if(GetValue(temp2)) TreeView_Expand(hMaterialTreeView,hTreeItem,TVE_EXPAND);
1791 hTreeItem=TreeView_GetNextSibling(hMaterialTreeView,hTreeItem);
1792 }
1793 }
1794EndToSetWorkFile:
1795 LockWindowUpdate(NULL);
1796 HeapDefaultFree(buffer);
1797 }
1798
1799
1800 //ウィンドウ タイトルを変更
1801 sprintf(temporary,"%s - %s",ProjectInfo.name,APPLICATION_NAME);
1802 SetWindowText(hOwner,temporary);
1803
1804
1805 ProjectInfo.modify=0;
1806 ProjectInfo.ModifyOfMaterial=0;
1807 ProjectInfo.ModifuOfResource=0;
1808}
1809BOOL ProjectModifyCheck(BOOL bRun){
1810 extern MDIINFO MdiInfo[MAX_WNDNUM];
1811 int i,WndNum,sw;
1812 HWND hChild;
1813 char temporary[MAX_PATH];
1814 if(ProjectInfo.modify||ProjectInfo.ModifyOfMaterial||ProjectInfo.ModifuOfResource){
1815 if(bRun==0||pobj_nv->bSaveCheckProject){
1816 //"\"%s\" プロジェクトは変更されています。保存しますか?"
1817 sprintf(temporary,STRING_MODIFYCHECK_PROJECT,ProjectInfo.name);
1818 i=MessageBox(hOwner,temporary,APPLICATION_NAME,MB_YESNOCANCEL|MB_ICONEXCLAMATION);
1819
1820 if(i==IDCANCEL) return 0;
1821 if(i==IDYES) SaveProject();
1822 }
1823 else SaveProject();
1824 return 1;
1825 }
1826 hChild=GetWindow(hClient,GW_CHILD);
1827 while(hChild){
1828 WndNum=GetWndNum(hChild);
1829 sw=0;
1830 if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){
1831 if( MdiInfo[WndNum].pMdiTextEdit->IsModified() ){
1832 for(i=0;i<ProjectInfo.pobj_DBFileInfo->iNum;i++){
1833 ProjectInfo.pobj_DBFileInfo->ppobj_FileInfo[i]->GetFullPath(temporary);
1834 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0) sw=1;
1835 }
1836 }
1837 }
1838 else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){
1839 if(MdiInfo[WndNum].MdiIconEditInfo->bModify){
1840 for(i=0;i<ProjectInfo.res.NumberOfIconRes;i++){
1841 lstrcpy(temporary,ProjectInfo.res.pIconResInfo[i].path);
1842 GetFullPath(temporary,ProjectInfo.dir);
1843 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0) sw=1;
1844 }
1845 }
1846 }
1847
1848 if(sw){
1849 if(bRun==0||pobj_nv->bSaveCheckProject){
1850 //"\"%s\" プロジェクトは変更されています。保存しますか?"
1851 sprintf(temporary,STRING_MODIFYCHECK_PROJECT,ProjectInfo.name);
1852 i=MessageBox(hOwner,temporary,APPLICATION_NAME,MB_YESNOCANCEL|MB_ICONEXCLAMATION);
1853
1854 if(i==IDCANCEL) return 0;
1855 if(i==IDYES) SaveProject();
1856 }
1857 else SaveProject();
1858 return 1;
1859 }
1860 hChild=GetNextWindow(hChild,GW_HWNDNEXT);
1861 }
1862 return 2;
1863}
1864_int8 CloseProject(void){
1865 extern HANDLE hHeap;
1866 extern MDIINFO MdiInfo[MAX_WNDNUM];
1867 int i,i2,WndNum;
1868 HWND hChild,hCloseChild;
1869 char temporary[MAX_PATH];
1870
1871
1872 //保存確認
1873 i=ProjectModifyCheck(0);
1874 if(i==0) return 0;
1875 else if(i==2) MakeWorkFile();
1876
1877 //プロジェクトに関するMDIウィンドウをすべて閉じる
1878 hChild=GetWindow(hClient,GW_CHILD);
1879 while(hChild){
1880 hCloseChild=hChild;
1881 hChild=GetNextWindow(hChild,GW_HWNDNEXT);
1882 WndNum=GetWndNum(hCloseChild);
1883 if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){
1884 for(i=0;i<ProjectInfo.pobj_DBFileInfo->iNum;i++){
1885 ProjectInfo.pobj_DBFileInfo->ppobj_FileInfo[i]->GetFullPath(temporary);
1886 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0){
1887
1888 //変更フラグをオフにする
1889 MdiInfo[WndNum].pMdiTextEdit->UnModify();
1890
1891 SendMessage(hCloseChild,WM_CLOSE,0,0);
1892 break;
1893 }
1894 }
1895 }
1896 else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD){
1897 BOOST_FOREACH( const WINDOW_INFO &windowInfo, ProjectInfo.windowInfos )
1898 {
1899 if(lstrcmp(MdiInfo[WndNum].path, windowInfo.name)==0){
1900 SendMessage(hCloseChild,WM_CLOSE,0,0);
1901 break;
1902 }
1903 }
1904 }
1905 else if(MdiInfo[WndNum].DocType==WNDTYPE_MENU){
1906 for(i=0;i<ProjectInfo.NumberOfMenu;i++){
1907 if(lstrcmp(MdiInfo[WndNum].path,ProjectInfo.pMenuInfo[i].IdName)==0){
1908 SendMessage(hCloseChild,WM_CLOSE,0,0);
1909 break;
1910 }
1911 }
1912 }
1913 else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){
1914 for(i=0;ProjectInfo.res.NumberOfIconRes;i++){
1915 lstrcpy(temporary,ProjectInfo.res.pIconResInfo[i].path);
1916 GetFullPath(temporary,ProjectInfo.dir);
1917 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0){
1918 SendMessage(hCloseChild,WM_CLOSE,0,0);
1919 break;
1920 }
1921 }
1922 }
1923 }
1924
1925 //ファイル情報のメモリを解放
1926 delete ProjectInfo.pobj_DBFileInfo;
1927
1928 //ブレークポイントのオブジェクトを解放
1929 delete ProjectInfo.pobj_DBBreakPoint;
1930
1931 //ウィンドウ情報のメモリを解放
1932 BOOST_FOREACH( WINDOW_INFO &windowInfo, ProjectInfo.windowInfos )
1933 {
1934 HeapDefaultFree(windowInfo.name);
1935 HeapDefaultFree(windowInfo.HandleName);
1936 HeapDefaultFree(windowInfo.caption);
1937 HeapDefaultFree(windowInfo.ClassName);
1938 HeapDefaultFree(windowInfo.CallBackName);
1939 HeapDefaultFree(windowInfo.filepath);
1940 if(windowInfo.MenuID)
1941 HeapDefaultFree(windowInfo.MenuID);
1942 if(windowInfo.IconResName)
1943 HeapDefaultFree(windowInfo.IconResName);
1944
1945 //子ウィンドウのメモリを解放
1946 for(i2=0;i2<windowInfo.NumberOfChildWindows;i2++){
1947 HeapDefaultFree(windowInfo.pChildInfo[i2].IdName);
1948 HeapDefaultFree(windowInfo.pChildInfo[i2].caption);
1949 if(windowInfo.pChildInfo[i2].Control==CT_IMAGEBOX){
1950 //イメージ ボックスの場合
1951 HeapDefaultFree(windowInfo.pChildInfo[i2].ImageCtrlInfo.path);
1952 }
1953 }
1954 HeapDefaultFree(windowInfo.pChildInfo);
1955 }
1956 ProjectInfo.windowInfos.clear();
1957
1958 //メニュー情報のメモリを解放
1959 HeapMenuDataFree(ProjectInfo.pMenuInfo,ProjectInfo.NumberOfMenu,0);
1960 HeapDefaultFree(ProjectInfo.pMenuInfo);
1961
1962 //リソースのメモリを解放
1963 for(i=0;i<ProjectInfo.res.NumberOfCursorRes;i++){
1964 HeapDefaultFree(ProjectInfo.res.pCursorResInfo[i].IdName);
1965 HeapDefaultFree(ProjectInfo.res.pCursorResInfo[i].path);
1966 }
1967 HeapDefaultFree(ProjectInfo.res.pCursorResInfo);
1968 for(i=0;i<ProjectInfo.res.NumberOfBitmapRes;i++){
1969 HeapDefaultFree(ProjectInfo.res.pBitmapResInfo[i].IdName);
1970 HeapDefaultFree(ProjectInfo.res.pBitmapResInfo[i].path);
1971 }
1972 HeapDefaultFree(ProjectInfo.res.pBitmapResInfo);
1973 for(i=0;i<ProjectInfo.res.NumberOfIconRes;i++){
1974 HeapDefaultFree(ProjectInfo.res.pIconResInfo[i].IdName);
1975 HeapDefaultFree(ProjectInfo.res.pIconResInfo[i].path);
1976 }
1977 HeapDefaultFree(ProjectInfo.res.pIconResInfo);
1978
1979 //プロジェクト ビューを非表示にする
1980 extern HWND hProjectView;
1981 if(IsWindowVisible(hProjectView)) SendMessage(hOwner,WM_COMMAND,IDM_PROJECTVIEW,0);
1982 SetWindowText(hProjectView,"Project View");
1983
1984 TreeView_DeleteAllItems(pobj_FileTree->hTree);
1985 TreeView_DeleteAllItems(hProcedureTreeView);
1986 TreeView_DeleteAllItems(hMaterialTreeView);
1987
1988 //ウィンドウ タイトルを変更
1989 SetWindowText(hOwner,APPLICATION_NAME);
1990
1991 ProjectInfo.name[0]=0;
1992
1993 //メニュー状態を設定
1994 ResetState_DocMenu();
1995
1996 return 1;
1997}
1998void MakeWorkFile(void){
1999 extern MDIINFO MdiInfo[MAX_WNDNUM];
2000 int i,i2,WndNum;
2001 char temporary[MAX_PATH],buffer[32767];
2002 HWND hChild;
2003 CHARRANGE CharRange;
2004
2005 //ワークファイル(*.wrk)を作成
2006 lstrcpy(buffer,"case4\r\n\r\n");
2007 i2=lstrlen(buffer);
2008
2009
2010 ///////////////////////
2011 //MDIウィンドウの並び
2012 hChild=GetWindow(GetWindow(hClient,GW_CHILD),GW_HWNDLAST);
2013 while(hChild){
2014 WndNum=GetWndNum(hChild);
2015 if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){
2016 for(i=0;i<ProjectInfo.pobj_DBFileInfo->iNum;i++){
2017 ProjectInfo.pobj_DBFileInfo->ppobj_FileInfo[i]->GetFullPath(temporary);
2018 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0){
2019 TextEdit_GetSel(WndNum,&CharRange);
2020
2021 SCROLLINFO si;
2022 POINT pos;
2023 si.cbSize=sizeof(SCROLLINFO);
2024 si.fMask=SIF_POS;
2025 GetScrollInfo(MdiInfo[WndNum].pMdiTextEdit->hEdit,SB_HORZ,&si);
2026 pos.x=si.nPos;
2027 GetScrollInfo(MdiInfo[WndNum].pMdiTextEdit->hEdit,SB_VERT,&si);
2028 pos.y=si.nPos;
2029
2030 sprintf(buffer+i2,"text,\"%s\",%d,%d,%d,%d\r\n",
2031 ProjectInfo.pobj_DBFileInfo->ppobj_FileInfo[i]->m_path,
2032 pos.x,
2033 pos.y,
2034 CharRange.cpMin,
2035 CharRange.cpMax);
2036 i2+=lstrlen(buffer+i2);
2037 break;
2038 }
2039 }
2040 }
2041 else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD){
2042 BOOST_FOREACH( WINDOW_INFO &windowInfo, ProjectInfo.windowInfos )
2043 {
2044 if(lstrcmpi(MdiInfo[WndNum].path,windowInfo.name)==0){
2045 sprintf(buffer+i2,"rad,%s\r\n",MdiInfo[WndNum].path);
2046 i2+=lstrlen(buffer+i2);
2047 break;
2048 }
2049 }
2050 }
2051 else if(MdiInfo[WndNum].DocType==WNDTYPE_MENU){
2052 for(i=0;i<ProjectInfo.NumberOfMenu;i++){
2053 if(lstrcmpi(MdiInfo[WndNum].path,ProjectInfo.pMenuInfo[i].IdName)==0){
2054 sprintf(buffer+i2,"menu,%s\r\n",MdiInfo[WndNum].path);
2055 i2+=lstrlen(buffer+i2);
2056 break;
2057 }
2058 }
2059 }
2060 else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){
2061 for(i=0;i<ProjectInfo.res.NumberOfIconRes;i++){
2062 lstrcpy(temporary,ProjectInfo.res.pIconResInfo[i].path);
2063 GetFullPath(temporary,ProjectInfo.dir);
2064 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0){
2065 sprintf(buffer+i2,"icon,%s\r\n",ProjectInfo.res.pIconResInfo[i].path);
2066 i2+=lstrlen(buffer+i2);
2067 break;
2068 }
2069 }
2070 }
2071 hChild=GetNextWindow(hChild,GW_HWNDPREV);
2072 }
2073 lstrcpy(buffer+i2,"\r\n");
2074 i2+=2;
2075
2076
2077 //////////////////////////
2078 //ツリービューの展開状況
2079 sprintf(buffer+i2,"%d\r\n",TabCtrl_GetCurSel(hProjectViewTab));
2080 i2+=lstrlen(buffer+i2);
2081 TVITEM tvItem;
2082 memset(&tvItem,0,sizeof(TVITEM));
2083 tvItem.mask=TVIF_HANDLE|TVIF_STATE;
2084 tvItem.hItem=TreeView_GetRoot(pobj_FileTree->hTree);
2085 TreeView_GetItem(pobj_FileTree->hTree,&tvItem);
2086 if(tvItem.state&TVIS_EXPANDED) i=1;
2087 else i=0;
2088 sprintf(buffer+i2,"%d\r\n",i);
2089 i2+=lstrlen(buffer+i2);
2090
2091 tvItem.hItem=TreeView_GetRoot(hProcedureTreeView);
2092 TreeView_GetItem(hProcedureTreeView,&tvItem);
2093 if(tvItem.state&TVIS_EXPANDED) i=1;
2094 else i=0;
2095 sprintf(buffer+i2,"%d\r\n",i);
2096 i2+=lstrlen(buffer+i2);
2097
2098 tvItem.hItem=TreeView_GetRoot(hMaterialTreeView);
2099 while(tvItem.hItem){
2100 TreeView_GetItem(hMaterialTreeView,&tvItem);
2101 if(tvItem.state&TVIS_EXPANDED) i=1;
2102 else i=0;
2103 sprintf(buffer+i2,"%d",i);
2104 i2+=lstrlen(buffer+i2);
2105
2106 tvItem.hItem=TreeView_GetNextSibling(hMaterialTreeView,tvItem.hItem);
2107 if(tvItem.hItem){
2108 lstrcpy(buffer+i2,",");
2109 i2+=lstrlen(buffer+i2);
2110 }
2111 }
2112
2113
2114 //保存
2115 sprintf(temporary,"%s%s.wrk",ProjectInfo.dir,ProjectInfo.name);
2116 WriteBuffer(temporary,buffer,i2);
2117}
2118void SaveProject(void){
2119 extern MDIINFO MdiInfo[MAX_WNDNUM];
2120 int i,i2,i3,WndNum;
2121 char temporary[MAX_PATH],buffer[32767];
2122 HWND hChild;
2123
2124 //"プロジェクトを保存中..."
2125 SetStatusText(STRING_PROJECT_SAVING);
2126
2127 //プロジェクトファイルのバージョンを設定
2128 ProjectInfo.dwVersion=PROJECT_VERSION;
2129
2130 hChild=GetWindow(hClient,GW_CHILD);
2131 while(hChild){
2132 WndNum=GetWndNum(hChild);
2133 if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){
2134 if( MdiInfo[WndNum].pMdiTextEdit->IsModified() ){
2135 for(i=0;i<ProjectInfo.pobj_DBFileInfo->iNum;i++){
2136 ProjectInfo.pobj_DBFileInfo->ppobj_FileInfo[i]->GetFullPath(temporary);
2137 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0){
2138 SaveDocument(hChild,NULL);
2139 break;
2140 }
2141 }
2142 }
2143 }
2144 if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){
2145 if(MdiInfo[WndNum].MdiIconEditInfo->bModify){
2146 for(i=0;i<ProjectInfo.res.NumberOfIconRes;i++){
2147 lstrcpy(temporary,ProjectInfo.res.pIconResInfo[i].path);
2148 GetFullPath(temporary,ProjectInfo.dir);
2149 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0){
2150 SaveDocument(hChild,NULL);
2151 break;
2152 }
2153 }
2154 }
2155 }
2156 hChild=GetNextWindow(hChild,GW_HWNDNEXT);
2157 }
2158
2159
2160 //////////////////////////////////////
2161 //プロジェクトファイル(*.pj)を作成
2162 lstrcpy(buffer,"\' ActiveBasic Project file.\r\n\r\n");
2163 i2=lstrlen(buffer);
2164 sprintf(buffer+i2,"#VERSION=%d\r\n\r\n",ProjectInfo.dwVersion);
2165 i2+=lstrlen(buffer+i2);
2166 sprintf(buffer+i2,"#MODULETYPE=%d\r\n\r\n",ProjectInfo.dwModuleType);
2167 i2+=lstrlen(buffer+i2);
2168 sprintf(buffer+i2,"#NAME=%s\r\n\r\n",ProjectInfo.name);
2169 i2+=lstrlen(buffer+i2);
2170 extern HWND hSelectCompilerCombo;
2171 if(SendMessage(hSelectCompilerCombo,CB_GETCURSEL,0,0)==0){
2172 sprintf(buffer+i2,"#PLATFORM=32\r\n\r\n",ProjectInfo.name);
2173 i2+=lstrlen(buffer+i2);
2174 }
2175 else{
2176 sprintf(buffer+i2,"#PLATFORM=64\r\n\r\n",ProjectInfo.name);
2177 i2+=lstrlen(buffer+i2);
2178 }
2179 sprintf(buffer+i2,"#USEWINDOW=%d\r\n\r\n",ProjectInfo.windowInfos.size());
2180 i2+=lstrlen(buffer+i2);
2181 sprintf(buffer+i2,"#OPTION=&H%08x\r\n\r\n",ProjectInfo.dwOption);
2182 i2+=lstrlen(buffer+i2);
2183 sprintf(buffer+i2,"#OUTPUT_RELEASE=%s\r\n\r\n",ProjectInfo.lpszOutput_Release);
2184 i2+=lstrlen(buffer+i2);
2185 sprintf(buffer+i2,"#OUTPUT_DEBUG=%s\r\n\r\n",ProjectInfo.lpszOutput_Debug);
2186 i2+=lstrlen(buffer+i2);
2187 sprintf(buffer+i2,"#MANIFEST=%s\r\n\r\n",ProjectInfo.szManifestPath);
2188 i2+=lstrlen(buffer+i2);
2189 sprintf(buffer+i2,"#DEBUG_CMD_LINE=%s\r\n\r\n",ProjectInfo.szCmdLine);
2190 i2+=lstrlen(buffer+i2);
2191 sprintf(buffer+i2,"#DEBUG_EXE_PATH=%s\r\n\r\n",ProjectInfo.szExePath);
2192 i2+=lstrlen(buffer+i2);
2193 if(ProjectInfo.ResourceFileName[0]){
2194 sprintf(buffer+i2,"#RESOURCE=%s\r\n\r\n",ProjectInfo.ResourceFileName);
2195 i2+=lstrlen(buffer+i2);
2196 }
2197 else{
2198 lstrcpy(buffer+i2,"#RESOURCE=0\r\n\r\n");
2199 i2+=lstrlen(buffer+i2);
2200 }
2201 sprintf(buffer+i2,"#SOURCE\r\n");
2202 i2+=lstrlen(buffer+i2);
2203 for(i=0;i<ProjectInfo.pobj_DBFileInfo->iNum;i++){
2204 sprintf(buffer+i2,"%s\r\n",ProjectInfo.pobj_DBFileInfo->ppobj_FileInfo[i]->m_path);
2205 i2+=lstrlen(buffer+i2);
2206 }
2207
2208 //保存
2209 sprintf(temporary,"%s%s.pj",ProjectInfo.dir,ProjectInfo.name);
2210 WriteBuffer(temporary,buffer,i2);
2211
2212
2213 //////////////////////////////////
2214 // リソースファイル(*.rc、resource.ab)を作成
2215 if(ProjectInfo.ResourceFileName[0]){
2216 i2=0;
2217 i3=101;
2218 for(i=0;i<ProjectInfo.res.NumberOfCursorRes;i++,i3++){
2219 sprintf(buffer+i2,"Const %s=%d\r\n",
2220 ProjectInfo.res.pCursorResInfo[i].IdName,
2221 i3);
2222 i2+=lstrlen(buffer+i2);
2223 }
2224 for(i=0;i<ProjectInfo.res.NumberOfBitmapRes;i++,i3++){
2225 sprintf(buffer+i2,"Const %s=%d\r\n",
2226 ProjectInfo.res.pBitmapResInfo[i].IdName,
2227 i3);
2228 i2+=lstrlen(buffer+i2);
2229 }
2230 for(i=0;i<ProjectInfo.res.NumberOfIconRes;i++,i3++){
2231 sprintf(buffer+i2,"Const %s=%d\r\n",
2232 ProjectInfo.res.pIconResInfo[i].IdName,
2233 i3);
2234 i2+=lstrlen(buffer+i2);
2235 }
2236
2237 //保存(resource.ab)
2238 lstrcpy(temporary,"resource.ab");
2239 GetFullPath(temporary,ProjectInfo.dir);
2240 WriteBuffer(temporary,buffer,i2);
2241
2242 i2=0;
2243 for(i=0;i<ProjectInfo.res.NumberOfCursorRes;i++){
2244 sprintf(buffer+i2,"%s CURSOR \"%s\"\r\n",
2245 ProjectInfo.res.pCursorResInfo[i].IdName,
2246 ProjectInfo.res.pCursorResInfo[i].path);
2247 i2+=lstrlen(buffer+i2);
2248 }
2249 for(i=0;i<ProjectInfo.res.NumberOfBitmapRes;i++){
2250 sprintf(buffer+i2,"%s BITMAP \"%s\"\r\n",
2251 ProjectInfo.res.pBitmapResInfo[i].IdName,
2252 ProjectInfo.res.pBitmapResInfo[i].path);
2253 i2+=lstrlen(buffer+i2);
2254 }
2255 for(i=0;i<ProjectInfo.res.NumberOfIconRes;i++){
2256 sprintf(buffer+i2,"%s ICON \"%s\"\r\n",
2257 ProjectInfo.res.pIconResInfo[i].IdName,
2258 ProjectInfo.res.pIconResInfo[i].path);
2259 i2+=lstrlen(buffer+i2);
2260 }
2261
2262 //マニフェスト
2263 if(ProjectInfo.dwOption&PJ_OP_RC_MANIFEST){
2264 sprintf(buffer+i2,"CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST \"%s\"\r\n",
2265 ProjectInfo.szManifestPath);
2266 i2+=lstrlen(buffer+i2);
2267 }
2268
2269 //保存
2270 lstrcpy(temporary,ProjectInfo.ResourceFileName);
2271 GetFullPath(temporary,ProjectInfo.dir);
2272 WriteBuffer(temporary,buffer,i2);
2273 }
2274
2275
2276 ///////////////////////////////////////
2277 //インデックスファイル(*.idx)を作成
2278 buffer[0]=0;
2279 lstrcpy(buffer,"' インデックス プログラム\r\n");
2280 i2=lstrlen(buffer);
2281 if(ProjectInfo.dwOption&PJ_OP_SOURCE_MASK){
2282 if(ProjectInfo.dwOption&PJ_OP_STRICT){
2283 /* #strictディレクティブは今は使われていない
2284 lstrcpy(buffer+i2,"\r\n");
2285 i2+=lstrlen(buffer+i2);
2286 lstrcpy(buffer+i2,"#strict");
2287 i2+=lstrlen(buffer+i2);
2288 lstrcpy(buffer+i2,"\r\n");
2289 i2+=lstrlen(buffer+i2);
2290 */
2291 }
2292 lstrcpy(buffer+i2,"\r\n");
2293 i2+=lstrlen(buffer+i2);
2294 lstrcpy(buffer+i2,"'Win32APIの定義ファイル\r\n");
2295 i2+=lstrlen(buffer+i2);
2296 if(ProjectInfo.dwOption&PJ_OP_MMSYSTEM){
2297 lstrcpy(buffer+i2,"#include <api_mmsys.sbp>\r\n");
2298 i2+=lstrlen(buffer+i2);
2299 }
2300 if(ProjectInfo.dwOption&PJ_OP_COMMCTRL){
2301 lstrcpy(buffer+i2,"#include <api_commctrl.sbp>\r\n");
2302 i2+=lstrlen(buffer+i2);
2303 }
2304 if(ProjectInfo.dwOption&PJ_OP_RICHEDIT){
2305 lstrcpy(buffer+i2,"#include <api_richedit.sbp>\r\n");
2306 i2+=lstrlen(buffer+i2);
2307 }
2308 if(ProjectInfo.dwOption&PJ_OP_WINSOCK){
2309 lstrcpy(buffer+i2,"#include <api_winsock2.sbp>\r\n");
2310 i2+=lstrlen(buffer+i2);
2311 }
2312 }
2313 if( !ProjectInfo.windowInfos.empty() )
2314 {
2315 lstrcpy(buffer+i2,"\r\n");
2316 i2+=lstrlen(buffer+i2);
2317 lstrcpy(buffer+i2,"'RADツールが生成するウィンドウ制御プログラム\r\n");
2318 i2+=lstrlen(buffer+i2);
2319 sprintf(buffer+i2,"#include \"Callback.wbp\"\r\n");
2320 i2+=lstrlen(buffer+i2);
2321 }
2322 if(ProjectInfo.pobj_DBFileInfo->iNum>1){
2323 lstrcpy(buffer+i2,"\r\n");
2324 i2+=lstrlen(buffer+i2);
2325 lstrcpy(buffer+i2,"'プロジェクト内のプログラム ファイル\r\n");
2326 i2+=lstrlen(buffer+i2);
2327 for(i=1;i<ProjectInfo.pobj_DBFileInfo->iNum;i++){
2328 //メインファイルは含まない
2329 sprintf(buffer+i2,"#include \"%s\"\r\n",ProjectInfo.pobj_DBFileInfo->ppobj_FileInfo[i]->m_path);
2330 i2+=lstrlen(buffer+i2);
2331 lstrcpy(buffer+i2,"_ClearNamespaceImported\r\n");
2332 i2+=lstrlen(buffer+i2);
2333 }
2334 }
2335 if( !ProjectInfo.windowInfos.empty() )
2336 {
2337 lstrcpy(buffer+i2,"\r\n");
2338 i2+=lstrlen(buffer+i2);
2339 lstrcpy(buffer+i2,"'RADツールが生成するウィンドウ生成プログラム\r\n");
2340 i2+=lstrlen(buffer+i2);
2341 sprintf(buffer+i2,"#include \"MakeWindow.wbp\"\r\n");
2342 i2+=lstrlen(buffer+i2);
2343 }
2344 if(ProjectInfo.ResourceFileName[0]){
2345 //リソースファイルが含まれる場合
2346 lstrcpy(buffer+i2,"\r\n");
2347 i2+=lstrlen(buffer+i2);
2348 lstrcpy(buffer+i2,"'リソースファイル\r\n");
2349 i2+=lstrlen(buffer+i2);
2350 lstrcpy(buffer+i2,"#include \"resource.ab\"\r\n");
2351 i2+=lstrlen(buffer+i2);
2352 sprintf(buffer+i2,"#resource \"%s.rc\"\r\n",ProjectInfo.name);
2353 i2+=lstrlen(buffer+i2);
2354 }
2355
2356 //保存
2357 sprintf(temporary,"%s%s.idx",ProjectInfo.dir,ProjectInfo.name);
2358 WriteBuffer(temporary,buffer,i2);
2359
2360
2361 if( !ProjectInfo.windowInfos.empty() )
2362 {
2363 /////////////////////////////////////////////////////
2364 //ウィンドウ関連ファイル(*.wnd)を作成、保存
2365 if(ProjectInfo.ModifyOfMaterial){
2366 sprintf(temporary,"%s%s.wnd",ProjectInfo.dir,ProjectInfo.name);
2367 SaveWindowFile( temporary, ProjectInfo.windowInfos );
2368 }
2369
2370 //.wbpファイルを生成
2371 SaveWindowProgram();
2372 }
2373
2374
2375 MakeWorkFile();
2376
2377 SetStatusText("");
2378
2379 ProjectInfo.modify=0;
2380 ProjectInfo.ModifuOfResource=0;
2381}
2382
2383BOOL SetProjectToRun(void){
2384 HANDLE hFind;
2385 WIN32_FIND_DATA wfd;
2386
2387 if(ProjectInfo.pobj_DBFileInfo->iNum==0){
2388 //"プログラム ファイルがプロジェクトに存在しません。"
2389 MessageBox(hOwner,STRING_ERROR_NOFILE,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
2390 return 0;
2391 }
2392
2393 extern ActiveBasic::Common::Platform::EnumType selectingPlatform;
2394 hFind=FindFirstFile( ActiveBasic::Common::Environment::GetCompilerExePath( selectingPlatform ).c_str(), &wfd );
2395 if(hFind==INVALID_HANDLE_VALUE){
2396 //"BasicCompiler.exe が見つかりません"
2397 MessageBox(hOwner,STRING_ERROR_NOBASICCOMPILER,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
2398 return 0;
2399 }
2400 FindClose(hFind);
2401
2402 //プロジェクト構造のバージョンが違う時は、再保存する
2403 if(ProjectInfo.dwVersion<PROJECT_VERSION)
2404 ProjectInfo.ModifyOfMaterial=1;
2405
2406 //保存確認
2407 if(!ProjectModifyCheck(1)) return 0;
2408
2409 return 1;
2410}
2411BOOL IsNeedCompileForProject(BOOL bDebug){
2412 int i2;
2413 char temporary[MAX_PATH];
2414 HANDLE hFind,hFile;
2415 WIN32_FIND_DATA wfd;
2416 FILETIME SourceTime,ExeTime;
2417
2418 if(bDebug) lstrcpy(temporary,ProjectInfo.lpszOutput_Debug);
2419 else lstrcpy(temporary,ProjectInfo.lpszOutput_Release);
2420 GetFullPath(temporary,ProjectInfo.dir);
2421
2422 hFind=FindFirstFile(temporary,&wfd);
2423 if(hFind==INVALID_HANDLE_VALUE) return 1;
2424 FindClose(hFind);
2425
2426 hFile=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
2427 GetFileTime(hFile,NULL,NULL,&ExeTime);
2428 CloseHandle(hFile);
2429
2430 for(i2=0;i2<ProjectInfo.pobj_DBFileInfo->iNum;i2++){
2431 ProjectInfo.pobj_DBFileInfo->ppobj_FileInfo[i2]->GetFullPath(temporary);
2432 hFile=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
2433 GetFileTime(hFile,NULL,NULL,&SourceTime);
2434 CloseHandle(hFile);
2435
2436 if(SourceTime.dwHighDateTime>ExeTime.dwHighDateTime||
2437 SourceTime.dwHighDateTime==ExeTime.dwHighDateTime&&
2438 SourceTime.dwLowDateTime>ExeTime.dwLowDateTime) return 1;
2439 }
2440 if( !ProjectInfo.windowInfos.empty() )
2441 {
2442 //CallBack.wbp
2443 lstrcpy(temporary,"CallBack.wbp");
2444 GetFullPath(temporary,ProjectInfo.dir);
2445 hFile=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
2446 GetFileTime(hFile,NULL,NULL,&SourceTime);
2447 CloseHandle(hFile);
2448 if(SourceTime.dwHighDateTime>ExeTime.dwHighDateTime||
2449 SourceTime.dwHighDateTime==ExeTime.dwHighDateTime&&
2450 SourceTime.dwLowDateTime>ExeTime.dwLowDateTime) return 1;
2451
2452 //MakeWindow.wbp
2453 lstrcpy(temporary,"MakeWindow.wbp");
2454 GetFullPath(temporary,ProjectInfo.dir);
2455 hFile=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
2456 GetFileTime(hFile,NULL,NULL,&SourceTime);
2457 CloseHandle(hFile);
2458 if(SourceTime.dwHighDateTime>ExeTime.dwHighDateTime||
2459 SourceTime.dwHighDateTime==ExeTime.dwHighDateTime&&
2460 SourceTime.dwLowDateTime>ExeTime.dwLowDateTime) return 1;
2461 }
2462 return 0;
2463}
Note: See TracBrowser for help on using the repository browser.