Ignore:
Timestamp:
May 19, 2008, 3:03:33 PM (16 years ago)
Author:
dai_9181
Message:

CHILDINFOの管理方法をstd::vectorに変更。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/abdev/WindowControl.cpp

    r615 r616  
    7070    BYTE *pByte;
    7171    int i2,i3,MemSize;
    72     CHILDINFO *pChildInfo;
    7372
    7473    for(i3=0;;i3++){
     
    8685
    8786    for(i3--;i3>=0;i3--){
    88         pChildInfo=&ProjectInfo.windowInfos[WndInfoNum]->pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[i3]];
     87        CHILDINFO *pChildInfo = ProjectInfo.windowInfos[WndInfoNum]->childWindowInfos[MdiInfo[WndNum].MdiRadInfo->SelectingItem[i3]];
    8988
    9089        MemSize+=lstrlen(pChildInfo->IdName)+1+
     
    557556
    558557        //子ウィンドウ作成
    559         for(i2=0,sw=0;i2<pWindowInfo->NumberOfChildWindows;i2++){
    560             if(pWindowInfo->pChildInfo[i2].Control==CT_UPDOWN){
     558        sw = 0;
     559        BOOST_FOREACH( const CHILDINFO *pChildInfo, pWindowInfo->childWindowInfos )
     560        {
     561            if(pChildInfo->Control==CT_UPDOWN){
    561562                sprintf(Command+i,"%s\tCreateUpDownControl(%d,%d,%d,%d,%d,hWnd,%s,GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,0,0,100,0)\r\n",
    562563                    spaces,
    563                     pWindowInfo->pChildInfo[i2].style,
    564                     pWindowInfo->pChildInfo[i2].pos.x,pWindowInfo->pChildInfo[i2].pos.y,
    565                     pWindowInfo->pChildInfo[i2].size.cx,pWindowInfo->pChildInfo[i2].size.cy,
    566                     pWindowInfo->pChildInfo[i2].IdName);
     564                    pChildInfo->style,
     565                    pChildInfo->pos.x,pChildInfo->pos.y,
     566                    pChildInfo->size.cx,pChildInfo->size.cy,
     567                    pChildInfo->IdName);
    567568                i+=lstrlen(Command+i);
    568569            }
    569570            else{
    570                 GetItemClassName(temporary,pWindowInfo->pChildInfo[i2].Control);
    571                 temp2=FormatCaption(pWindowInfo->pChildInfo[i2].caption);
     571                GetItemClassName(temporary,pChildInfo->Control);
     572                temp2=FormatCaption(pChildInfo->caption);
    572573                sprintf(Command+i,"%s\tCreateWindowEx(&H%08x,\"%s\",\"%s\",&H%08x,%d,%d,%d,%d,hWnd,%s As HMENU,GetModuleHandle(0),0)\r\n",
    573574                    spaces,
    574                     pWindowInfo->pChildInfo[i2].ExStyle,
     575                    pChildInfo->ExStyle,
    575576                    temporary,
    576577                    temp2,
    577                     pWindowInfo->pChildInfo[i2].style,
    578                     pWindowInfo->pChildInfo[i2].pos.x,
    579                     pWindowInfo->pChildInfo[i2].pos.y,
    580                     pWindowInfo->pChildInfo[i2].size.cx,
    581                     pWindowInfo->pChildInfo[i2].size.cy,
    582                     pWindowInfo->pChildInfo[i2].IdName);
     578                    pChildInfo->style,
     579                    pChildInfo->pos.x,
     580                    pChildInfo->pos.y,
     581                    pChildInfo->size.cx,
     582                    pChildInfo->size.cy,
     583                    pChildInfo->IdName);
    583584                i+=lstrlen(Command+i);
    584585                HeapDefaultFree(temp2);
    585586                sprintf(Command+i,"%s\tSendMessage(GetDlgItem(hWnd,%s),WM_SETFONT,hFont_%s As WPARAM,0)\r\n",
    586587                    spaces,
    587                     pWindowInfo->pChildInfo[i2].IdName,
     588                    pChildInfo->IdName,
    588589                    pWindowInfo->name);
    589590                i+=lstrlen(Command+i);
    590591
    591                 if(pWindowInfo->pChildInfo[i2].Control==CT_IMAGEBOX){
     592                if(pChildInfo->Control==CT_IMAGEBOX){
    592593                    //イメージ ボックスの場合
    593                     if((pWindowInfo->pChildInfo[i2].style&0x000F)==SS_ICON){
    594                         if(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.type==IMGTYPE_FILE){
    595                             if(strstr(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path,":")||
    596                                 strstr(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path,"\\\\")){
     594                    if((pChildInfo->style&0x000F)==SS_ICON){
     595                        if(pChildInfo->ImageCtrlInfo.type==IMGTYPE_FILE){
     596                            if(strstr(pChildInfo->ImageCtrlInfo.path,":")||
     597                                strstr(pChildInfo->ImageCtrlInfo.path,"\\\\")){
    597598                                sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,\"%s\",IMAGE_ICON,0,0,LR_DEFAULTSIZE or LR_LOADFROMFILE)\r\n",
    598599                                    spaces,
    599600                                    pWindowInfo->name,
    600                                     pWindowInfo->pChildInfo[i2].IdName,
    601                                     pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path);
     601                                    pChildInfo->IdName,
     602                                    pChildInfo->ImageCtrlInfo.path);
    602603                            }
    603604                            else{
     
    623624                                    i+=2;
    624625                                }
    625                                 sprintf(Command+i,"%s\twsprintf(ImageFilePath,\"%%s%s\",ModulePath)\r\n",spaces,pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path);
     626                                sprintf(Command+i,"%s\twsprintf(ImageFilePath,\"%%s%s\",ModulePath)\r\n",spaces,pChildInfo->ImageCtrlInfo.path);
    626627                                i+=lstrlen(Command+i);
    627628                                sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,ImageFilePath,IMAGE_ICON,0,0,LR_DEFAULTSIZE or LR_LOADFROMFILE)\r\n",
    628629                                    spaces,
    629630                                    pWindowInfo->name,
    630                                     pWindowInfo->pChildInfo[i2].IdName);
     631                                    pChildInfo->IdName);
    631632                            }
    632633                            i+=lstrlen(Command+i);
    633634                        }
    634                         else if(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.type==IMGTYPE_RES){
     635                        else if(pChildInfo->ImageCtrlInfo.type==IMGTYPE_RES){
    635636                            sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,%s As *Byte,IMAGE_ICON,0,0,LR_DEFAULTSIZE)\r\n",
    636637                                spaces,
    637638                                pWindowInfo->name,
    638                                 pWindowInfo->pChildInfo[i2].IdName,
    639                                 pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path);
     639                                pChildInfo->IdName,
     640                                pChildInfo->ImageCtrlInfo.path);
    640641                            i+=lstrlen(Command+i);
    641642                        }
    642643                        sprintf(Command+i,"%s\tSendMessage(GetDlgItem(hWnd,%s),STM_SETICON,hImage_%s_%s As WPARAM,0)\r\n",
    643644                            spaces,
    644                             pWindowInfo->pChildInfo[i2].IdName,
     645                            pChildInfo->IdName,
    645646                            pWindowInfo->name,
    646                             pWindowInfo->pChildInfo[i2].IdName);
     647                            pChildInfo->IdName);
    647648                        i+=lstrlen(Command+i);
    648649                    }
    649                     else if((pWindowInfo->pChildInfo[i2].style&0x000F)==SS_BITMAP){
    650                         if(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.type==IMGTYPE_FILE){
    651                             if(strstr(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path,":")||
    652                                 strstr(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path,"\\\\")){
     650                    else if((pChildInfo->style&0x000F)==SS_BITMAP){
     651                        if(pChildInfo->ImageCtrlInfo.type==IMGTYPE_FILE){
     652                            if(strstr(pChildInfo->ImageCtrlInfo.path,":")||
     653                                strstr(pChildInfo->ImageCtrlInfo.path,"\\\\")){
    653654                                sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,\"%s\",IMAGE_BITMAP,0,0,LR_DEFAULTSIZE or LR_LOADFROMFILE)\r\n",
    654655                                    spaces,
    655656                                    pWindowInfo->name,
    656                                     pWindowInfo->pChildInfo[i2].IdName,
    657                                     pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path);
     657                                    pChildInfo->IdName,
     658                                    pChildInfo->ImageCtrlInfo.path);
    658659                            }
    659660                            else{
     
    679680                                    i+=2;
    680681                                }
    681                                 sprintf(Command+i,"%s\twsprintf(ImageFilePath,\"%%s%s\",ModulePath)\r\n",spaces,pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path);
     682                                sprintf(Command+i,"%s\twsprintf(ImageFilePath,\"%%s%s\",ModulePath)\r\n",spaces,pChildInfo->ImageCtrlInfo.path);
    682683                                i+=lstrlen(Command+i);
    683684                                sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,ImageFilePath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE)\r\n",
    684685                                    spaces,
    685686                                    pWindowInfo->name,
    686                                     pWindowInfo->pChildInfo[i2].IdName);
     687                                    pChildInfo->IdName);
    687688                            }
    688689                            i+=lstrlen(Command+i);
    689690                        }
    690                         else if(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.type==IMGTYPE_RES){
     691                        else if(pChildInfo->ImageCtrlInfo.type==IMGTYPE_RES){
    691692                            sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,%s As *Byte,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE)\r\n",
    692693                                spaces,
    693694                                pWindowInfo->name,
    694                                 pWindowInfo->pChildInfo[i2].IdName,
    695                                 pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path);
     695                                pChildInfo->IdName,
     696                                pChildInfo->ImageCtrlInfo.path);
    696697                            i+=lstrlen(Command+i);
    697698                        }
    698699                        sprintf(Command+i,"%s\tSendMessage(GetDlgItem(hWnd,%s),STM_SETIMAGE,IMAGE_BITMAP,hImage_%s_%s As LPARAM)\r\n",
    699700                            spaces,
    700                             pWindowInfo->pChildInfo[i2].IdName,
     701                            pChildInfo->IdName,
    701702                            pWindowInfo->name,
    702                             pWindowInfo->pChildInfo[i2].IdName);
     703                            pChildInfo->IdName);
    703704                        i+=lstrlen(Command+i);
    704705                    }
     
    731732
    732733        //イメージ ボックス用の変数を解放
    733         for(i2=0;i2<pWindowInfo->NumberOfChildWindows;i2++){
    734             if(pWindowInfo->pChildInfo[i2].Control==CT_IMAGEBOX){
    735                 if((pWindowInfo->pChildInfo[i2].style&0x000F)==SS_ICON)
    736                     sprintf(Command+i,"%s\tDestroyIcon(hImage_%s_%s)\r\n",spaces,pWindowInfo->name,pWindowInfo->pChildInfo[i2].IdName);
    737                 else if((pWindowInfo->pChildInfo[i2].style&0x000F)==SS_BITMAP)
    738                     sprintf(Command+i,"%s\tDeleteObject(hImage_%s_%s)\r\n",spaces,pWindowInfo->name,pWindowInfo->pChildInfo[i2].IdName);
     734        BOOST_FOREACH( const CHILDINFO *pChildInfo, pWindowInfo->childWindowInfos )
     735        {
     736            if(pChildInfo->Control==CT_IMAGEBOX){
     737                if((pChildInfo->style&0x000F)==SS_ICON)
     738                    sprintf(Command+i,"%s\tDestroyIcon(hImage_%s_%s)\r\n",spaces,pWindowInfo->name,pChildInfo->IdName);
     739                else if((pChildInfo->style&0x000F)==SS_BITMAP)
     740                    sprintf(Command+i,"%s\tDeleteObject(hImage_%s_%s)\r\n",spaces,pWindowInfo->name,pChildInfo->IdName);
    739741                i+=lstrlen(Command+i);
    740742            }
     
    10051007    BOOST_FOREACH( WindowInfo *pWindowInfo, ProjectInfo.windowInfos )
    10061008    {
    1007         for(i3=0;i3<pWindowInfo->NumberOfChildWindows;i3++){
    1008 
     1009        BOOST_FOREACH( const CHILDINFO *pChildInfo, pWindowInfo->childWindowInfos )
     1010        {
    10091011            //重複チェック
    10101012            for(i6=0,sw1=0;i6<i5;i6++){
    1011                 if(lstrcmpi(ppNames[i6],pWindowInfo->pChildInfo[i3].IdName)==0){
     1013                if(lstrcmpi(ppNames[i6],pChildInfo->IdName)==0){
    10121014                    sw1=1;
    10131015                    break;
     
    10171019
    10181020            ppNames=(char **)HeapReAlloc(hHeap,0,ppNames,sizeof(char *)*(i5+1));
    1019             ppNames[i5]=pWindowInfo->pChildInfo[i3].IdName;
     1021            ppNames[i5]=pChildInfo->IdName;
    10201022            i5++;
    10211023
    1022             sprintf(buffer+i2,"Const %s=%d\r\n",pWindowInfo->pChildInfo[i3].IdName,i4);
     1024            sprintf(buffer+i2,"Const %s=%d\r\n",pChildInfo->IdName,i4);
    10231025            i2+=lstrlen(buffer+i2);
    10241026            i4++;
     
    11041106    BOOST_FOREACH( WindowInfo *pWindowInfo, ProjectInfo.windowInfos )
    11051107    {
    1106         for(i3=0;i3<pWindowInfo->NumberOfChildWindows;i3++){
    1107             if(pWindowInfo->pChildInfo[i3].Control==CT_IMAGEBOX){
    1108                 if((pWindowInfo->pChildInfo[i3].style&0x000F)==SS_ICON||
    1109                     (pWindowInfo->pChildInfo[i3].style&0x000F)==SS_BITMAP){
    1110                     sprintf(buffer+i2,"Dim hImage_%s_%s As HANDLE\r\n",pWindowInfo->name,pWindowInfo->pChildInfo[i3].IdName);
     1108        BOOST_FOREACH( const CHILDINFO *pChildInfo, pWindowInfo->childWindowInfos )
     1109        {
     1110            if(pChildInfo->Control==CT_IMAGEBOX){
     1111                if((pChildInfo->style&0x000F)==SS_ICON||
     1112                    (pChildInfo->style&0x000F)==SS_BITMAP){
     1113                    sprintf(buffer+i2,"Dim hImage_%s_%s As HANDLE\r\n",pWindowInfo->name,pChildInfo->IdName);
    11111114                    i2+=lstrlen(buffer+i2);
    11121115
     
    16271630    extern HANDLE hHeap;
    16281631    extern MDIINFO MdiInfo[MAX_WNDNUM];
    1629     int i,i2,i3,size;
     1632    int i,i2,size;
    16301633    char *buffer,*temporary;
    16311634
     
    16851688        sprintf(buffer+i2,"    FILEPATH  = %s\r\n",pWindowInfo->filepath);
    16861689        i2+=lstrlen(buffer+i2);
    1687         for(i3=0;i3<pWindowInfo->NumberOfChildWindows;i3++){
    1688             temporary=SetCaptionSequence(pWindowInfo->pChildInfo[i3].caption);
     1690        BOOST_FOREACH( const CHILDINFO *pChildInfo, pWindowInfo->childWindowInfos )
     1691        {
     1692            temporary=SetCaptionSequence(pChildInfo->caption);
    16891693            sprintf(buffer+i2,"    ITEM      = %s,%d,%d,%d,%d,\"%s\",&H%08x,&H%08x,%d",
    1690                 pWindowInfo->pChildInfo[i3].IdName,
    1691                 pWindowInfo->pChildInfo[i3].pos.x,pWindowInfo->pChildInfo[i3].pos.y,
    1692                 pWindowInfo->pChildInfo[i3].size.cx,pWindowInfo->pChildInfo[i3].size.cy,
     1694                pChildInfo->IdName,
     1695                pChildInfo->pos.x,pChildInfo->pos.y,
     1696                pChildInfo->size.cx,pChildInfo->size.cy,
    16931697                temporary,
    1694                 pWindowInfo->pChildInfo[i3].style,
    1695                 pWindowInfo->pChildInfo[i3].ExStyle,
    1696                 pWindowInfo->pChildInfo[i3].Control
     1698                pChildInfo->style,
     1699                pChildInfo->ExStyle,
     1700                pChildInfo->Control
    16971701            );
    16981702            i2+=lstrlen(buffer+i2);
    16991703            HeapDefaultFree(temporary);
    1700             if(pWindowInfo->pChildInfo[i3].Control==CT_IMAGEBOX){
    1701                 sprintf(buffer+i2,",%d,\"%s\"",pWindowInfo->pChildInfo[i3].ImageCtrlInfo.type,pWindowInfo->pChildInfo[i3].ImageCtrlInfo.path);
     1704            if(pChildInfo->Control==CT_IMAGEBOX){
     1705                sprintf(buffer+i2,",%d,\"%s\"",pChildInfo->ImageCtrlInfo.type,pChildInfo->ImageCtrlInfo.path);
    17021706                i2+=lstrlen(buffer+i2);
    17031707            }
     
    18291833    int i,i2,i3,i4,i5;
    18301834    char *buffer,temporary[MAX_PATH],*temp2,temp3[MAX_PATH];
    1831     CHILDINFO *pChildInfo;
    18321835
    18331836    buffer=ReadBuffer(path);
     
    18811884                ProjectInfo.windowInfos.back()->name=(char *)HeapAlloc(hHeap,0,i2+1);
    18821885                lstrcpy(ProjectInfo.windowInfos.back()->name,temp2);
    1883 
    1884                 ProjectInfo.windowInfos.back()->NumberOfChildWindows=0;
    1885                 ProjectInfo.windowInfos.back()->pChildInfo=(CHILDINFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
    18861886            }
    18871887            else if(lstrcmpi(temporary,"HANDLE")==0&&i3==1){
     
    19921992            }
    19931993            else if(lstrcmpi(temporary,"ITEM")==0&&i3==1){
    1994                 ProjectInfo.windowInfos.back()->pChildInfo=(CHILDINFO *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,ProjectInfo.windowInfos.back()->pChildInfo,(ProjectInfo.windowInfos.back()->NumberOfChildWindows+1)*sizeof(CHILDINFO));
    1995                 pChildInfo=&ProjectInfo.windowInfos.back()->pChildInfo[ProjectInfo.windowInfos.back()->NumberOfChildWindows];
     1994                CHILDINFO *pChildInfo = new CHILDINFO();
    19961995
    19971996                //ID
     
    20392038                }
    20402039
    2041                 ProjectInfo.windowInfos.back()->NumberOfChildWindows++;
     2040                ProjectInfo.windowInfos.back()->childWindowInfos.push_back( pChildInfo );
    20422041            }
    20432042
     
    22662265    ProjectInfo.windowInfos.back()->type=NewWindow.type;
    22672266
    2268     //子ウィンドウ情報
    2269     ProjectInfo.windowInfos.back()->NumberOfChildWindows=0;
    2270     ProjectInfo.windowInfos.back()->pChildInfo=(CHILDINFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
    2271 
    22722267
    22732268    //メッセージ処理ファイル名
     
    23462341
    23472342    //子ウィンドウのメモリを解放
    2348     for(i=0;i<pWindowInfo->NumberOfChildWindows;i++){
    2349         HeapDefaultFree(pWindowInfo->pChildInfo[i].IdName);
    2350         HeapDefaultFree(pWindowInfo->pChildInfo[i].caption);
    2351     }
    2352     HeapDefaultFree(pWindowInfo->pChildInfo);
     2343    for(i=0;i<pWindowInfo->childWindowInfos.size();i++){
     2344        HeapDefaultFree(pWindowInfo->childWindowInfos[i]->IdName);
     2345        HeapDefaultFree(pWindowInfo->childWindowInfos[i]->caption);
     2346        delete pWindowInfo->childWindowInfos[i];
     2347    }
     2348    pWindowInfo->childWindowInfos.clear();
    23532349
    23542350    //ツリービューから削除
Note: See TracChangeset for help on using the changeset viewer.