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