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 |
|
---|
13 |
|
---|
14 | void Project_CursorResInsert(void){
|
---|
15 | extern HANDLE hHeap;
|
---|
16 | extern LPSTR CursorFileFilter;
|
---|
17 | int i3;
|
---|
18 | char temporary[MAX_PATH];
|
---|
19 |
|
---|
20 | //"カーソル ファイルを指定してください"
|
---|
21 | if(!GetFilePathDialog(hOwner,temporary,CursorFileFilter,STRING_FILEOPENTITLE_CURSOR,TRUE)) return;
|
---|
22 |
|
---|
23 | ActiveBasic::Common::ResourceItem item;
|
---|
24 | item.filepath = projectInfo.GetWorkDir().GetRelationalPath( temporary );
|
---|
25 |
|
---|
26 | for(i3=1;;i3++){
|
---|
27 | sprintf(temporary,"IDC_CURSOR%d",i3);
|
---|
28 | bool isDuplicate = false;
|
---|
29 | BOOST_FOREACH( const ActiveBasic::Common::ResourceItem &resourceItem, projectInfo.resourceManager.cursorResources )
|
---|
30 | {
|
---|
31 | if( resourceItem.idName == temporary )
|
---|
32 | {
|
---|
33 | isDuplicate = true;
|
---|
34 | break;
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 | if( !isDuplicate )
|
---|
39 | {
|
---|
40 | break;
|
---|
41 | }
|
---|
42 | }
|
---|
43 | item.idName = temporary;
|
---|
44 |
|
---|
45 | //ツリービューに追加
|
---|
46 | extern HWND hMaterialTreeView;
|
---|
47 | TV_INSERTSTRUCT tv;
|
---|
48 | tv.hInsertAfter=TVI_SORT;
|
---|
49 | tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
|
---|
50 | tv.item.iImage=6;
|
---|
51 | tv.item.iSelectedImage=6;
|
---|
52 | tv.hParent = hCursorTreeItemForProjectView;
|
---|
53 | tv.item.pszText=temporary;
|
---|
54 |
|
---|
55 | item.hTreeItem = TreeView_InsertItem(hMaterialTreeView,&tv);
|
---|
56 |
|
---|
57 | TreeView_SelectItem( hMaterialTreeView, item.hTreeItem );
|
---|
58 |
|
---|
59 | projectInfo.resourceManager.cursorResources.push_back( item );
|
---|
60 |
|
---|
61 | projectInfo.ModifuOfResource=1;
|
---|
62 | }
|
---|
63 | void Project_Cursor_Delete(int CursorInfoNum){
|
---|
64 | //ツリービューから削除
|
---|
65 | extern HWND hMaterialTreeView;
|
---|
66 | TreeView_DeleteItem(hMaterialTreeView,projectInfo.resourceManager.cursorResources[CursorInfoNum].hTreeItem);
|
---|
67 |
|
---|
68 | //projectInfo.pCursorInfo構造体から削除
|
---|
69 | Jenga::Common::EraseVectorItem<ActiveBasic::Common::ResourceItems>( projectInfo.resourceManager.cursorResources, CursorInfoNum );
|
---|
70 |
|
---|
71 | projectInfo.ModifuOfResource=1;
|
---|
72 | }
|
---|
73 | void Project_Cursor_RenameID(int CursorInfoNum){
|
---|
74 | extern HANDLE hHeap;
|
---|
75 | extern char NewIdName[MAX_PATH];
|
---|
76 | extern HWND hMaterialTreeView;
|
---|
77 | int i2;
|
---|
78 | char temporary[MAX_PATH];
|
---|
79 | TVITEM tvItem;
|
---|
80 |
|
---|
81 | if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.resourceManager.cursorResources[CursorInfoNum].idName.c_str())) return;
|
---|
82 |
|
---|
83 | //重複チェック
|
---|
84 | for(i2=0;i2<projectInfo.resourceManager.cursorResources.size();i2++){
|
---|
85 | if(i2==CursorInfoNum) continue;
|
---|
86 | if( projectInfo.resourceManager.cursorResources[i2].idName == NewIdName )
|
---|
87 | {
|
---|
88 | //"ID \"%s\" は既にプロジェクト内に存在します。"
|
---|
89 | sprintf(temporary,STRING_DUPLICATIONERROR_ID_IN_PROJECT,NewIdName);
|
---|
90 | MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
|
---|
91 | return;
|
---|
92 | }
|
---|
93 | }
|
---|
94 |
|
---|
95 | projectInfo.resourceManager.cursorResources[CursorInfoNum].idName = NewIdName;
|
---|
96 |
|
---|
97 | tvItem.hItem=projectInfo.resourceManager.cursorResources[CursorInfoNum].hTreeItem;
|
---|
98 | tvItem.mask=TVIF_TEXT;
|
---|
99 | lstrcpy( temporary, projectInfo.resourceManager.cursorResources[CursorInfoNum].idName.c_str() );
|
---|
100 | tvItem.pszText=temporary;
|
---|
101 | tvItem.cchTextMax=lstrlen(temporary)+1;
|
---|
102 | TreeView_SetItem(hMaterialTreeView,&tvItem);
|
---|
103 |
|
---|
104 | projectInfo.ModifuOfResource=1;
|
---|
105 |
|
---|
106 | TreeView_SortChildren(hMaterialTreeView,
|
---|
107 | TreeView_GetParent(hMaterialTreeView,projectInfo.resourceManager.cursorResources[CursorInfoNum].hTreeItem),
|
---|
108 | 0);
|
---|
109 | }
|
---|
110 |
|
---|
111 | void Project_BitmapResInsert(void){
|
---|
112 | extern HANDLE hHeap;
|
---|
113 | extern LPSTR BitmapFileFilter;
|
---|
114 | int i2,i3;
|
---|
115 | char temporary[MAX_PATH];
|
---|
116 |
|
---|
117 | //"ビットマップ ファイルを指定してください"
|
---|
118 | if(!GetFilePathDialog(hOwner,temporary,BitmapFileFilter,STRING_FILEOPENTITLE_BITMAP,TRUE)) return;
|
---|
119 |
|
---|
120 | ActiveBasic::Common::ResourceItem item;
|
---|
121 | item.filepath = projectInfo.GetWorkDir().GetRelationalPath( temporary );
|
---|
122 |
|
---|
123 | for(i3=1;;i3++){
|
---|
124 | sprintf(temporary,"IDB_BITMAP%d",i3);
|
---|
125 | bool isDuplicate = false;
|
---|
126 | BOOST_FOREACH( const ActiveBasic::Common::ResourceItem &resourceItem, projectInfo.resourceManager.bitmapResources )
|
---|
127 | {
|
---|
128 | if( resourceItem.idName == temporary )
|
---|
129 | {
|
---|
130 | isDuplicate = true;
|
---|
131 | break;
|
---|
132 | }
|
---|
133 | }
|
---|
134 |
|
---|
135 | if( !isDuplicate )
|
---|
136 | {
|
---|
137 | break;
|
---|
138 | }
|
---|
139 | }
|
---|
140 | item.idName = temporary;
|
---|
141 |
|
---|
142 | //ツリービューに追加
|
---|
143 | extern HWND hMaterialTreeView;
|
---|
144 | TV_INSERTSTRUCT tv;
|
---|
145 | tv.hInsertAfter=TVI_SORT;
|
---|
146 | tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
|
---|
147 | tv.item.iImage=5;
|
---|
148 | tv.item.iSelectedImage=5;
|
---|
149 | tv.hParent = hBitmapTreeItemForProjectView;
|
---|
150 | tv.item.pszText=temporary;
|
---|
151 |
|
---|
152 | item.hTreeItem = TreeView_InsertItem(hMaterialTreeView,&tv);
|
---|
153 |
|
---|
154 | TreeView_SelectItem(hMaterialTreeView,item.hTreeItem);
|
---|
155 |
|
---|
156 | projectInfo.resourceManager.bitmapResources.push_back( item );
|
---|
157 |
|
---|
158 | projectInfo.ModifuOfResource=1;
|
---|
159 |
|
---|
160 |
|
---|
161 | ////////////////////////////////
|
---|
162 | // ウィンドウ プロパティを更新
|
---|
163 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
164 | for(i2=0;i2<MAX_WNDNUM;i2++){
|
---|
165 | if(MdiInfo[i2].hwnd&&MdiInfo[i2].DocType==WNDTYPE_RAD){
|
---|
166 | if(MdiInfo[i2].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW)
|
---|
167 | ChangePropertyWindow(i2,GetWndInfoNum(MdiInfo[i2].path));
|
---|
168 | }
|
---|
169 | }
|
---|
170 | }
|
---|
171 | void Project_Bitmap_Delete(int BitmapInfoNum){
|
---|
172 | //ツリービューから削除
|
---|
173 | extern HWND hMaterialTreeView;
|
---|
174 | TreeView_DeleteItem(hMaterialTreeView,projectInfo.resourceManager.bitmapResources[BitmapInfoNum].hTreeItem);
|
---|
175 |
|
---|
176 | //projectInfo.pBitmapInfo構造体から削除
|
---|
177 | Jenga::Common::EraseVectorItem<ActiveBasic::Common::ResourceItems>( projectInfo.resourceManager.bitmapResources, BitmapInfoNum );
|
---|
178 |
|
---|
179 | projectInfo.ModifuOfResource=1;
|
---|
180 | }
|
---|
181 | void Project_Bitmap_RenameID(int BitmapInfoNum){
|
---|
182 | extern HANDLE hHeap;
|
---|
183 | extern char NewIdName[MAX_PATH];
|
---|
184 | extern HWND hMaterialTreeView;
|
---|
185 | int i2;
|
---|
186 | char temporary[MAX_PATH];
|
---|
187 | TVITEM tvItem;
|
---|
188 |
|
---|
189 | if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.resourceManager.bitmapResources[BitmapInfoNum].idName.c_str())) return;
|
---|
190 |
|
---|
191 | //重複チェック
|
---|
192 | for(i2=0;i2<projectInfo.resourceManager.bitmapResources.size();i2++){
|
---|
193 | if(i2==BitmapInfoNum) continue;
|
---|
194 | if( projectInfo.resourceManager.bitmapResources[i2].idName == NewIdName )
|
---|
195 | {
|
---|
196 | //"ID \"%s\" は既にプロジェクト内に存在します。"
|
---|
197 | sprintf(temporary,STRING_DUPLICATIONERROR_ID_IN_PROJECT,NewIdName);
|
---|
198 | MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
|
---|
199 | return;
|
---|
200 | }
|
---|
201 | }
|
---|
202 |
|
---|
203 | projectInfo.resourceManager.bitmapResources[BitmapInfoNum].idName = NewIdName;
|
---|
204 |
|
---|
205 | tvItem.hItem=projectInfo.resourceManager.bitmapResources[BitmapInfoNum].hTreeItem;
|
---|
206 | tvItem.mask=TVIF_TEXT;
|
---|
207 | lstrcpy( temporary, projectInfo.resourceManager.bitmapResources[BitmapInfoNum].idName.c_str() );
|
---|
208 | tvItem.pszText = temporary;
|
---|
209 | tvItem.cchTextMax=lstrlen(temporary)+1;
|
---|
210 | TreeView_SetItem(hMaterialTreeView,&tvItem);
|
---|
211 |
|
---|
212 | projectInfo.ModifuOfResource=1;
|
---|
213 |
|
---|
214 | TreeView_SortChildren(hMaterialTreeView,
|
---|
215 | TreeView_GetParent(hMaterialTreeView,projectInfo.resourceManager.bitmapResources[BitmapInfoNum].hTreeItem),
|
---|
216 | 0);
|
---|
217 | }
|
---|
218 | void Project_IconResInsert(void){
|
---|
219 | extern HANDLE hHeap;
|
---|
220 | extern LPSTR IconFileFilter;
|
---|
221 | int i2,i3;
|
---|
222 | char temporary[MAX_PATH];
|
---|
223 |
|
---|
224 | //"アイコン ファイルを指定してください"
|
---|
225 | if(!GetFilePathDialog(hOwner,temporary,IconFileFilter,STRING_FILEOPENTITLE_ICON,TRUE)) return;
|
---|
226 |
|
---|
227 | ActiveBasic::Common::ResourceItem item;
|
---|
228 | item.filepath = projectInfo.GetWorkDir().GetRelationalPath( temporary );
|
---|
229 |
|
---|
230 | for(i3=1;;i3++){
|
---|
231 | sprintf(temporary,"IDI_ICON%d",i3);
|
---|
232 | bool isDuplicate = false;
|
---|
233 | BOOST_FOREACH( const ActiveBasic::Common::ResourceItem &resourceItem, projectInfo.resourceManager.iconResources )
|
---|
234 | {
|
---|
235 | if( resourceItem.idName == temporary )
|
---|
236 | {
|
---|
237 | isDuplicate = true;
|
---|
238 | break;
|
---|
239 | }
|
---|
240 | }
|
---|
241 |
|
---|
242 | if( !isDuplicate )
|
---|
243 | {
|
---|
244 | break;
|
---|
245 | }
|
---|
246 | }
|
---|
247 | item.idName = temporary;
|
---|
248 |
|
---|
249 | //ツリービューに追加
|
---|
250 | extern HWND hMaterialTreeView;
|
---|
251 | TV_INSERTSTRUCT tv;
|
---|
252 | tv.hInsertAfter=TVI_SORT;
|
---|
253 | tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
|
---|
254 | tv.item.iImage=4;
|
---|
255 | tv.item.iSelectedImage=4;
|
---|
256 | tv.hParent = hIconTreeItemForProjectView;
|
---|
257 | if(projectInfo.resourceManager.iconResources.size()==0) lstrcat(temporary," (Main)");
|
---|
258 | tv.item.pszText=temporary;
|
---|
259 |
|
---|
260 | item.hTreeItem=
|
---|
261 | TreeView_InsertItem(hMaterialTreeView,&tv);
|
---|
262 |
|
---|
263 | TreeView_SelectItem(hMaterialTreeView,item.hTreeItem);
|
---|
264 |
|
---|
265 | projectInfo.resourceManager.iconResources.push_back( item );
|
---|
266 |
|
---|
267 | projectInfo.ModifuOfResource=1;
|
---|
268 |
|
---|
269 | ////////////////////////////////
|
---|
270 | // ウィンドウ プロパティを更新
|
---|
271 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
272 | for(i2=0;i2<MAX_WNDNUM;i2++){
|
---|
273 | if(MdiInfo[i2].hwnd&&MdiInfo[i2].DocType==WNDTYPE_RAD){
|
---|
274 | if(MdiInfo[i2].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW)
|
---|
275 | ChangePropertyWindow(i2,GetWndInfoNum(MdiInfo[i2].path));
|
---|
276 | }
|
---|
277 | }
|
---|
278 | }
|
---|
279 | void Project_Icon_Delete(int IconInfoNum){
|
---|
280 | extern HANDLE hHeap;
|
---|
281 | int i2;
|
---|
282 | char temporary[MAX_PATH];
|
---|
283 | TVITEM tv;
|
---|
284 |
|
---|
285 | //ツリービューから削除
|
---|
286 | extern HWND hMaterialTreeView;
|
---|
287 | TreeView_DeleteItem(hMaterialTreeView,projectInfo.resourceManager.iconResources[IconInfoNum].hTreeItem);
|
---|
288 |
|
---|
289 | //projectInfo.pIconInfo構造体から削除
|
---|
290 | Jenga::Common::EraseVectorItem<ActiveBasic::Common::ResourceItems>( projectInfo.resourceManager.iconResources, IconInfoNum );
|
---|
291 |
|
---|
292 | if(IconInfoNum==0&&projectInfo.resourceManager.iconResources.size()){
|
---|
293 | tv.mask=TVIF_TEXT|TVIF_HANDLE;
|
---|
294 | tv.pszText=temporary;
|
---|
295 | tv.cchTextMax=MAX_PATH;
|
---|
296 | tv.hItem=projectInfo.resourceManager.iconResources[0].hTreeItem;
|
---|
297 | TreeView_GetItem(hMaterialTreeView,&tv);
|
---|
298 | lstrcat(tv.pszText," (Main)");
|
---|
299 | TreeView_SetItem(hMaterialTreeView,&tv);
|
---|
300 | }
|
---|
301 |
|
---|
302 | projectInfo.ModifuOfResource=1;
|
---|
303 |
|
---|
304 | ////////////////////////////////
|
---|
305 | // ウィンドウ プロパティを更新
|
---|
306 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
307 | for(i2=0;i2<MAX_WNDNUM;i2++){
|
---|
308 | if(MdiInfo[i2].hwnd&&MdiInfo[i2].DocType==WNDTYPE_RAD){
|
---|
309 | if(MdiInfo[i2].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW)
|
---|
310 | ChangePropertyWindow(i2,GetWndInfoNum(MdiInfo[i2].path));
|
---|
311 | }
|
---|
312 | }
|
---|
313 | }
|
---|
314 | void Project_Icon_RenameID(int IconInfoNum){
|
---|
315 | extern HANDLE hHeap;
|
---|
316 | extern char NewIdName[MAX_PATH];
|
---|
317 | extern HWND hMaterialTreeView;
|
---|
318 | int i2;
|
---|
319 | char temporary[MAX_PATH];
|
---|
320 | TVITEM tvItem;
|
---|
321 |
|
---|
322 | if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.resourceManager.iconResources[IconInfoNum].idName.c_str())) return;
|
---|
323 |
|
---|
324 | //重複チェック
|
---|
325 | for(i2=0;i2<projectInfo.resourceManager.iconResources.size();i2++){
|
---|
326 | if(i2==IconInfoNum) continue;
|
---|
327 | if( projectInfo.resourceManager.iconResources[i2].idName == NewIdName )
|
---|
328 | {
|
---|
329 | //"ID \"%s\" は既にプロジェクト内に存在します。"
|
---|
330 | sprintf(temporary,STRING_DUPLICATIONERROR_ID_IN_PROJECT,NewIdName);
|
---|
331 | MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
|
---|
332 | return;
|
---|
333 | }
|
---|
334 | }
|
---|
335 |
|
---|
336 | projectInfo.resourceManager.iconResources[IconInfoNum].idName = NewIdName;
|
---|
337 |
|
---|
338 | tvItem.hItem=projectInfo.resourceManager.iconResources[IconInfoNum].hTreeItem;
|
---|
339 | tvItem.mask=TVIF_TEXT;
|
---|
340 | if(IconInfoNum==0){
|
---|
341 | sprintf(temporary,"%s (Main)",projectInfo.resourceManager.iconResources[IconInfoNum].idName.c_str());
|
---|
342 | }
|
---|
343 | else
|
---|
344 | {
|
---|
345 | sprintf(temporary,"%s",projectInfo.resourceManager.iconResources[IconInfoNum].idName.c_str());
|
---|
346 | }
|
---|
347 | tvItem.pszText=temporary;
|
---|
348 | tvItem.cchTextMax=lstrlen(temporary)+1;
|
---|
349 | TreeView_SetItem(hMaterialTreeView,&tvItem);
|
---|
350 |
|
---|
351 | projectInfo.ModifuOfResource=1;
|
---|
352 |
|
---|
353 | TreeView_SortChildren(hMaterialTreeView,
|
---|
354 | TreeView_GetParent(hMaterialTreeView,projectInfo.resourceManager.iconResources[IconInfoNum].hTreeItem),
|
---|
355 | 0);
|
---|
356 | }
|
---|
357 |
|
---|
358 | BOOL CALLBACK DlgProject_ResourceID_Input(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
359 | extern char NewIdName[MAX_PATH];
|
---|
360 | switch(message){
|
---|
361 | case WM_INITDIALOG:
|
---|
362 | //"IDの変更"
|
---|
363 | SetWindowText(hwnd,STRING_RENAME_ID);
|
---|
364 |
|
---|
365 | SetDlgItemText(hwnd,IDC_IDNAME,(char *)lParam);
|
---|
366 | SetPosCenter(hwnd);
|
---|
367 | break;
|
---|
368 | case WM_COMMAND:
|
---|
369 | switch(LOWORD(wParam)){
|
---|
370 | case IDOK:
|
---|
371 | GetDlgItemText(hwnd,IDC_IDNAME,NewIdName,MAX_PATH);
|
---|
372 | if(!NewIdName[0]){
|
---|
373 | //"ID名を入力して下さい。"
|
---|
374 | MessageBox(hwnd,STRING_ERROR_MUST_IDNAME,APPLICATION_NAME,MB_OK);
|
---|
375 | return 1;
|
---|
376 | }
|
---|
377 | EndDialog(hwnd,1);
|
---|
378 | return 1;
|
---|
379 | case IDCANCEL:
|
---|
380 | EndDialog(hwnd,0);
|
---|
381 | return 1;
|
---|
382 | }
|
---|
383 | break;
|
---|
384 | }
|
---|
385 | return 0;
|
---|
386 | }
|
---|