Ignore:
Timestamp:
May 23, 2008, 10:35:36 PM (16 years ago)
Author:
dai_9181
Message:

WindowInfoクラスをリファクタリング

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/abdev/src/ProjectManager/ProjectManager.cpp

    r623 r624  
    11#include "stdafx.h"
    22
    3 using namespace ActiveBasic::IDE;
     3using namespace ActiveBasic::PM;
    44
    55void OpenWorkfile( const std::string &path );
     
    293293        if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){
    294294            if(MdiInfo[WndNum].MdiIconEditInfo->bModify){
    295                 for(i=0;i<this->resourceManager.iconResources.size();i++){
    296                     lstrcpy(temporary,this->resourceManager.iconResources[i].filepath.c_str());
     295                BOOST_FOREACH( const ActiveBasic::Common::ResourceItem &resourceItem, resourceManager.iconResources )
     296                {
     297                    lstrcpy(temporary,resourceItem.filepath.c_str());
    297298                    lstrcpy( temporary, this->GetWorkDir().GetFullPath( temporary ).c_str() );
    298299                    if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0){
     
    357358        i2=0;
    358359        i3=101;
    359         for(i=0;i<this->resourceManager.cursorResources.size();i++,i3++){
     360        BOOST_FOREACH( const ActiveBasic::Common::ResourceItem &resourceItem, resourceManager.cursorResources )
     361        {
    360362            sprintf(buffer+i2,"Const %s=%d\r\n",
    361                 this->resourceManager.cursorResources[i].idName.c_str(),
     363                resourceItem.idName.c_str(),
    362364                i3);
    363365            i2+=lstrlen(buffer+i2);
    364         }
    365         for(i=0;i<this->resourceManager.bitmapResources.size();i++,i3++){
     366
     367            i3++;
     368        }
     369        BOOST_FOREACH( const ActiveBasic::Common::ResourceItem &resourceItem, resourceManager.bitmapResources )
     370        {
    366371            sprintf(buffer+i2,"Const %s=%d\r\n",
    367                 this->resourceManager.bitmapResources[i].idName.c_str(),
     372                resourceItem.idName.c_str(),
    368373                i3);
    369374            i2+=lstrlen(buffer+i2);
    370         }
    371         for(i=0;i<this->resourceManager.iconResources.size();i++,i3++){
     375
     376            i3++;
     377        }
     378        BOOST_FOREACH( const ActiveBasic::Common::ResourceItem &resourceItem, resourceManager.iconResources )
     379        {
    372380            sprintf(buffer+i2,"Const %s=%d\r\n",
    373                 this->resourceManager.iconResources[i].idName.c_str(),
     381                resourceItem.idName.c_str(),
    374382                i3);
    375383            i2+=lstrlen(buffer+i2);
     384
     385            i3++;
    376386        }
    377387
     
    380390
    381391        i2=0;
    382         for(i=0;i<this->resourceManager.cursorResources.size();i++){
     392        BOOST_FOREACH( const ActiveBasic::Common::ResourceItem &resourceItem, resourceManager.cursorResources )
     393        {
    383394            sprintf(buffer+i2,"%s CURSOR \"%s\"\r\n",
    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++){
     395                resourceItem.idName.c_str(),
     396                resourceItem.filepath.c_str());
     397            i2+=lstrlen(buffer+i2);
     398        }
     399        BOOST_FOREACH( const ActiveBasic::Common::ResourceItem &resourceItem, resourceManager.bitmapResources )
     400        {
    389401            sprintf(buffer+i2,"%s BITMAP \"%s\"\r\n",
    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++){
     402                resourceItem.idName.c_str(),
     403                resourceItem.filepath.c_str());
     404            i2+=lstrlen(buffer+i2);
     405        }
     406        BOOST_FOREACH( const ActiveBasic::Common::ResourceItem &resourceItem, resourceManager.iconResources )
     407        {
    395408            sprintf(buffer+i2,"%s ICON \"%s\"\r\n",
    396                 this->resourceManager.iconResources[i].idName.c_str(),
    397                 this->resourceManager.iconResources[i].filepath.c_str());
     409                resourceItem.idName.c_str(),
     410                resourceItem.filepath.c_str());
    398411            i2+=lstrlen(buffer+i2);
    399412        }
     
    521534    extern HANDLE hHeap;
    522535    extern MDIINFO MdiInfo[MAX_WNDNUM];
    523     int i,i2,WndNum;
     536    int i,WndNum;
    524537    HWND hChild,hCloseChild;
    525538    char temporary[MAX_PATH];
     
    587600
    588601    //ウィンドウ情報のメモリを解放
    589     BOOST_FOREACH( WindowInfo *pWindowInfo, windowInfos )
     602    BOOST_FOREACH( ActiveBasic::PM::WindowInfo *pWindowInfo, windowInfos )
    590603    {
    591         HeapDefaultFree(pWindowInfo->caption);
    592         HeapDefaultFree(pWindowInfo->ClassName);
    593604        HeapDefaultFree(pWindowInfo->CallBackName);
    594605        HeapDefaultFree(pWindowInfo->filepath);
    595         if(pWindowInfo->MenuID)
    596             HeapDefaultFree(pWindowInfo->MenuID);
    597         if(pWindowInfo->IconResName)
    598             HeapDefaultFree(pWindowInfo->IconResName);
    599606
    600607        //子ウィンドウのメモリを解放
    601         for(i2=0;i2<pWindowInfo->childWindowInfos.size();i2++){
    602             HeapDefaultFree(pWindowInfo->childWindowInfos[i2]->IdName);
    603             HeapDefaultFree(pWindowInfo->childWindowInfos[i2]->caption);
    604             if(pWindowInfo->childWindowInfos[i2]->Control==CT_IMAGEBOX){
    605                 //イメージ ボックスの場合
    606                 HeapDefaultFree(pWindowInfo->childWindowInfos[i2]->ImageCtrlInfo.path);
    607             }
    608 
    609             delete pWindowInfo->childWindowInfos[i2];
     608        BOOST_FOREACH( ActiveBasic::PM::ChildWindowInfo *pChildWindowInfo, pWindowInfo->childWindowInfos )
     609        {
     610            delete pChildWindowInfo;
    610611        }
    611612        pWindowInfo->childWindowInfos.clear();
Note: See TracChangeset for help on using the changeset viewer.