source: dev/ProjectEditor/ProjectControl.cpp@ 25

Last change on this file since 25 was 24, checked in by dai_9181, 18 years ago

保存されていないドキュメントのタブに(*)をつける機能に対応。
MDITEXTEDITINFOをCMdiTextEditに変更。今後、オブジェクト指向化を進める。

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