source: dev/trunk/abdev/ProjectEditor/ProjectControl.cpp@ 363

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