source: dev/trunk/abdev/ProjectEditor/Resource.cpp@ 412

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