source: dev/trunk/ab5.0/abdev/abdev/Resource.cpp@ 622

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

ResourceManagerクラスを追加。既存のリソース管理モジュールの置き換えを行った。

File size: 17.5 KB
Line 
1#include "stdafx.h"
2
3#include "common.h"
4
5#if defined(JPN)
6//日本語
7#include "pj_msg_jpn.h"
8#else
9//英語
10#include "pj_msg_eng.h"
11#endif
12
13void GetResourceData(void){
14 extern HANDLE hHeap;
15 int i2,i3;
16 char *buffer,temporary[MAX_PATH],temp2[MAX_PATH],temp3[MAX_PATH];
17 HANDLE hFile;
18
19 hFile=CreateFile( projectInfo.GetResourceFileFullPath().c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
20 if(hFile==INVALID_HANDLE_VALUE) return;
21 i2=GetFileSize(hFile,NULL);
22 buffer=(char *)HeapAlloc(hHeap,0,i2+i2+1);
23 ReadFile(hFile,buffer,i2,(DWORD *)&i3,NULL);
24 CloseHandle(hFile);
25 buffer[i3]=0;
26 ChangeReturnCode(buffer);
27
28 i2=0;
29 while(1){
30 //ID
31 while(buffer[i2]==' '||buffer[i2]=='\t') i2++;
32 for(i3=0;;i2++,i3++){
33 if(!IsVariableChar(buffer[i2])){
34 temp3[i3]=0;
35 break;
36 }
37 temp3[i3]=buffer[i2];
38 }
39 if(temp3[0]=='\0') break;
40
41 //Type
42 while(buffer[i2]==' '||buffer[i2]=='\t') i2++;
43 for(i3=0;;i2++,i3++){
44 if(!IsVariableChar(buffer[i2])){
45 temporary[i3]=0;
46 break;
47 }
48 temporary[i3]=buffer[i2];
49 }
50
51 //FileName
52 while(buffer[i2]==' '||buffer[i2]=='\t') i2++;
53 if(buffer[i2]!='\"'){
54 //エラー
55 return;
56 }
57 for(i2++,i3=0;;i2++,i3++){
58 if(buffer[i2]=='\"'){
59 temp2[i3]=0;
60 break;
61 }
62 temp2[i3]=buffer[i2];
63 }
64
65 if(lstrcmpi(temporary,"CURSOR")==0){
66 projectInfo.res.pCursorResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pCursorResInfo,(projectInfo.res.NumberOfCursorRes+1)*sizeof(RESITEMINFO));
67
68 projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].IdName=
69 (char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1);
70 lstrcpy(projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].IdName,temp3);
71
72 projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].path=
73 (char *)HeapAlloc(hHeap,0,lstrlen(temp2)+1);
74 lstrcpy(projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].path,temp2);
75
76 projectInfo.res.NumberOfCursorRes++;
77 }
78 else if(lstrcmpi(temporary,"BITMAP")==0){
79 projectInfo.res.pBitmapResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pBitmapResInfo,(projectInfo.res.NumberOfBitmapRes+1)*sizeof(RESITEMINFO));
80
81 projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].IdName=
82 (char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1);
83 lstrcpy(projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].IdName,temp3);
84
85 projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].path=
86 (char *)HeapAlloc(hHeap,0,lstrlen(temp2)+1);
87 lstrcpy(projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].path,temp2);
88
89 projectInfo.res.NumberOfBitmapRes++;
90 }
91 else if(lstrcmpi(temporary,"ICON")==0){
92 projectInfo.res.pIconResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pIconResInfo,(projectInfo.res.NumberOfIconRes+1)*sizeof(RESITEMINFO));
93
94 projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].IdName=
95 (char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1);
96 lstrcpy(projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].IdName,temp3);
97
98 projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].path=
99 (char *)HeapAlloc(hHeap,0,lstrlen(temp2)+1);
100 lstrcpy(projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].path,temp2);
101
102 projectInfo.res.NumberOfIconRes++;
103 }
104 else if(lstrcmpi(temporary,"RT_MANIFEST")==0){
105 //無視
106 }
107 else{
108 //エラー
109 return;
110 }
111
112 i2++;
113 while(buffer[i2]==' '||buffer[i2]=='\t') i2++;
114 if(buffer[i2]=='\0') break;
115 else if(buffer[i2]!='\n'){
116 //エラー
117 return;
118 }
119 i2++;
120 }
121
122 HeapDefaultFree(buffer);
123}
124
125void Project_CursorResInsert(void){
126 extern HANDLE hHeap;
127 extern LPSTR CursorFileFilter;
128 int i2,i3;
129 char temporary[MAX_PATH];
130
131 //"カーソル ファイルを指定してください"
132 if(!GetFilePathDialog(hOwner,temporary,CursorFileFilter,STRING_FILEOPENTITLE_CURSOR,TRUE)) return;
133
134 lstrcpy( temporary, projectInfo.GetWorkDir().GetRelationalPath( temporary ).c_str() );
135
136 projectInfo.res.pCursorResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pCursorResInfo,(projectInfo.res.NumberOfCursorRes+1)*sizeof(RESITEMINFO));
137
138 projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].path=
139 (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
140 lstrcpy(projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].path,temporary);
141
142 for(i3=1;;i3++){
143 sprintf(temporary,"IDC_CURSOR%d",i3);
144 for(i2=0;i2<projectInfo.res.NumberOfCursorRes;i2++){
145 if(lstrcmp(temporary,projectInfo.res.pCursorResInfo[i2].IdName)==0) break;
146 }
147 if(i2==projectInfo.res.NumberOfCursorRes) break;
148 }
149
150 projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].IdName=
151 (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
152 lstrcpy(projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].IdName,temporary);
153
154 //ツリービューに追加
155 extern HWND hMaterialTreeView;
156 TV_INSERTSTRUCT tv;
157 tv.hInsertAfter=TVI_SORT;
158 tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
159 tv.item.iImage=6;
160 tv.item.iSelectedImage=6;
161 tv.hParent=projectInfo.res.hCursorTreeItem;
162 tv.item.pszText=temporary;
163
164 projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].hTreeItem=
165 TreeView_InsertItem(hMaterialTreeView,&tv);
166
167 TreeView_SelectItem(hMaterialTreeView,projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].hTreeItem);
168
169 projectInfo.res.NumberOfCursorRes++;
170 projectInfo.ModifuOfResource=1;
171}
172void Project_Cursor_Delete(int CursorInfoNum){
173 int i;
174
175 //ツリービューから削除
176 extern HWND hMaterialTreeView;
177 TreeView_DeleteItem(hMaterialTreeView,projectInfo.res.pCursorResInfo[CursorInfoNum].hTreeItem);
178
179 //projectInfo.pCursorInfo構造体から削除
180 HeapDefaultFree(projectInfo.res.pCursorResInfo[CursorInfoNum].IdName);
181 HeapDefaultFree(projectInfo.res.pCursorResInfo[CursorInfoNum].path);
182 projectInfo.res.NumberOfCursorRes--;
183 for(i=CursorInfoNum;i<projectInfo.res.NumberOfCursorRes;i++)
184 projectInfo.res.pCursorResInfo[i]=projectInfo.res.pCursorResInfo[i+1];
185
186 projectInfo.ModifuOfResource=1;
187}
188void Project_Cursor_RenameID(int CursorInfoNum){
189 extern HANDLE hHeap;
190 extern char NewIdName[MAX_PATH];
191 extern HWND hMaterialTreeView;
192 int i2;
193 char temporary[MAX_PATH];
194 TVITEM tvItem;
195
196 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.res.pCursorResInfo[CursorInfoNum].IdName)) return;
197
198 //重複チェック
199 for(i2=0;i2<projectInfo.res.NumberOfCursorRes;i2++){
200 if(i2==CursorInfoNum) continue;
201 if(lstrcmp(NewIdName,projectInfo.res.pCursorResInfo[i2].IdName)==0){
202 //"ID \"%s\" は既にプロジェクト内に存在します。"
203 sprintf(temporary,STRING_DUPLICATIONERROR_ID_IN_PROJECT,NewIdName);
204 MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
205 return;
206 }
207 }
208
209 HeapDefaultFree(projectInfo.res.pCursorResInfo[CursorInfoNum].IdName);
210 projectInfo.res.pCursorResInfo[CursorInfoNum].IdName=(char *)HeapAlloc(hHeap,0,lstrlen(NewIdName)+1);
211 lstrcpy(projectInfo.res.pCursorResInfo[CursorInfoNum].IdName,NewIdName);
212
213 tvItem.hItem=projectInfo.res.pCursorResInfo[CursorInfoNum].hTreeItem;
214 tvItem.mask=TVIF_TEXT;
215 tvItem.pszText=projectInfo.res.pCursorResInfo[CursorInfoNum].IdName;
216 tvItem.cchTextMax=lstrlen(projectInfo.res.pCursorResInfo[CursorInfoNum].IdName)+1;
217 TreeView_SetItem(hMaterialTreeView,&tvItem);
218
219 projectInfo.ModifuOfResource=1;
220
221 TreeView_SortChildren(hMaterialTreeView,
222 TreeView_GetParent(hMaterialTreeView,projectInfo.res.pCursorResInfo[CursorInfoNum].hTreeItem),
223 0);
224}
225
226void Project_BitmapResInsert(void){
227 extern HANDLE hHeap;
228 extern LPSTR BitmapFileFilter;
229 int i2,i3;
230 char temporary[MAX_PATH];
231
232 //"ビットマップ ファイルを指定してください"
233 if(!GetFilePathDialog(hOwner,temporary,BitmapFileFilter,STRING_FILEOPENTITLE_BITMAP,TRUE)) return;
234
235 lstrcpy( temporary, projectInfo.GetWorkDir().GetRelationalPath( temporary ).c_str() );
236
237 projectInfo.res.pBitmapResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pBitmapResInfo,(projectInfo.res.NumberOfBitmapRes+1)*sizeof(RESITEMINFO));
238
239 projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].path=
240 (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
241 lstrcpy(projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].path,temporary);
242
243 for(i3=1;;i3++){
244 sprintf(temporary,"IDB_BITMAP%d",i3);
245 for(i2=0;i2<projectInfo.res.NumberOfBitmapRes;i2++){
246 if(lstrcmp(temporary,projectInfo.res.pBitmapResInfo[i2].IdName)==0) break;
247 }
248 if(i2==projectInfo.res.NumberOfBitmapRes) break;
249 }
250
251 projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].IdName=
252 (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
253 lstrcpy(projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].IdName,temporary);
254
255 //ツリービューに追加
256 extern HWND hMaterialTreeView;
257 TV_INSERTSTRUCT tv;
258 tv.hInsertAfter=TVI_SORT;
259 tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
260 tv.item.iImage=5;
261 tv.item.iSelectedImage=5;
262 tv.hParent=projectInfo.res.hBitmapTreeItem;
263 tv.item.pszText=temporary;
264
265 projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].hTreeItem=
266 TreeView_InsertItem(hMaterialTreeView,&tv);
267
268 TreeView_SelectItem(hMaterialTreeView,projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].hTreeItem);
269
270 projectInfo.res.NumberOfBitmapRes++;
271 projectInfo.ModifuOfResource=1;
272
273
274 ////////////////////////////////
275 // ウィンドウ プロパティを更新
276 extern MDIINFO MdiInfo[MAX_WNDNUM];
277 for(i2=0;i2<MAX_WNDNUM;i2++){
278 if(MdiInfo[i2].hwnd&&MdiInfo[i2].DocType==WNDTYPE_RAD){
279 if(MdiInfo[i2].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW)
280 ChangePropertyWindow(i2,GetWndInfoNum(MdiInfo[i2].path));
281 }
282 }
283}
284void Project_Bitmap_Delete(int BitmapInfoNum){
285 int i;
286
287 //ツリービューから削除
288 extern HWND hMaterialTreeView;
289 TreeView_DeleteItem(hMaterialTreeView,projectInfo.res.pBitmapResInfo[BitmapInfoNum].hTreeItem);
290
291 //projectInfo.pBitmapInfo構造体から削除
292 HeapDefaultFree(projectInfo.res.pBitmapResInfo[BitmapInfoNum].IdName);
293 HeapDefaultFree(projectInfo.res.pBitmapResInfo[BitmapInfoNum].path);
294 projectInfo.res.NumberOfBitmapRes--;
295 for(i=BitmapInfoNum;i<projectInfo.res.NumberOfBitmapRes;i++)
296 projectInfo.res.pBitmapResInfo[i]=projectInfo.res.pBitmapResInfo[i+1];
297
298 projectInfo.ModifuOfResource=1;
299}
300void Project_Bitmap_RenameID(int BitmapInfoNum){
301 extern HANDLE hHeap;
302 extern char NewIdName[MAX_PATH];
303 extern HWND hMaterialTreeView;
304 int i2;
305 char temporary[MAX_PATH];
306 TVITEM tvItem;
307
308 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.res.pBitmapResInfo[BitmapInfoNum].IdName)) return;
309
310 //重複チェック
311 for(i2=0;i2<projectInfo.res.NumberOfBitmapRes;i2++){
312 if(i2==BitmapInfoNum) continue;
313 if(lstrcmp(NewIdName,projectInfo.res.pBitmapResInfo[i2].IdName)==0){
314 //"ID \"%s\" は既にプロジェクト内に存在します。"
315 sprintf(temporary,STRING_DUPLICATIONERROR_ID_IN_PROJECT,NewIdName);
316 MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
317 return;
318 }
319 }
320
321 HeapDefaultFree(projectInfo.res.pBitmapResInfo[BitmapInfoNum].IdName);
322 projectInfo.res.pBitmapResInfo[BitmapInfoNum].IdName=(char *)HeapAlloc(hHeap,0,lstrlen(NewIdName)+1);
323 lstrcpy(projectInfo.res.pBitmapResInfo[BitmapInfoNum].IdName,NewIdName);
324
325 tvItem.hItem=projectInfo.res.pBitmapResInfo[BitmapInfoNum].hTreeItem;
326 tvItem.mask=TVIF_TEXT;
327 tvItem.pszText=projectInfo.res.pBitmapResInfo[BitmapInfoNum].IdName;
328 tvItem.cchTextMax=lstrlen(projectInfo.res.pBitmapResInfo[BitmapInfoNum].IdName)+1;
329 TreeView_SetItem(hMaterialTreeView,&tvItem);
330
331 projectInfo.ModifuOfResource=1;
332
333 TreeView_SortChildren(hMaterialTreeView,
334 TreeView_GetParent(hMaterialTreeView,projectInfo.res.pBitmapResInfo[BitmapInfoNum].hTreeItem),
335 0);
336}
337void Project_IconResInsert(void){
338 extern HANDLE hHeap;
339 extern LPSTR IconFileFilter;
340 int i2,i3;
341 char temporary[MAX_PATH];
342
343 //"アイコン ファイルを指定してください"
344 if(!GetFilePathDialog(hOwner,temporary,IconFileFilter,STRING_FILEOPENTITLE_ICON,TRUE)) return;
345
346 lstrcpy( temporary, projectInfo.GetWorkDir().GetRelationalPath( temporary ).c_str() );
347
348 projectInfo.res.pIconResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pIconResInfo,(projectInfo.res.NumberOfIconRes+1)*sizeof(RESITEMINFO));
349
350 projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].path=
351 (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
352 lstrcpy(projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].path,temporary);
353
354 for(i3=1;;i3++){
355 sprintf(temporary,"IDI_ICON%d",i3);
356 for(i2=0;i2<projectInfo.res.NumberOfIconRes;i2++){
357 if(lstrcmp(temporary,projectInfo.res.pIconResInfo[i2].IdName)==0) break;
358 }
359 if(i2==projectInfo.res.NumberOfIconRes) break;
360 }
361
362 projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].IdName=
363 (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
364 lstrcpy(projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].IdName,temporary);
365
366 //ツリービューに追加
367 extern HWND hMaterialTreeView;
368 TV_INSERTSTRUCT tv;
369 tv.hInsertAfter=TVI_SORT;
370 tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
371 tv.item.iImage=4;
372 tv.item.iSelectedImage=4;
373 tv.hParent=projectInfo.res.hIconTreeItem;
374 if(projectInfo.res.NumberOfIconRes==0) lstrcat(temporary," (Main)");
375 tv.item.pszText=temporary;
376
377 projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].hTreeItem=
378 TreeView_InsertItem(hMaterialTreeView,&tv);
379
380 TreeView_SelectItem(hMaterialTreeView,projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].hTreeItem);
381
382 projectInfo.res.NumberOfIconRes++;
383 projectInfo.ModifuOfResource=1;
384
385 ////////////////////////////////
386 // ウィンドウ プロパティを更新
387 extern MDIINFO MdiInfo[MAX_WNDNUM];
388 for(i2=0;i2<MAX_WNDNUM;i2++){
389 if(MdiInfo[i2].hwnd&&MdiInfo[i2].DocType==WNDTYPE_RAD){
390 if(MdiInfo[i2].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW)
391 ChangePropertyWindow(i2,GetWndInfoNum(MdiInfo[i2].path));
392 }
393 }
394}
395void Project_Icon_Delete(int IconInfoNum){
396 extern HANDLE hHeap;
397 int i2;
398 char temporary[MAX_PATH];
399 TVITEM tv;
400
401 //ツリービューから削除
402 extern HWND hMaterialTreeView;
403 TreeView_DeleteItem(hMaterialTreeView,projectInfo.res.pIconResInfo[IconInfoNum].hTreeItem);
404
405 //projectInfo.pIconInfo構造体から削除
406 HeapDefaultFree(projectInfo.res.pIconResInfo[IconInfoNum].IdName);
407 HeapDefaultFree(projectInfo.res.pIconResInfo[IconInfoNum].path);
408 projectInfo.res.NumberOfIconRes--;
409 for(i2=IconInfoNum;i2<projectInfo.res.NumberOfIconRes;i2++) projectInfo.res.pIconResInfo[i2]=projectInfo.res.pIconResInfo[i2+1];
410
411 if(IconInfoNum==0&&projectInfo.res.NumberOfIconRes){
412 tv.mask=TVIF_TEXT|TVIF_HANDLE;
413 tv.pszText=temporary;
414 tv.cchTextMax=MAX_PATH;
415 tv.hItem=projectInfo.res.pIconResInfo[0].hTreeItem;
416 TreeView_GetItem(hMaterialTreeView,&tv);
417 lstrcat(tv.pszText," (Main)");
418 TreeView_SetItem(hMaterialTreeView,&tv);
419 }
420
421 projectInfo.ModifuOfResource=1;
422
423 ////////////////////////////////
424 // ウィンドウ プロパティを更新
425 extern MDIINFO MdiInfo[MAX_WNDNUM];
426 for(i2=0;i2<MAX_WNDNUM;i2++){
427 if(MdiInfo[i2].hwnd&&MdiInfo[i2].DocType==WNDTYPE_RAD){
428 if(MdiInfo[i2].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW)
429 ChangePropertyWindow(i2,GetWndInfoNum(MdiInfo[i2].path));
430 }
431 }
432}
433void Project_Icon_RenameID(int IconInfoNum){
434 extern HANDLE hHeap;
435 extern char NewIdName[MAX_PATH];
436 extern HWND hMaterialTreeView;
437 int i2;
438 char temporary[MAX_PATH];
439 TVITEM tvItem;
440
441 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.res.pIconResInfo[IconInfoNum].IdName)) return;
442
443 //重複チェック
444 for(i2=0;i2<projectInfo.res.NumberOfIconRes;i2++){
445 if(i2==IconInfoNum) continue;
446 if(lstrcmp(NewIdName,projectInfo.res.pIconResInfo[i2].IdName)==0){
447 //"ID \"%s\" は既にプロジェクト内に存在します。"
448 sprintf(temporary,STRING_DUPLICATIONERROR_ID_IN_PROJECT,NewIdName);
449 MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
450 return;
451 }
452 }
453
454 HeapDefaultFree(projectInfo.res.pIconResInfo[IconInfoNum].IdName);
455 projectInfo.res.pIconResInfo[IconInfoNum].IdName=(char *)HeapAlloc(hHeap,0,lstrlen(NewIdName)+1);
456 lstrcpy(projectInfo.res.pIconResInfo[IconInfoNum].IdName,NewIdName);
457
458 tvItem.hItem=projectInfo.res.pIconResInfo[IconInfoNum].hTreeItem;
459 tvItem.mask=TVIF_TEXT;
460 if(IconInfoNum==0){
461 sprintf(temporary,"%s (Main)",projectInfo.res.pIconResInfo[IconInfoNum].IdName);
462 tvItem.pszText=temporary;
463 }
464 else tvItem.pszText=projectInfo.res.pIconResInfo[IconInfoNum].IdName;
465 tvItem.cchTextMax=lstrlen(projectInfo.res.pIconResInfo[IconInfoNum].IdName)+1;
466 TreeView_SetItem(hMaterialTreeView,&tvItem);
467
468 projectInfo.ModifuOfResource=1;
469
470 TreeView_SortChildren(hMaterialTreeView,
471 TreeView_GetParent(hMaterialTreeView,projectInfo.res.pIconResInfo[IconInfoNum].hTreeItem),
472 0);
473}
474
475BOOL CALLBACK DlgProject_ResourceID_Input(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
476 extern char NewIdName[MAX_PATH];
477 switch(message){
478 case WM_INITDIALOG:
479 //"IDの変更"
480 SetWindowText(hwnd,STRING_RENAME_ID);
481
482 SetDlgItemText(hwnd,IDC_IDNAME,(char *)lParam);
483 SetPosCenter(hwnd);
484 break;
485 case WM_COMMAND:
486 switch(LOWORD(wParam)){
487 case IDOK:
488 GetDlgItemText(hwnd,IDC_IDNAME,NewIdName,MAX_PATH);
489 if(!NewIdName[0]){
490 //"ID名を入力して下さい。"
491 MessageBox(hwnd,STRING_ERROR_MUST_IDNAME,APPLICATION_NAME,MB_OK);
492 return 1;
493 }
494 EndDialog(hwnd,1);
495 return 1;
496 case IDCANCEL:
497 EndDialog(hwnd,0);
498 return 1;
499 }
500 break;
501 }
502 return 0;
503}
Note: See TracBrowser for help on using the repository browser.