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