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