| 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 | 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 |
|
|---|
| 19 | lstrcpy(temporary,projectInfo.ResourceFileName);
|
|---|
| 20 | GetFullPath(temporary,projectInfo.dir);
|
|---|
| 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){
|
|---|
| 69 | projectInfo.res.pCursorResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pCursorResInfo,(projectInfo.res.NumberOfCursorRes+1)*sizeof(RESITEMINFO));
|
|---|
| 70 |
|
|---|
| 71 | projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].IdName=
|
|---|
| 72 | (char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1);
|
|---|
| 73 | lstrcpy(projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].IdName,temp3);
|
|---|
| 74 |
|
|---|
| 75 | projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].path=
|
|---|
| 76 | (char *)HeapAlloc(hHeap,0,lstrlen(temp2)+1);
|
|---|
| 77 | lstrcpy(projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].path,temp2);
|
|---|
| 78 |
|
|---|
| 79 | projectInfo.res.NumberOfCursorRes++;
|
|---|
| 80 | }
|
|---|
| 81 | else if(lstrcmpi(temporary,"BITMAP")==0){
|
|---|
| 82 | projectInfo.res.pBitmapResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pBitmapResInfo,(projectInfo.res.NumberOfBitmapRes+1)*sizeof(RESITEMINFO));
|
|---|
| 83 |
|
|---|
| 84 | projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].IdName=
|
|---|
| 85 | (char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1);
|
|---|
| 86 | lstrcpy(projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].IdName,temp3);
|
|---|
| 87 |
|
|---|
| 88 | projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].path=
|
|---|
| 89 | (char *)HeapAlloc(hHeap,0,lstrlen(temp2)+1);
|
|---|
| 90 | lstrcpy(projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].path,temp2);
|
|---|
| 91 |
|
|---|
| 92 | projectInfo.res.NumberOfBitmapRes++;
|
|---|
| 93 | }
|
|---|
| 94 | else if(lstrcmpi(temporary,"ICON")==0){
|
|---|
| 95 | projectInfo.res.pIconResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pIconResInfo,(projectInfo.res.NumberOfIconRes+1)*sizeof(RESITEMINFO));
|
|---|
| 96 |
|
|---|
| 97 | projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].IdName=
|
|---|
| 98 | (char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1);
|
|---|
| 99 | lstrcpy(projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].IdName,temp3);
|
|---|
| 100 |
|
|---|
| 101 | projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].path=
|
|---|
| 102 | (char *)HeapAlloc(hHeap,0,lstrlen(temp2)+1);
|
|---|
| 103 | lstrcpy(projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].path,temp2);
|
|---|
| 104 |
|
|---|
| 105 | projectInfo.res.NumberOfIconRes++;
|
|---|
| 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 | //リソースが空の場合
|
|---|
| 126 | if(projectInfo.res.NumberOfCursorRes==0&&
|
|---|
| 127 | projectInfo.res.NumberOfBitmapRes==0&&
|
|---|
| 128 | projectInfo.res.NumberOfIconRes==0)
|
|---|
| 129 | projectInfo.ResourceFileName[0]=0;
|
|---|
| 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 |
|
|---|
| 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 | }
|
|---|
| 184 | void Project_Cursor_Delete(int CursorInfoNum){
|
|---|
| 185 | int i;
|
|---|
| 186 |
|
|---|
| 187 | //ツリービューから削除
|
|---|
| 188 | extern HWND hMaterialTreeView;
|
|---|
| 189 | TreeView_DeleteItem(hMaterialTreeView,projectInfo.res.pCursorResInfo[CursorInfoNum].hTreeItem);
|
|---|
| 190 |
|
|---|
| 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];
|
|---|
| 197 |
|
|---|
| 198 | projectInfo.ModifuOfResource=1;
|
|---|
| 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 |
|
|---|
| 208 | if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.res.pCursorResInfo[CursorInfoNum].IdName)) return;
|
|---|
| 209 |
|
|---|
| 210 | //重複チェック
|
|---|
| 211 | for(i2=0;i2<projectInfo.res.NumberOfCursorRes;i2++){
|
|---|
| 212 | if(i2==CursorInfoNum) continue;
|
|---|
| 213 | if(lstrcmp(NewIdName,projectInfo.res.pCursorResInfo[i2].IdName)==0){
|
|---|
| 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 |
|
|---|
| 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);
|
|---|
| 224 |
|
|---|
| 225 | tvItem.hItem=projectInfo.res.pCursorResInfo[CursorInfoNum].hTreeItem;
|
|---|
| 226 | tvItem.mask=TVIF_TEXT;
|
|---|
| 227 | tvItem.pszText=projectInfo.res.pCursorResInfo[CursorInfoNum].IdName;
|
|---|
| 228 | tvItem.cchTextMax=lstrlen(projectInfo.res.pCursorResInfo[CursorInfoNum].IdName)+1;
|
|---|
| 229 | TreeView_SetItem(hMaterialTreeView,&tvItem);
|
|---|
| 230 |
|
|---|
| 231 | projectInfo.ModifuOfResource=1;
|
|---|
| 232 |
|
|---|
| 233 | TreeView_SortChildren(hMaterialTreeView,
|
|---|
| 234 | TreeView_GetParent(hMaterialTreeView,projectInfo.res.pCursorResInfo[CursorInfoNum].hTreeItem),
|
|---|
| 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 |
|
|---|
| 244 | if(!projectInfo.ResourceFileName[0])
|
|---|
| 245 | sprintf(projectInfo.ResourceFileName,"%s.rc",projectInfo.name);
|
|---|
| 246 |
|
|---|
| 247 | //"ビットマップ ファイルを指定してください"
|
|---|
| 248 | if(!GetFilePathDialog(hOwner,temporary,BitmapFileFilter,STRING_FILEOPENTITLE_BITMAP,TRUE)) return;
|
|---|
| 249 |
|
|---|
| 250 | GetRelationalPath(temporary,projectInfo.dir);
|
|---|
| 251 |
|
|---|
| 252 | projectInfo.res.pBitmapResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pBitmapResInfo,(projectInfo.res.NumberOfBitmapRes+1)*sizeof(RESITEMINFO));
|
|---|
| 253 |
|
|---|
| 254 | projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].path=
|
|---|
| 255 | (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
|
|---|
| 256 | lstrcpy(projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].path,temporary);
|
|---|
| 257 |
|
|---|
| 258 | for(i3=1;;i3++){
|
|---|
| 259 | sprintf(temporary,"IDB_BITMAP%d",i3);
|
|---|
| 260 | for(i2=0;i2<projectInfo.res.NumberOfBitmapRes;i2++){
|
|---|
| 261 | if(lstrcmp(temporary,projectInfo.res.pBitmapResInfo[i2].IdName)==0) break;
|
|---|
| 262 | }
|
|---|
| 263 | if(i2==projectInfo.res.NumberOfBitmapRes) break;
|
|---|
| 264 | }
|
|---|
| 265 |
|
|---|
| 266 | projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].IdName=
|
|---|
| 267 | (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
|
|---|
| 268 | lstrcpy(projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].IdName,temporary);
|
|---|
| 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;
|
|---|
| 277 | tv.hParent=projectInfo.res.hBitmapTreeItem;
|
|---|
| 278 | tv.item.pszText=temporary;
|
|---|
| 279 |
|
|---|
| 280 | projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].hTreeItem=
|
|---|
| 281 | TreeView_InsertItem(hMaterialTreeView,&tv);
|
|---|
| 282 |
|
|---|
| 283 | TreeView_SelectItem(hMaterialTreeView,projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].hTreeItem);
|
|---|
| 284 |
|
|---|
| 285 | projectInfo.res.NumberOfBitmapRes++;
|
|---|
| 286 | projectInfo.ModifuOfResource=1;
|
|---|
| 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;
|
|---|
| 304 | TreeView_DeleteItem(hMaterialTreeView,projectInfo.res.pBitmapResInfo[BitmapInfoNum].hTreeItem);
|
|---|
| 305 |
|
|---|
| 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];
|
|---|
| 312 |
|
|---|
| 313 | projectInfo.ModifuOfResource=1;
|
|---|
| 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 |
|
|---|
| 323 | if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.res.pBitmapResInfo[BitmapInfoNum].IdName)) return;
|
|---|
| 324 |
|
|---|
| 325 | //重複チェック
|
|---|
| 326 | for(i2=0;i2<projectInfo.res.NumberOfBitmapRes;i2++){
|
|---|
| 327 | if(i2==BitmapInfoNum) continue;
|
|---|
| 328 | if(lstrcmp(NewIdName,projectInfo.res.pBitmapResInfo[i2].IdName)==0){
|
|---|
| 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 | 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);
|
|---|
| 339 |
|
|---|
| 340 | tvItem.hItem=projectInfo.res.pBitmapResInfo[BitmapInfoNum].hTreeItem;
|
|---|
| 341 | tvItem.mask=TVIF_TEXT;
|
|---|
| 342 | tvItem.pszText=projectInfo.res.pBitmapResInfo[BitmapInfoNum].IdName;
|
|---|
| 343 | tvItem.cchTextMax=lstrlen(projectInfo.res.pBitmapResInfo[BitmapInfoNum].IdName)+1;
|
|---|
| 344 | TreeView_SetItem(hMaterialTreeView,&tvItem);
|
|---|
| 345 |
|
|---|
| 346 | projectInfo.ModifuOfResource=1;
|
|---|
| 347 |
|
|---|
| 348 | TreeView_SortChildren(hMaterialTreeView,
|
|---|
| 349 | TreeView_GetParent(hMaterialTreeView,projectInfo.res.pBitmapResInfo[BitmapInfoNum].hTreeItem),
|
|---|
| 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 |
|
|---|
| 358 | if(!projectInfo.ResourceFileName[0])
|
|---|
| 359 | sprintf(projectInfo.ResourceFileName,"%s.rc",projectInfo.name);
|
|---|
| 360 |
|
|---|
| 361 | //"アイコン ファイルを指定してください"
|
|---|
| 362 | if(!GetFilePathDialog(hOwner,temporary,IconFileFilter,STRING_FILEOPENTITLE_ICON,TRUE)) return;
|
|---|
| 363 |
|
|---|
| 364 | GetRelationalPath(temporary,projectInfo.dir);
|
|---|
| 365 |
|
|---|
| 366 | projectInfo.res.pIconResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pIconResInfo,(projectInfo.res.NumberOfIconRes+1)*sizeof(RESITEMINFO));
|
|---|
| 367 |
|
|---|
| 368 | projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].path=
|
|---|
| 369 | (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
|
|---|
| 370 | lstrcpy(projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].path,temporary);
|
|---|
| 371 |
|
|---|
| 372 | for(i3=1;;i3++){
|
|---|
| 373 | sprintf(temporary,"IDI_ICON%d",i3);
|
|---|
| 374 | for(i2=0;i2<projectInfo.res.NumberOfIconRes;i2++){
|
|---|
| 375 | if(lstrcmp(temporary,projectInfo.res.pIconResInfo[i2].IdName)==0) break;
|
|---|
| 376 | }
|
|---|
| 377 | if(i2==projectInfo.res.NumberOfIconRes) break;
|
|---|
| 378 | }
|
|---|
| 379 |
|
|---|
| 380 | projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].IdName=
|
|---|
| 381 | (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
|
|---|
| 382 | lstrcpy(projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].IdName,temporary);
|
|---|
| 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;
|
|---|
| 391 | tv.hParent=projectInfo.res.hIconTreeItem;
|
|---|
| 392 | if(projectInfo.res.NumberOfIconRes==0) lstrcat(temporary," (Main)");
|
|---|
| 393 | tv.item.pszText=temporary;
|
|---|
| 394 |
|
|---|
| 395 | projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].hTreeItem=
|
|---|
| 396 | TreeView_InsertItem(hMaterialTreeView,&tv);
|
|---|
| 397 |
|
|---|
| 398 | TreeView_SelectItem(hMaterialTreeView,projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].hTreeItem);
|
|---|
| 399 |
|
|---|
| 400 | projectInfo.res.NumberOfIconRes++;
|
|---|
| 401 | projectInfo.ModifuOfResource=1;
|
|---|
| 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;
|
|---|
| 421 | TreeView_DeleteItem(hMaterialTreeView,projectInfo.res.pIconResInfo[IconInfoNum].hTreeItem);
|
|---|
| 422 |
|
|---|
| 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];
|
|---|
| 428 |
|
|---|
| 429 | if(IconInfoNum==0&&projectInfo.res.NumberOfIconRes){
|
|---|
| 430 | tv.mask=TVIF_TEXT|TVIF_HANDLE;
|
|---|
| 431 | tv.pszText=temporary;
|
|---|
| 432 | tv.cchTextMax=MAX_PATH;
|
|---|
| 433 | tv.hItem=projectInfo.res.pIconResInfo[0].hTreeItem;
|
|---|
| 434 | TreeView_GetItem(hMaterialTreeView,&tv);
|
|---|
| 435 | lstrcat(tv.pszText," (Main)");
|
|---|
| 436 | TreeView_SetItem(hMaterialTreeView,&tv);
|
|---|
| 437 | }
|
|---|
| 438 |
|
|---|
| 439 | projectInfo.ModifuOfResource=1;
|
|---|
| 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 |
|
|---|
| 459 | if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.res.pIconResInfo[IconInfoNum].IdName)) return;
|
|---|
| 460 |
|
|---|
| 461 | //重複チェック
|
|---|
| 462 | for(i2=0;i2<projectInfo.res.NumberOfIconRes;i2++){
|
|---|
| 463 | if(i2==IconInfoNum) continue;
|
|---|
| 464 | if(lstrcmp(NewIdName,projectInfo.res.pIconResInfo[i2].IdName)==0){
|
|---|
| 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 |
|
|---|
| 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);
|
|---|
| 475 |
|
|---|
| 476 | tvItem.hItem=projectInfo.res.pIconResInfo[IconInfoNum].hTreeItem;
|
|---|
| 477 | tvItem.mask=TVIF_TEXT;
|
|---|
| 478 | if(IconInfoNum==0){
|
|---|
| 479 | sprintf(temporary,"%s (Main)",projectInfo.res.pIconResInfo[IconInfoNum].IdName);
|
|---|
| 480 | tvItem.pszText=temporary;
|
|---|
| 481 | }
|
|---|
| 482 | else tvItem.pszText=projectInfo.res.pIconResInfo[IconInfoNum].IdName;
|
|---|
| 483 | tvItem.cchTextMax=lstrlen(projectInfo.res.pIconResInfo[IconInfoNum].IdName)+1;
|
|---|
| 484 | TreeView_SetItem(hMaterialTreeView,&tvItem);
|
|---|
| 485 |
|
|---|
| 486 | projectInfo.ModifuOfResource=1;
|
|---|
| 487 |
|
|---|
| 488 | TreeView_SortChildren(hMaterialTreeView,
|
|---|
| 489 | TreeView_GetParent(hMaterialTreeView,projectInfo.res.pIconResInfo[IconInfoNum].hTreeItem),
|
|---|
| 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 | }
|
|---|