Changeset 623 in dev for trunk/ab5.0/abdev
- Timestamp:
- May 21, 2008, 11:02:07 PM (17 years ago)
- Location:
- trunk/ab5.0/abdev
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/ab_common/src/Lexical/Source.cpp
r603 r623 537 537 void BasicSource::DirectiveIncludeOrRequire( const std::string &mainSourceFilePath, const std::string &includeDirPath ){ 538 538 extern HANDLE hHeap; 539 extern char BasicCurDir[MAX_PATH];540 539 int i,i2,i3,sw1,LineNum,FileLayer[255],layer,LastFileByte[255]; 541 540 char temporary[MAX_PATH],temp2[MAX_PATH+255],*LayerDir[255]; … … 555 554 556 555 //参照ディレクトリ 557 LayerDir[0]=(char *)malloc(lstrlen(BasicCurDir)+1); 558 lstrcpy(LayerDir[0],BasicCurDir); 556 std::string mainSourceFileDir = Jenga::Common::Path::ExtractDirPath( mainSourceFilePath ); 557 LayerDir[0]=(char *)malloc(mainSourceFileDir.size()+1); 558 lstrcpy(LayerDir[0],mainSourceFileDir.c_str()); 559 559 560 560 for(i=0;;i++){ -
trunk/ab5.0/abdev/ab_common/src/ResourceManager/ResourceManager.cpp
r622 r623 18 18 19 19 20 21 extern char BasicCurDir[MAX_PATH];22 20 int i2,i3; 23 21 char temp2[MAX_PATH]; … … 40 38 // 改行コードのCRLFをLFに変換 41 39 Jenga::Common::StringReplace( buffer, "\r\n", "\n" ); 40 41 std::string baseDir = Jenga::Common::Path::ExtractDirPath( resourceFilePath ); 42 42 43 43 i2=0; … … 71 71 temp2[i3]=buffer[i2]; 72 72 } 73 lstrcpy( temp2, Jenga::Common::Directory( BasicCurDir ).GetFullPath( temp2 ).c_str() );73 lstrcpy( temp2, Jenga::Common::Directory( baseDir ).GetFullPath( temp2 ).c_str() ); 74 74 75 75 ResourceItem item; -
trunk/ab5.0/abdev/abdev/Common.h
r622 r623 404 404 ////////////////// 405 405 //リソース情報 406 struct RESITEMINFO{ 407 char *IdName; 408 char *path; 409 410 HTREEITEM hTreeItem; 411 }; 412 struct RESOURCEINFO{ 413 int NumberOfCursorRes; 414 RESITEMINFO *pCursorResInfo; 415 HTREEITEM hCursorTreeItem; 416 417 int NumberOfBitmapRes; 418 RESITEMINFO *pBitmapResInfo; 419 HTREEITEM hBitmapTreeItem; 420 421 int NumberOfIconRes; 422 RESITEMINFO *pIconResInfo; 423 HTREEITEM hIconTreeItem; 424 }; 406 extern HTREEITEM hCursorTreeItemForProjectView; 407 extern HTREEITEM hBitmapTreeItemForProjectView; 408 extern HTREEITEM hIconTreeItemForProjectView; 425 409 426 410 … … 999 983 1000 984 //Resource.cpp 1001 void GetResourceData(void);1002 985 void Project_CursorResInsert(void); 1003 986 void Project_Cursor_Delete(int CursorInfoNum); -
trunk/ab5.0/abdev/abdev/DrawWindow.cpp
r620 r623 991 991 else if(pWindowInfo->bgColor>=0x1000){ 992 992 //ビットマップ 993 for(i2=0;i2<projectInfo.res.NumberOfBitmapRes;i2++){ 994 if(lstrcmp(projectInfo.res.pBitmapResInfo[pWindowInfo->bgColor-0x1000].IdName, 995 projectInfo.res.pBitmapResInfo[i2].IdName)==0) break; 996 } 997 if(i2!=projectInfo.res.NumberOfBitmapRes){ 998 lstrcpy(temporary,projectInfo.res.pBitmapResInfo[i2].path); 993 for(i2=0;i2<projectInfo.resourceManager.bitmapResources.size();i2++){ 994 if( projectInfo.resourceManager.bitmapResources[pWindowInfo->bgColor-0x1000].idName == projectInfo.resourceManager.bitmapResources[i2].idName ) 995 { 996 break; 997 } 998 } 999 if(i2!=projectInfo.resourceManager.bitmapResources.size()){ 1000 lstrcpy(temporary,projectInfo.resourceManager.bitmapResources[i2].filepath.c_str()); 999 1001 lstrcpy( temporary, projectInfo.GetWorkDir().GetFullPath( temporary ).c_str() ); 1000 1002 hImage=LoadImage(NULL,temporary,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE); … … 1358 1360 lstrcpy(temporary,pChildInfo->ImageCtrlInfo.path); 1359 1361 else{ 1360 for(i2=0;i2<projectInfo.res.NumberOfIconRes;i2++){ 1361 if(lstrcmp(pChildInfo->ImageCtrlInfo.path, 1362 projectInfo.res.pIconResInfo[i2].IdName)==0) break; 1362 for(i2=0;i2<projectInfo.resourceManager.iconResources.size();i2++) 1363 { 1364 if( projectInfo.resourceManager.iconResources[i2].idName == pChildInfo->ImageCtrlInfo.path ) 1365 { 1366 break; 1367 } 1363 1368 } 1364 if(i2==projectInfo.res .NumberOfIconRes) goto NonIconImage;1365 1366 lstrcpy(temporary,projectInfo.res .pIconResInfo[i2].path);1369 if(i2==projectInfo.resourceManager.iconResources.size()) goto NonIconImage; 1370 1371 lstrcpy(temporary,projectInfo.resourceManager.iconResources[i2].filepath.c_str()); 1367 1372 } 1368 1373 lstrcpy( temporary, projectInfo.GetWorkDir().GetFullPath( temporary ).c_str() ); … … 1402 1407 lstrcpy(temporary,pChildInfo->ImageCtrlInfo.path); 1403 1408 else{ 1404 for(i2=0;i2<projectInfo.res.NumberOfBitmapRes;i2++){ 1405 if(lstrcmp(pChildInfo->ImageCtrlInfo.path, 1406 projectInfo.res.pBitmapResInfo[i2].IdName)==0) break; 1409 for(i2=0;i2<projectInfo.resourceManager.bitmapResources.size();i2++){ 1410 if( projectInfo.resourceManager.bitmapResources[i2].idName == pChildInfo->ImageCtrlInfo.path ) 1411 { 1412 break; 1413 } 1407 1414 } 1408 if(i2==projectInfo.res .NumberOfBitmapRes) goto NonBitmapImage;1409 1410 lstrcpy(temporary,projectInfo.res .pBitmapResInfo[i2].path);1415 if(i2==projectInfo.resourceManager.bitmapResources.size()) goto NonBitmapImage; 1416 1417 lstrcpy(temporary,projectInfo.resourceManager.bitmapResources[i2].filepath.c_str()); 1411 1418 } 1412 1419 lstrcpy( temporary, projectInfo.GetWorkDir().GetFullPath( temporary ).c_str() ); -
trunk/ab5.0/abdev/abdev/ProjectControl.cpp
r621 r623 191 191 } 192 192 } 193 for(i=0;i<projectInfo.res .NumberOfIconRes;i++){194 if(projectInfo.res .pIconResInfo[i].hTreeItem==hTreeItem){195 lstrcpy(temporary,projectInfo.res.pIconResInfo[i].path);196 lstrcpy( temporary, projectInfo.GetWorkDir().GetFullPath( temporary ).c_str() );197 NewIconEditWindow(temporary);193 for(i=0;i<projectInfo.resourceManager.iconResources.size();i++){ 194 if(projectInfo.resourceManager.iconResources[i].hTreeItem==hTreeItem){ 195 NewIconEditWindow( 196 projectInfo.GetWorkDir().GetFullPath( projectInfo.resourceManager.iconResources[i].filepath ).c_str() 197 ); 198 198 break; 199 199 } … … 202 202 case IDM_MATERIALTREE_DELETE: 203 203 hTreeItem=TreeView_GetSelection(hMaterialTreeView); 204 for(i=0;i<projectInfo.res .NumberOfCursorRes;i++){205 if(projectInfo.res .pCursorResInfo[i].hTreeItem==hTreeItem){204 for(i=0;i<projectInfo.resourceManager.cursorResources.size();i++){ 205 if(projectInfo.resourceManager.cursorResources[i].hTreeItem==hTreeItem){ 206 206 207 207 //"%s カーソルをプロジェクトから削除します。よろしいですか?" 208 sprintf(str,STRING_PJ_CHECK_DELETECURSOR,projectInfo.res .pCursorResInfo[i].IdName);208 sprintf(str,STRING_PJ_CHECK_DELETECURSOR,projectInfo.resourceManager.cursorResources[i].idName.c_str()); 209 209 if(IDCANCEL==MessageBox(hOwner,str,APPLICATION_NAME,MB_OKCANCEL|MB_ICONEXCLAMATION)) break; 210 210 … … 213 213 } 214 214 } 215 for(i=0;i<projectInfo.res .NumberOfBitmapRes;i++){216 if(projectInfo.res .pBitmapResInfo[i].hTreeItem==hTreeItem){215 for(i=0;i<projectInfo.resourceManager.bitmapResources.size();i++){ 216 if(projectInfo.resourceManager.bitmapResources[i].hTreeItem==hTreeItem){ 217 217 218 218 //"%s ビットマップをプロジェクトから削除します。よろしいですか?" 219 sprintf(str,STRING_PJ_CHECK_DELETEBITMAP,projectInfo.res .pBitmapResInfo[i].IdName);219 sprintf(str,STRING_PJ_CHECK_DELETEBITMAP,projectInfo.resourceManager.bitmapResources[i].idName.c_str()); 220 220 if(IDCANCEL==MessageBox(hOwner,str,APPLICATION_NAME,MB_OKCANCEL|MB_ICONEXCLAMATION)) break; 221 221 … … 224 224 } 225 225 } 226 for(i=0;i<projectInfo.res .NumberOfIconRes;i++){227 if(projectInfo.res .pIconResInfo[i].hTreeItem==hTreeItem){226 for(i=0;i<projectInfo.resourceManager.iconResources.size();i++){ 227 if(projectInfo.resourceManager.iconResources[i].hTreeItem==hTreeItem){ 228 228 229 229 //"%s アイコンをプロジェクトから削除します。よろしいですか?" 230 sprintf(str,STRING_PJ_CHECK_DELETEICON,projectInfo.res .pIconResInfo[i].IdName);230 sprintf(str,STRING_PJ_CHECK_DELETEICON,projectInfo.resourceManager.iconResources[i].idName.c_str()); 231 231 if(IDCANCEL==MessageBox(hOwner,str,APPLICATION_NAME,MB_OKCANCEL|MB_ICONEXCLAMATION)) break; 232 232 … … 261 261 extern char NewIdName[MAX_PATH]; 262 262 hTreeItem=TreeView_GetSelection(hMaterialTreeView); 263 for(i=0;i<projectInfo.res .NumberOfCursorRes;i++){264 if(projectInfo.res .pCursorResInfo[i].hTreeItem==hTreeItem){263 for(i=0;i<projectInfo.resourceManager.cursorResources.size();i++){ 264 if(projectInfo.resourceManager.cursorResources[i].hTreeItem==hTreeItem){ 265 265 Project_Cursor_RenameID(i); 266 266 break; 267 267 } 268 268 } 269 for(i=0;i<projectInfo.res .NumberOfBitmapRes;i++){270 if(projectInfo.res .pBitmapResInfo[i].hTreeItem==hTreeItem){269 for(i=0;i<projectInfo.resourceManager.bitmapResources.size();i++){ 270 if(projectInfo.resourceManager.bitmapResources[i].hTreeItem==hTreeItem){ 271 271 Project_Bitmap_RenameID(i); 272 272 break; 273 273 } 274 274 } 275 for(i=0;i<projectInfo.res .NumberOfIconRes;i++){276 if(projectInfo.res .pIconResInfo[i].hTreeItem==hTreeItem){275 for(i=0;i<projectInfo.resourceManager.iconResources.size();i++){ 276 if(projectInfo.resourceManager.iconResources[i].hTreeItem==hTreeItem){ 277 277 Project_Icon_RenameID(i); 278 278 } … … 313 313 break; 314 314 case IDM_MATERIALTREE_ICON_SETMAIN: 315 RESITEMINFO TempIconResInfo;316 315 hTreeItem=TreeView_GetSelection(hMaterialTreeView); 317 for(i=0;i<projectInfo.res .NumberOfIconRes;i++){318 if(projectInfo.res .pIconResInfo[i].hTreeItem==hTreeItem){316 for(i=0;i<projectInfo.resourceManager.iconResources.size();i++){ 317 if(projectInfo.resourceManager.iconResources[i].hTreeItem==hTreeItem){ 319 318 if(i==0) break; 320 319 321 TempIconResInfo=projectInfo.res.pIconResInfo[i]; 322 for(;i>0;i--) 323 projectInfo.res.pIconResInfo[i]=projectInfo.res.pIconResInfo[i-1]; 324 projectInfo.res.pIconResInfo[0]=TempIconResInfo; 325 326 tvItem.hItem=projectInfo.res.pIconResInfo[1].hTreeItem; 320 ActiveBasic::Common::ResourceItem tempItem = projectInfo.resourceManager.iconResources[i]; 321 Jenga::Common::EraseVectorItem<ActiveBasic::Common::ResourceItems>( projectInfo.resourceManager.iconResources, i ); 322 projectInfo.resourceManager.iconResources.insert( projectInfo.resourceManager.iconResources.begin(), tempItem ); 323 324 tvItem.hItem=projectInfo.resourceManager.iconResources[1].hTreeItem; 327 325 tvItem.mask=TVIF_TEXT; 328 tvItem.pszText=projectInfo.res.pIconResInfo[1].IdName; 329 tvItem.cchTextMax=lstrlen(projectInfo.res.pIconResInfo[1].IdName)+1; 326 lstrcpy( temporary, projectInfo.resourceManager.iconResources[1].idName.c_str() ); 327 tvItem.pszText = temporary; 328 tvItem.cchTextMax=lstrlen(temporary)+1; 330 329 TreeView_SetItem(hMaterialTreeView,&tvItem); 331 330 332 tvItem.hItem=projectInfo.res .pIconResInfo[0].hTreeItem;331 tvItem.hItem=projectInfo.resourceManager.iconResources[0].hTreeItem; 333 332 tvItem.mask=TVIF_TEXT; 334 sprintf(temporary,"%s (Main)",projectInfo.res .pIconResInfo[0].IdName);333 sprintf(temporary,"%s (Main)",projectInfo.resourceManager.iconResources[0].idName.c_str()); 335 334 tvItem.pszText=temporary; 336 335 tvItem.cchTextMax=lstrlen(temporary)+1; … … 1142 1141 tv.item.pszText=temporary; 1143 1142 tv.hParent=TreeView_InsertItem(hMaterialTreeView,&tv); 1144 projectInfo.res.hCursorTreeItem=tv.hParent;1145 for(i=0;i<projectInfo.res .NumberOfCursorRes;i++){1143 hCursorTreeItemForProjectView = tv.hParent; 1144 for(i=0;i<projectInfo.resourceManager.cursorResources.size();i++){ 1146 1145 tv.item.iImage=6; 1147 1146 tv.item.iSelectedImage=6; 1148 tv.item.pszText=projectInfo.res.pCursorResInfo[i].IdName; 1149 projectInfo.res.pCursorResInfo[i].hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv); 1147 lstrcpy( temporary, projectInfo.resourceManager.cursorResources[i].idName.c_str() ); 1148 tv.item.pszText=temporary; 1149 projectInfo.resourceManager.cursorResources[i].hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv); 1150 1150 } 1151 1151 … … 1157 1157 tv.item.pszText=temporary; 1158 1158 tv.hParent=TreeView_InsertItem(hMaterialTreeView,&tv); 1159 projectInfo.res.hBitmapTreeItem=tv.hParent;1160 for(i=0;i<projectInfo.res .NumberOfBitmapRes;i++){1159 hBitmapTreeItemForProjectView = tv.hParent; 1160 for(i=0;i<projectInfo.resourceManager.bitmapResources.size();i++){ 1161 1161 tv.item.iImage=5; 1162 1162 tv.item.iSelectedImage=5; 1163 tv.item.pszText=projectInfo.res.pBitmapResInfo[i].IdName; 1164 projectInfo.res.pBitmapResInfo[i].hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv); 1163 lstrcpy( temporary, projectInfo.resourceManager.bitmapResources[i].idName.c_str() ); 1164 tv.item.pszText=temporary; 1165 projectInfo.resourceManager.bitmapResources[i].hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv); 1165 1166 } 1166 1167 … … 1172 1173 tv.item.pszText=temporary; 1173 1174 tv.hParent=TreeView_InsertItem(hMaterialTreeView,&tv); 1174 projectInfo.res.hIconTreeItem=tv.hParent;1175 for(i=0;i<projectInfo.res .NumberOfIconRes;i++){1175 hIconTreeItemForProjectView = tv.hParent; 1176 for(i=0;i<projectInfo.resourceManager.iconResources.size();i++){ 1176 1177 tv.item.iImage=4; 1177 1178 tv.item.iSelectedImage=4; 1178 1179 if(i==0){ 1179 sprintf(temporary,"%s (Main)",projectInfo.res.pIconResInfo[i].IdName); 1180 tv.item.pszText=temporary; 1180 sprintf(temporary,"%s (Main)",projectInfo.resourceManager.iconResources[i].idName.c_str()); 1181 1181 } 1182 else tv.item.pszText=projectInfo.res.pIconResInfo[i].IdName; 1183 projectInfo.res.pIconResInfo[i].hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv); 1182 else 1183 { 1184 sprintf(temporary,"%s",projectInfo.resourceManager.iconResources[i].idName.c_str()); 1185 } 1186 tv.item.pszText=temporary; 1187 projectInfo.resourceManager.iconResources[i].hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv); 1184 1188 } 1185 1189 … … 1353 1357 } 1354 1358 else if(lstrcmpi(temporary,"icon")==0){ 1355 for(i3=0;i3<projectInfo.res .NumberOfIconRes;i3++){1356 if(lstrcmpi(projectInfo.res .pIconResInfo[i3].path,temp2)==0){1359 for(i3=0;i3<projectInfo.resourceManager.iconResources.size();i3++){ 1360 if(lstrcmpi(projectInfo.resourceManager.iconResources[i3].filepath.c_str(),temp2)==0){ 1357 1361 NewIconEditWindow( projectInfo.GetWorkDir().GetFullPath( temp2 ).c_str() ); 1358 1362 break; … … 1474 1478 } 1475 1479 else if(lstrcmpi(temporary,"icon")==0){ 1476 for(i3=0;i3<projectInfo.res .NumberOfIconRes;i3++){1477 if(lstrcmpi(projectInfo.res .pIconResInfo[i3].path,temp2)==0){1480 for(i3=0;i3<projectInfo.resourceManager.iconResources.size();i3++){ 1481 if(lstrcmpi(projectInfo.resourceManager.iconResources[i3].filepath.c_str(),temp2)==0){ 1478 1482 NewIconEditWindow( projectInfo.GetWorkDir().GetFullPath( temp2 ).c_str() ); 1479 1483 break; … … 1593 1597 else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){ 1594 1598 if(MdiInfo[WndNum].MdiIconEditInfo->bModify){ 1595 for(i=0;i<projectInfo.res .NumberOfIconRes;i++){1596 lstrcpy(temporary,projectInfo.res .pIconResInfo[i].path);1599 for(i=0;i<projectInfo.resourceManager.iconResources.size();i++){ 1600 lstrcpy(temporary,projectInfo.resourceManager.iconResources[i].filepath.c_str()); 1597 1601 lstrcpy( temporary, projectInfo.GetWorkDir().GetFullPath( temporary ).c_str() ); 1598 1602 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0) sw=1; … … 1686 1690 } 1687 1691 else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){ 1688 for(i=0;i<projectInfo.res .NumberOfIconRes;i++){1689 lstrcpy(temporary,projectInfo.res .pIconResInfo[i].path);1692 for(i=0;i<projectInfo.resourceManager.iconResources.size();i++){ 1693 lstrcpy(temporary,projectInfo.resourceManager.iconResources[i].filepath.c_str()); 1690 1694 lstrcpy( temporary, projectInfo.GetWorkDir().GetFullPath( temporary ).c_str() ); 1691 1695 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0){ 1692 sprintf(buffer+i2,"icon,%s\r\n",projectInfo.res .pIconResInfo[i].path);1696 sprintf(buffer+i2,"icon,%s\r\n",projectInfo.resourceManager.iconResources[i].filepath.c_str()); 1693 1697 i2+=lstrlen(buffer+i2); 1694 1698 break; -
trunk/ab5.0/abdev/abdev/RadSupport.cpp
r620 r623 106 106 lstrcpy(temporary,pWindowInfo->childWindowInfos[i2]->ImageCtrlInfo.path); 107 107 else{ 108 for(i3=0;i3<projectInfo.res.NumberOfIconRes;i3++){ 109 if(lstrcmp(pWindowInfo->childWindowInfos[i2]->ImageCtrlInfo.path, 110 projectInfo.res.pIconResInfo[i3].IdName)==0) break; 108 for(i3=0;i3<projectInfo.resourceManager.iconResources.size();i3++) 109 { 110 if( projectInfo.resourceManager.iconResources[i3].idName == pWindowInfo->childWindowInfos[i2]->ImageCtrlInfo.path ) 111 { 112 break; 113 } 111 114 } 112 if(i3==projectInfo.res .NumberOfIconRes) temporary[0]=0;113 else lstrcpy(temporary,projectInfo.res .pIconResInfo[i3].path);115 if(i3==projectInfo.resourceManager.iconResources.size()) temporary[0]=0; 116 else lstrcpy(temporary,projectInfo.resourceManager.iconResources[i3].filepath.c_str()); 114 117 } 115 118 if(temporary[0]){ … … 124 127 lstrcpy(temporary,pWindowInfo->childWindowInfos[i2]->ImageCtrlInfo.path); 125 128 else{ 126 for(i3=0;i3<projectInfo.res.NumberOfBitmapRes;i3++){ 127 if(lstrcmp(pWindowInfo->childWindowInfos[i2]->ImageCtrlInfo.path, 128 projectInfo.res.pBitmapResInfo[i3].IdName)==0) break; 129 for(i3=0;i3<projectInfo.resourceManager.bitmapResources.size();i3++){ 130 if( projectInfo.resourceManager.bitmapResources[i3].idName == pWindowInfo->childWindowInfos[i2]->ImageCtrlInfo.path ) 131 { 132 break; 133 } 129 134 } 130 if(i3==projectInfo.res .NumberOfBitmapRes) temporary[0]=0;131 else lstrcpy(temporary,projectInfo.res .pBitmapResInfo[i3].path);135 if(i3==projectInfo.resourceManager.bitmapResources.size()) temporary[0]=0; 136 else lstrcpy(temporary,projectInfo.resourceManager.bitmapResources[i3].filepath.c_str()); 132 137 } 133 138 if(temporary[0]){ -
trunk/ab5.0/abdev/abdev/RadToolsAndPropertyProc.cpp
r620 r623 564 564 SendDlgItemMessage(hwnd,IDC_BGCOLOR,CB_ADDSTRING,0,(long)STRING_WINDOWPROP_BGCOLOR2); 565 565 566 for(i3=0;i3<projectInfo.res .NumberOfBitmapRes;i3++)567 SendDlgItemMessage(hwnd,IDC_BGCOLOR,CB_ADDSTRING,0,(long)projectInfo.res .pBitmapResInfo[i3].IdName);566 for(i3=0;i3<projectInfo.resourceManager.bitmapResources.size();i3++) 567 SendDlgItemMessage(hwnd,IDC_BGCOLOR,CB_ADDSTRING,0,(long)projectInfo.resourceManager.bitmapResources[i3].idName.c_str()); 568 568 if(pWindowInfo->type==WNDTYPE_MODALDLG|| 569 569 pWindowInfo->type==WNDTYPE_MODELESSDLG){ … … 617 617 SendDlgItemMessage(hwnd,IDC_ICONRES,CB_ADDSTRING,0,(long)STRING_WINDOWPROP_ICONDEFAULT); 618 618 619 for(i3=0,i4=0;i3<projectInfo.res.NumberOfIconRes;i3++){ 620 SendDlgItemMessage(hwnd,IDC_ICONRES,CB_ADDSTRING,0,(long)projectInfo.res.pIconResInfo[i3].IdName); 621 622 if(lstrcmp(pWindowInfo->IconResName,projectInfo.res.pIconResInfo[i3].IdName)==0) 623 i4=i3+1; 619 for(i3=0,i4=0;i3<projectInfo.resourceManager.iconResources.size();i3++){ 620 SendDlgItemMessage(hwnd,IDC_ICONRES,CB_ADDSTRING,0,(long)projectInfo.resourceManager.iconResources[i3].idName.c_str()); 621 622 if( pWindowInfo->IconResName ) 623 { 624 if( projectInfo.resourceManager.iconResources[i3].idName == pWindowInfo->IconResName ) 625 { 626 i4=i3+1; 627 } 628 } 624 629 } 625 630 if(i4==0&&pWindowInfo->IconResName){ … … 2727 2732 if((pWindowInfo->childWindowInfos[MdiInfo[i].MdiRadInfo->SelectingItem[0]]->style&0x0000000F)==SS_ICON){ 2728 2733 //アイコンリソースをコンボボックスに挿入 2729 for(i3=0;i3<projectInfo.res .NumberOfIconRes;i3++)2730 SendDlgItemMessage(hwnd,IDC_RESCOMBO,CB_ADDSTRING,0,(long)projectInfo.res .pIconResInfo[i3].IdName);2734 for(i3=0;i3<projectInfo.resourceManager.iconResources.size();i3++) 2735 SendDlgItemMessage(hwnd,IDC_RESCOMBO,CB_ADDSTRING,0,(long)projectInfo.resourceManager.iconResources[i3].idName.c_str()); 2731 2736 } 2732 2737 else if((pWindowInfo->childWindowInfos[MdiInfo[i].MdiRadInfo->SelectingItem[0]]->style&0x0000000F)==SS_BITMAP){ 2733 2738 //ビットマップリソースをコンボボックスに挿入 2734 for(i3=0;i3<projectInfo.res .NumberOfBitmapRes;i3++)2735 SendDlgItemMessage(hwnd,IDC_RESCOMBO,CB_ADDSTRING,0,(long)projectInfo.res .pBitmapResInfo[i3].IdName);2739 for(i3=0;i3<projectInfo.resourceManager.bitmapResources.size();i3++) 2740 SendDlgItemMessage(hwnd,IDC_RESCOMBO,CB_ADDSTRING,0,(long)projectInfo.resourceManager.bitmapResources[i3].idName.c_str()); 2736 2741 } 2737 2742 … … 2816 2821 if((pWindowInfo->childWindowInfos[MdiInfo[i].MdiRadInfo->SelectingItem[0]]->style&0x0000000F)==SS_ICON){ 2817 2822 //アイコンリソースをコンボボックスに挿入 2818 for(i3=0;i3<projectInfo.res.NumberOfIconRes;i3++){ 2819 SendDlgItemMessage(hwnd,IDC_RESCOMBO,CB_ADDSTRING,0,(long)projectInfo.res.pIconResInfo[i3].IdName); 2820 2821 if(lstrcmp(pWindowInfo->childWindowInfos[MdiInfo[i].MdiRadInfo->SelectingItem[0]]->ImageCtrlInfo.path,projectInfo.res.pIconResInfo[i3].IdName)==0) 2823 for(i3=0;i3<projectInfo.resourceManager.iconResources.size();i3++){ 2824 SendDlgItemMessage(hwnd,IDC_RESCOMBO,CB_ADDSTRING,0,(long)projectInfo.resourceManager.iconResources[i3].idName.c_str()); 2825 2826 if( projectInfo.resourceManager.iconResources[i3].idName == pWindowInfo->childWindowInfos[MdiInfo[i].MdiRadInfo->SelectingItem[0]]->ImageCtrlInfo.path ) 2827 { 2822 2828 SendDlgItemMessage(hwnd,IDC_RESCOMBO,CB_SETCURSEL,i3,0); 2829 } 2823 2830 } 2824 2831 } 2825 2832 else if((pWindowInfo->childWindowInfos[MdiInfo[i].MdiRadInfo->SelectingItem[0]]->style&0x0000000F)==SS_BITMAP){ 2826 2833 //ビットマップリソースをコンボボックスに挿入 2827 for(i3=0;i3<projectInfo.res.NumberOfBitmapRes;i3++){ 2828 SendDlgItemMessage(hwnd,IDC_RESCOMBO,CB_ADDSTRING,0,(long)projectInfo.res.pBitmapResInfo[i3].IdName); 2829 2830 if(lstrcmp(pWindowInfo->childWindowInfos[MdiInfo[i].MdiRadInfo->SelectingItem[0]]->ImageCtrlInfo.path,projectInfo.res.pBitmapResInfo[i3].IdName)==0) 2834 for(i3=0;i3<projectInfo.resourceManager.bitmapResources.size();i3++){ 2835 SendDlgItemMessage(hwnd,IDC_RESCOMBO,CB_ADDSTRING,0,(long)projectInfo.resourceManager.bitmapResources[i3].idName.c_str()); 2836 2837 if( projectInfo.resourceManager.bitmapResources[i3].idName == pWindowInfo->childWindowInfos[MdiInfo[i].MdiRadInfo->SelectingItem[0]]->ImageCtrlInfo.path ) 2838 { 2831 2839 SendDlgItemMessage(hwnd,IDC_RESCOMBO,CB_SETCURSEL,i3,0); 2840 } 2832 2841 } 2833 2842 } … … 2910 2919 if((pWindowInfo->childWindowInfos[MdiInfo[i].MdiRadInfo->SelectingItem[0]]->style&0x0000000F)==SS_ICON){ 2911 2920 //アイコンリソースをコンボボックスに挿入 2912 for(i3=0;i3<projectInfo.res.NumberOfIconRes;i3++) 2913 SendDlgItemMessage(hwnd,IDC_RESCOMBO,CB_ADDSTRING,0,(long)projectInfo.res.pIconResInfo[i3].IdName); 2921 for(i3=0;i3<projectInfo.resourceManager.iconResources.size();i3++) 2922 { 2923 SendDlgItemMessage(hwnd,IDC_RESCOMBO,CB_ADDSTRING,0,(long)projectInfo.resourceManager.iconResources[i3].idName.c_str()); 2924 } 2914 2925 } 2915 2926 else if((pWindowInfo->childWindowInfos[MdiInfo[i].MdiRadInfo->SelectingItem[0]]->style&0x0000000F)==SS_BITMAP){ 2916 2927 //ビットマップリソースをコンボボックスに挿入 2917 for(i3=0;i3<projectInfo.res .NumberOfBitmapRes;i3++)2918 SendDlgItemMessage(hwnd,IDC_RESCOMBO,CB_ADDSTRING,0,(long)projectInfo.res .pBitmapResInfo[i3].IdName);2928 for(i3=0;i3<projectInfo.resourceManager.bitmapResources.size();i3++) 2929 SendDlgItemMessage(hwnd,IDC_RESCOMBO,CB_ADDSTRING,0,(long)projectInfo.resourceManager.bitmapResources[i3].idName.c_str()); 2919 2930 } 2920 2931 break; -
trunk/ab5.0/abdev/abdev/Resource.cpp
r622 r623 11 11 #endif 12 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 hFile=CreateFile( projectInfo.GetResourceFileFullPath().c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); 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; 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; 35 34 break; 36 35 } 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){ 66 projectInfo.res.pCursorResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pCursorResInfo,(projectInfo.res.NumberOfCursorRes+1)*sizeof(RESITEMINFO)); 67 68 projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].IdName= 69 (char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1); 70 lstrcpy(projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].IdName,temp3); 71 72 projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].path= 73 (char *)HeapAlloc(hHeap,0,lstrlen(temp2)+1); 74 lstrcpy(projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].path,temp2); 75 76 projectInfo.res.NumberOfCursorRes++; 77 } 78 else if(lstrcmpi(temporary,"BITMAP")==0){ 79 projectInfo.res.pBitmapResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pBitmapResInfo,(projectInfo.res.NumberOfBitmapRes+1)*sizeof(RESITEMINFO)); 80 81 projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].IdName= 82 (char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1); 83 lstrcpy(projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].IdName,temp3); 84 85 projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].path= 86 (char *)HeapAlloc(hHeap,0,lstrlen(temp2)+1); 87 lstrcpy(projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].path,temp2); 88 89 projectInfo.res.NumberOfBitmapRes++; 90 } 91 else if(lstrcmpi(temporary,"ICON")==0){ 92 projectInfo.res.pIconResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pIconResInfo,(projectInfo.res.NumberOfIconRes+1)*sizeof(RESITEMINFO)); 93 94 projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].IdName= 95 (char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1); 96 lstrcpy(projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].IdName,temp3); 97 98 projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].path= 99 (char *)HeapAlloc(hHeap,0,lstrlen(temp2)+1); 100 lstrcpy(projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].path,temp2); 101 102 projectInfo.res.NumberOfIconRes++; 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 134 lstrcpy( temporary, projectInfo.GetWorkDir().GetRelationalPath( temporary ).c_str() ); 135 136 projectInfo.res.pCursorResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pCursorResInfo,(projectInfo.res.NumberOfCursorRes+1)*sizeof(RESITEMINFO)); 137 138 projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].path= 139 (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1); 140 lstrcpy(projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].path,temporary); 141 142 for(i3=1;;i3++){ 143 sprintf(temporary,"IDC_CURSOR%d",i3); 144 for(i2=0;i2<projectInfo.res.NumberOfCursorRes;i2++){ 145 if(lstrcmp(temporary,projectInfo.res.pCursorResInfo[i2].IdName)==0) break; 146 } 147 if(i2==projectInfo.res.NumberOfCursorRes) break; 148 } 149 150 projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].IdName= 151 (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1); 152 lstrcpy(projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].IdName,temporary); 36 } 37 38 if( !isDuplicate ) 39 { 40 break; 41 } 42 } 43 item.idName = temporary; 153 44 154 45 //ツリービューに追加 … … 159 50 tv.item.iImage=6; 160 51 tv.item.iSelectedImage=6; 161 tv.hParent =projectInfo.res.hCursorTreeItem;52 tv.hParent = hCursorTreeItemForProjectView; 162 53 tv.item.pszText=temporary; 163 54 164 projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].hTreeItem=165 TreeView_InsertItem(hMaterialTreeView,&tv); 166 167 TreeView_SelectItem(hMaterialTreeView,projectInfo.res.pCursorResInfo[projectInfo.res.NumberOfCursorRes].hTreeItem); 168 169 projectInfo.res.NumberOfCursorRes++; 55 item.hTreeItem = TreeView_InsertItem(hMaterialTreeView,&tv); 56 57 TreeView_SelectItem( hMaterialTreeView, item.hTreeItem ); 58 59 projectInfo.resourceManager.cursorResources.push_back( item ); 60 170 61 projectInfo.ModifuOfResource=1; 171 62 } 172 63 void Project_Cursor_Delete(int CursorInfoNum){ 173 int i;174 175 64 //ツリービューから削除 176 65 extern HWND hMaterialTreeView; 177 TreeView_DeleteItem(hMaterialTreeView,projectInfo.res .pCursorResInfo[CursorInfoNum].hTreeItem);66 TreeView_DeleteItem(hMaterialTreeView,projectInfo.resourceManager.cursorResources[CursorInfoNum].hTreeItem); 178 67 179 68 //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]; 69 Jenga::Common::EraseVectorItem<ActiveBasic::Common::ResourceItems>( projectInfo.resourceManager.cursorResources, CursorInfoNum ); 185 70 186 71 projectInfo.ModifuOfResource=1; … … 194 79 TVITEM tvItem; 195 80 196 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.res .pCursorResInfo[CursorInfoNum].IdName)) return;81 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.resourceManager.cursorResources[CursorInfoNum].idName.c_str())) return; 197 82 198 83 //重複チェック 199 for(i2=0;i2<projectInfo.res .NumberOfCursorRes;i2++){84 for(i2=0;i2<projectInfo.resourceManager.cursorResources.size();i2++){ 200 85 if(i2==CursorInfoNum) continue; 201 if(lstrcmp(NewIdName,projectInfo.res.pCursorResInfo[i2].IdName)==0){ 86 if( projectInfo.resourceManager.cursorResources[i2].idName == NewIdName ) 87 { 202 88 //"ID \"%s\" は既にプロジェクト内に存在します。" 203 89 sprintf(temporary,STRING_DUPLICATIONERROR_ID_IN_PROJECT,NewIdName); … … 207 93 } 208 94 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); 212 213 tvItem.hItem=projectInfo.res.pCursorResInfo[CursorInfoNum].hTreeItem; 95 projectInfo.resourceManager.cursorResources[CursorInfoNum].idName = NewIdName; 96 97 tvItem.hItem=projectInfo.resourceManager.cursorResources[CursorInfoNum].hTreeItem; 214 98 tvItem.mask=TVIF_TEXT; 215 tvItem.pszText=projectInfo.res.pCursorResInfo[CursorInfoNum].IdName; 216 tvItem.cchTextMax=lstrlen(projectInfo.res.pCursorResInfo[CursorInfoNum].IdName)+1; 99 lstrcpy( temporary, projectInfo.resourceManager.cursorResources[CursorInfoNum].idName.c_str() ); 100 tvItem.pszText=temporary; 101 tvItem.cchTextMax=lstrlen(temporary)+1; 217 102 TreeView_SetItem(hMaterialTreeView,&tvItem); 218 103 … … 220 105 221 106 TreeView_SortChildren(hMaterialTreeView, 222 TreeView_GetParent(hMaterialTreeView,projectInfo.res .pCursorResInfo[CursorInfoNum].hTreeItem),107 TreeView_GetParent(hMaterialTreeView,projectInfo.resourceManager.cursorResources[CursorInfoNum].hTreeItem), 223 108 0); 224 109 } … … 233 118 if(!GetFilePathDialog(hOwner,temporary,BitmapFileFilter,STRING_FILEOPENTITLE_BITMAP,TRUE)) return; 234 119 235 lstrcpy( temporary, projectInfo.GetWorkDir().GetRelationalPath( temporary ).c_str() ); 236 237 projectInfo.res.pBitmapResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pBitmapResInfo,(projectInfo.res.NumberOfBitmapRes+1)*sizeof(RESITEMINFO)); 238 239 projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].path= 240 (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1); 241 lstrcpy(projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].path,temporary); 120 ActiveBasic::Common::ResourceItem item; 121 item.filepath = projectInfo.GetWorkDir().GetRelationalPath( temporary ); 242 122 243 123 for(i3=1;;i3++){ 244 124 sprintf(temporary,"IDB_BITMAP%d",i3); 245 for(i2=0;i2<projectInfo.res.NumberOfBitmapRes;i2++){ 246 if(lstrcmp(temporary,projectInfo.res.pBitmapResInfo[i2].IdName)==0) break; 247 } 248 if(i2==projectInfo.res.NumberOfBitmapRes) break; 249 } 250 251 projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].IdName= 252 (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1); 253 lstrcpy(projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].IdName,temporary); 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; 254 141 255 142 //ツリービューに追加 … … 260 147 tv.item.iImage=5; 261 148 tv.item.iSelectedImage=5; 262 tv.hParent =projectInfo.res.hBitmapTreeItem;149 tv.hParent = hBitmapTreeItemForProjectView; 263 150 tv.item.pszText=temporary; 264 151 265 projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].hTreeItem=266 TreeView_InsertItem(hMaterialTreeView,&tv); 267 268 TreeView_SelectItem(hMaterialTreeView,projectInfo.res.pBitmapResInfo[projectInfo.res.NumberOfBitmapRes].hTreeItem); 269 270 projectInfo.res.NumberOfBitmapRes++; 152 item.hTreeItem = TreeView_InsertItem(hMaterialTreeView,&tv); 153 154 TreeView_SelectItem(hMaterialTreeView,item.hTreeItem); 155 156 projectInfo.resourceManager.bitmapResources.push_back( item ); 157 271 158 projectInfo.ModifuOfResource=1; 272 159 … … 283 170 } 284 171 void Project_Bitmap_Delete(int BitmapInfoNum){ 285 int i;286 287 172 //ツリービューから削除 288 173 extern HWND hMaterialTreeView; 289 TreeView_DeleteItem(hMaterialTreeView,projectInfo.res .pBitmapResInfo[BitmapInfoNum].hTreeItem);174 TreeView_DeleteItem(hMaterialTreeView,projectInfo.resourceManager.bitmapResources[BitmapInfoNum].hTreeItem); 290 175 291 176 //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]; 177 Jenga::Common::EraseVectorItem<ActiveBasic::Common::ResourceItems>( projectInfo.resourceManager.bitmapResources, BitmapInfoNum ); 297 178 298 179 projectInfo.ModifuOfResource=1; … … 306 187 TVITEM tvItem; 307 188 308 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.res .pBitmapResInfo[BitmapInfoNum].IdName)) return;189 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.resourceManager.bitmapResources[BitmapInfoNum].idName.c_str())) return; 309 190 310 191 //重複チェック 311 for(i2=0;i2<projectInfo.res .NumberOfBitmapRes;i2++){192 for(i2=0;i2<projectInfo.resourceManager.bitmapResources.size();i2++){ 312 193 if(i2==BitmapInfoNum) continue; 313 if(lstrcmp(NewIdName,projectInfo.res.pBitmapResInfo[i2].IdName)==0){ 194 if( projectInfo.resourceManager.bitmapResources[i2].idName == NewIdName ) 195 { 314 196 //"ID \"%s\" は既にプロジェクト内に存在します。" 315 197 sprintf(temporary,STRING_DUPLICATIONERROR_ID_IN_PROJECT,NewIdName); … … 319 201 } 320 202 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); 324 325 tvItem.hItem=projectInfo.res.pBitmapResInfo[BitmapInfoNum].hTreeItem; 203 projectInfo.resourceManager.bitmapResources[BitmapInfoNum].idName = NewIdName; 204 205 tvItem.hItem=projectInfo.resourceManager.bitmapResources[BitmapInfoNum].hTreeItem; 326 206 tvItem.mask=TVIF_TEXT; 327 tvItem.pszText=projectInfo.res.pBitmapResInfo[BitmapInfoNum].IdName; 328 tvItem.cchTextMax=lstrlen(projectInfo.res.pBitmapResInfo[BitmapInfoNum].IdName)+1; 207 lstrcpy( temporary, projectInfo.resourceManager.bitmapResources[BitmapInfoNum].idName.c_str() ); 208 tvItem.pszText = temporary; 209 tvItem.cchTextMax=lstrlen(temporary)+1; 329 210 TreeView_SetItem(hMaterialTreeView,&tvItem); 330 211 … … 332 213 333 214 TreeView_SortChildren(hMaterialTreeView, 334 TreeView_GetParent(hMaterialTreeView,projectInfo.res .pBitmapResInfo[BitmapInfoNum].hTreeItem),215 TreeView_GetParent(hMaterialTreeView,projectInfo.resourceManager.bitmapResources[BitmapInfoNum].hTreeItem), 335 216 0); 336 217 } … … 344 225 if(!GetFilePathDialog(hOwner,temporary,IconFileFilter,STRING_FILEOPENTITLE_ICON,TRUE)) return; 345 226 346 lstrcpy( temporary, projectInfo.GetWorkDir().GetRelationalPath( temporary ).c_str() ); 347 348 projectInfo.res.pIconResInfo=(RESITEMINFO *)HeapReAlloc(hHeap,0,projectInfo.res.pIconResInfo,(projectInfo.res.NumberOfIconRes+1)*sizeof(RESITEMINFO)); 349 350 projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].path= 351 (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1); 352 lstrcpy(projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].path,temporary); 227 ActiveBasic::Common::ResourceItem item; 228 item.filepath = projectInfo.GetWorkDir().GetRelationalPath( temporary ); 353 229 354 230 for(i3=1;;i3++){ 355 231 sprintf(temporary,"IDI_ICON%d",i3); 356 for(i2=0;i2<projectInfo.res.NumberOfIconRes;i2++){ 357 if(lstrcmp(temporary,projectInfo.res.pIconResInfo[i2].IdName)==0) break; 358 } 359 if(i2==projectInfo.res.NumberOfIconRes) break; 360 } 361 362 projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].IdName= 363 (char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1); 364 lstrcpy(projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].IdName,temporary); 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; 365 248 366 249 //ツリービューに追加 … … 371 254 tv.item.iImage=4; 372 255 tv.item.iSelectedImage=4; 373 tv.hParent =projectInfo.res.hIconTreeItem;374 if(projectInfo.res .NumberOfIconRes==0) lstrcat(temporary," (Main)");256 tv.hParent = hIconTreeItemForProjectView; 257 if(projectInfo.resourceManager.iconResources.size()==0) lstrcat(temporary," (Main)"); 375 258 tv.item.pszText=temporary; 376 259 377 projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].hTreeItem=260 item.hTreeItem= 378 261 TreeView_InsertItem(hMaterialTreeView,&tv); 379 262 380 TreeView_SelectItem(hMaterialTreeView,projectInfo.res.pIconResInfo[projectInfo.res.NumberOfIconRes].hTreeItem); 381 382 projectInfo.res.NumberOfIconRes++; 263 TreeView_SelectItem(hMaterialTreeView,item.hTreeItem); 264 265 projectInfo.resourceManager.iconResources.push_back( item ); 266 383 267 projectInfo.ModifuOfResource=1; 384 268 … … 401 285 //ツリービューから削除 402 286 extern HWND hMaterialTreeView; 403 TreeView_DeleteItem(hMaterialTreeView,projectInfo.res .pIconResInfo[IconInfoNum].hTreeItem);287 TreeView_DeleteItem(hMaterialTreeView,projectInfo.resourceManager.iconResources[IconInfoNum].hTreeItem); 404 288 405 289 //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]; 410 411 if(IconInfoNum==0&&projectInfo.res.NumberOfIconRes){ 290 Jenga::Common::EraseVectorItem<ActiveBasic::Common::ResourceItems>( projectInfo.resourceManager.iconResources, IconInfoNum ); 291 292 if(IconInfoNum==0&&projectInfo.resourceManager.iconResources.size()){ 412 293 tv.mask=TVIF_TEXT|TVIF_HANDLE; 413 294 tv.pszText=temporary; 414 295 tv.cchTextMax=MAX_PATH; 415 tv.hItem=projectInfo.res .pIconResInfo[0].hTreeItem;296 tv.hItem=projectInfo.resourceManager.iconResources[0].hTreeItem; 416 297 TreeView_GetItem(hMaterialTreeView,&tv); 417 298 lstrcat(tv.pszText," (Main)"); … … 439 320 TVITEM tvItem; 440 321 441 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.res .pIconResInfo[IconInfoNum].IdName)) return;322 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_ResourceID_Input,(long)projectInfo.resourceManager.iconResources[IconInfoNum].idName.c_str())) return; 442 323 443 324 //重複チェック 444 for(i2=0;i2<projectInfo.res .NumberOfIconRes;i2++){325 for(i2=0;i2<projectInfo.resourceManager.iconResources.size();i2++){ 445 326 if(i2==IconInfoNum) continue; 446 if(lstrcmp(NewIdName,projectInfo.res.pIconResInfo[i2].IdName)==0){ 327 if( projectInfo.resourceManager.iconResources[i2].idName == NewIdName ) 328 { 447 329 //"ID \"%s\" は既にプロジェクト内に存在します。" 448 330 sprintf(temporary,STRING_DUPLICATIONERROR_ID_IN_PROJECT,NewIdName); … … 452 334 } 453 335 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); 457 458 tvItem.hItem=projectInfo.res.pIconResInfo[IconInfoNum].hTreeItem; 336 projectInfo.resourceManager.iconResources[IconInfoNum].idName = NewIdName; 337 338 tvItem.hItem=projectInfo.resourceManager.iconResources[IconInfoNum].hTreeItem; 459 339 tvItem.mask=TVIF_TEXT; 460 340 if(IconInfoNum==0){ 461 sprintf(temporary,"%s (Main)",projectInfo.res.pIconResInfo[IconInfoNum].IdName); 462 tvItem.pszText=temporary; 463 } 464 else tvItem.pszText=projectInfo.res.pIconResInfo[IconInfoNum].IdName; 465 tvItem.cchTextMax=lstrlen(projectInfo.res.pIconResInfo[IconInfoNum].IdName)+1; 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; 466 349 TreeView_SetItem(hMaterialTreeView,&tvItem); 467 350 … … 469 352 470 353 TreeView_SortChildren(hMaterialTreeView, 471 TreeView_GetParent(hMaterialTreeView,projectInfo.res .pIconResInfo[IconInfoNum].hTreeItem),354 TreeView_GetParent(hMaterialTreeView,projectInfo.resourceManager.iconResources[IconInfoNum].hTreeItem), 472 355 0); 473 356 } -
trunk/ab5.0/abdev/abdev/WindowControl.cpp
r620 r623 1097 1097 sprintf(buffer+i2,"_RadSys_hBackBrush%d=CreatePatternBrush(LoadImage(GetModuleHandle(0),%s,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE or LR_SHARED))\r\n", 1098 1098 i, 1099 projectInfo.res .pBitmapResInfo[pWindowInfo->bgColor-0x1000].IdName);1099 projectInfo.resourceManager.bitmapResources[pWindowInfo->bgColor-0x1000].idName.c_str()); 1100 1100 i2+=lstrlen(buffer+i2); 1101 1101 } -
trunk/ab5.0/abdev/abdev/abdev.h
r618 r623 75 75 HWND hProjectView_ToolWindow; 76 76 77 // リソース関連 78 HTREEITEM hCursorTreeItemForProjectView; 79 HTREEITEM hBitmapTreeItemForProjectView; 80 HTREEITEM hIconTreeItemForProjectView; 81 77 82 //コンパイラビュー情報 78 83 HWND hCompileView; -
trunk/ab5.0/abdev/abdev/include/ProjectManager/ProjectManager.h
r622 r623 53 53 HTREEITEM hWindowTreeItem; 54 54 55 RESOURCEINFO res;56 57 55 DWORD dwOption; 58 56 char lpszOutput_Release[MAX_PATH]; … … 77 75 Jenga::Common::Directory workDir; 78 76 ActiveBasic::Common::TargetModuleType::EnumType moduleType; 77 78 public: 79 ActiveBasic::Common::ResourceManager resourceManager; 79 80 }; 80 81 -
trunk/ab5.0/abdev/abdev/src/ProjectManager/ProjectManager.cpp
r622 r623 25 25 lstrcpy(pobj_nv->DefSaveDir,this->GetWorkDir().GetPath().c_str()); 26 26 27 28 //////////////////////////////////////////29 // リソースデータ用領域を確保30 this->res.pCursorResInfo=(RESITEMINFO *)HeapAlloc(hHeap,0,1);31 this->res.NumberOfCursorRes=0;32 this->res.pBitmapResInfo=(RESITEMINFO *)HeapAlloc(hHeap,0,1);33 this->res.NumberOfBitmapRes=0;34 this->res.pIconResInfo=(RESITEMINFO *)HeapAlloc(hHeap,0,1);35 this->res.NumberOfIconRes=0;36 27 37 28 … … 242 233 243 234 // リソースを読み込む 244 Jenga::Common::Path resourcePath( projectInfo.GetResourceFileFullPath() );235 Jenga::Common::Path resourcePath( this->GetResourceFileFullPath() ); 245 236 if( resourcePath.IsExistFile() ) 246 237 { 247 GetResourceData();238 this->resourceManager.Load( this->GetResourceFileFullPath() ); 248 239 } 249 240 … … 302 293 if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){ 303 294 if(MdiInfo[WndNum].MdiIconEditInfo->bModify){ 304 for(i=0;i<this->res .NumberOfIconRes;i++){305 lstrcpy(temporary,this->res .pIconResInfo[i].path);295 for(i=0;i<this->resourceManager.iconResources.size();i++){ 296 lstrcpy(temporary,this->resourceManager.iconResources[i].filepath.c_str()); 306 297 lstrcpy( temporary, this->GetWorkDir().GetFullPath( temporary ).c_str() ); 307 298 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0){ … … 366 357 i2=0; 367 358 i3=101; 368 for(i=0;i<this->res .NumberOfCursorRes;i++,i3++){359 for(i=0;i<this->resourceManager.cursorResources.size();i++,i3++){ 369 360 sprintf(buffer+i2,"Const %s=%d\r\n", 370 this->res .pCursorResInfo[i].IdName,361 this->resourceManager.cursorResources[i].idName.c_str(), 371 362 i3); 372 363 i2+=lstrlen(buffer+i2); 373 364 } 374 for(i=0;i<this->res .NumberOfBitmapRes;i++,i3++){365 for(i=0;i<this->resourceManager.bitmapResources.size();i++,i3++){ 375 366 sprintf(buffer+i2,"Const %s=%d\r\n", 376 this->res .pBitmapResInfo[i].IdName,367 this->resourceManager.bitmapResources[i].idName.c_str(), 377 368 i3); 378 369 i2+=lstrlen(buffer+i2); 379 370 } 380 for(i=0;i<this->res .NumberOfIconRes;i++,i3++){371 for(i=0;i<this->resourceManager.iconResources.size();i++,i3++){ 381 372 sprintf(buffer+i2,"Const %s=%d\r\n", 382 this->res .pIconResInfo[i].IdName,373 this->resourceManager.iconResources[i].idName.c_str(), 383 374 i3); 384 375 i2+=lstrlen(buffer+i2); … … 389 380 390 381 i2=0; 391 for(i=0;i<this->res .NumberOfCursorRes;i++){382 for(i=0;i<this->resourceManager.cursorResources.size();i++){ 392 383 sprintf(buffer+i2,"%s CURSOR \"%s\"\r\n", 393 this->res .pCursorResInfo[i].IdName,394 this->res .pCursorResInfo[i].path);395 i2+=lstrlen(buffer+i2); 396 } 397 for(i=0;i<this->res .NumberOfBitmapRes;i++){384 this->resourceManager.cursorResources[i].idName.c_str(), 385 this->resourceManager.cursorResources[i].filepath.c_str()); 386 i2+=lstrlen(buffer+i2); 387 } 388 for(i=0;i<this->resourceManager.bitmapResources.size();i++){ 398 389 sprintf(buffer+i2,"%s BITMAP \"%s\"\r\n", 399 this->res .pBitmapResInfo[i].IdName,400 this->res .pBitmapResInfo[i].path);401 i2+=lstrlen(buffer+i2); 402 } 403 for(i=0;i<this->res .NumberOfIconRes;i++){390 this->resourceManager.bitmapResources[i].idName.c_str(), 391 this->resourceManager.bitmapResources[i].filepath.c_str()); 392 i2+=lstrlen(buffer+i2); 393 } 394 for(i=0;i<this->resourceManager.iconResources.size();i++){ 404 395 sprintf(buffer+i2,"%s ICON \"%s\"\r\n", 405 this->res .pIconResInfo[i].IdName,406 this->res .pIconResInfo[i].path);396 this->resourceManager.iconResources[i].idName.c_str(), 397 this->resourceManager.iconResources[i].filepath.c_str()); 407 398 i2+=lstrlen(buffer+i2); 408 399 } … … 578 569 } 579 570 else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){ 580 for(i=0;this->res .NumberOfIconRes;i++){581 lstrcpy(temporary,this->res .pIconResInfo[i].path);571 for(i=0;this->resourceManager.iconResources.size();i++){ 572 lstrcpy(temporary,this->resourceManager.iconResources[i].filepath.c_str()); 582 573 lstrcpy( temporary, this->GetWorkDir().GetFullPath( temporary ).c_str() ); 583 574 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0){ … … 627 618 628 619 //リソースのメモリを解放 629 for(i=0;i<this->res.NumberOfCursorRes;i++){ 630 HeapDefaultFree(this->res.pCursorResInfo[i].IdName); 631 HeapDefaultFree(this->res.pCursorResInfo[i].path); 632 } 633 HeapDefaultFree(this->res.pCursorResInfo); 634 for(i=0;i<this->res.NumberOfBitmapRes;i++){ 635 HeapDefaultFree(this->res.pBitmapResInfo[i].IdName); 636 HeapDefaultFree(this->res.pBitmapResInfo[i].path); 637 } 638 HeapDefaultFree(this->res.pBitmapResInfo); 639 for(i=0;i<this->res.NumberOfIconRes;i++){ 640 HeapDefaultFree(this->res.pIconResInfo[i].IdName); 641 HeapDefaultFree(this->res.pIconResInfo[i].path); 642 } 643 HeapDefaultFree(this->res.pIconResInfo); 620 this->resourceManager.Clear(); 644 621 645 622 //プロジェクト ビューを非表示にする
Note:
See TracChangeset
for help on using the changeset viewer.