Ignore:
Timestamp:
Jun 18, 2008, 11:03:59 PM (16 years ago)
Author:
dai_9181
Message:

FileManager周りをリファクタリング

File:
1 edited

Legend:

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

    r653 r655  
    2222                hTreeItem = pobj_FileTree->GetSelectedItem();
    2323
    24                 std::string tempPath = projectInfo.pobj_DBFileInfo->GetPath(hTreeItem);
     24                std::string tempPath = projectInfo.fileSystem.root.FindFile( hTreeItem ).GetRelationalPath();
    2525
    2626                //絶対パス、相対パスを表示
     
    107107                        hTreeItem=TreeView_GetSelection(hwnd);
    108108
    109                         std::string tempPath = projectInfo.pobj_DBFileInfo->GetPath(hTreeItem);
     109                        std::string tempPath = projectInfo.fileSystem.root.FindFile( hTreeItem ).GetRelationalPath();
    110110
    111111                        lstrcpy( temporary, tempPath.c_str() );
     
    194194}
    195195
    196 void FileListTreeViewCtrl::Reset( CDBFileInfo *pFileInfos )
    197 {
     196void FileListTreeViewCtrl::Reset( HTREEITEM hParent, ActiveBasic::PM::FM::Folder &folder )
     197{
     198    char temporary[MAX_PATH],temp2[MAX_PATH];
     199
     200    lstrcpy( temporary, folder.GetName().c_str() );
     201
    198202    TV_INSERTSTRUCT tv;
    199 
    200     this->DeleteAllItems();
    201 
    202203    tv.hInsertAfter=TVI_SORT;
    203204    tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
    204 
    205     tv.hParent=TVI_ROOT;
     205    tv.hParent = hParent;
    206206    tv.item.iImage=0;
    207207    tv.item.iSelectedImage=0;
    208     tv.item.pszText="Source Files";
    209     tv.hParent = this->InsertItem( &tv );
    210 
    211     int i;
    212     char temporary[MAX_PATH],temp2[MAX_PATH];
    213     for(i=0;i<pFileInfos->iNum;i++){
    214         _splitpath(pFileInfos->ppobj_FileInfo[i]->GetPath().c_str(),0,0,temporary,temp2);
     208    tv.item.pszText = temporary;
     209    HTREEITEM hFolder = this->InsertItem( &tv );
     210
     211    BOOST_FOREACH( ActiveBasic::PM::FM::Folder &childFolder, folder.folders )
     212    {
     213        this->Reset( hFolder, childFolder );
     214    }
     215
     216    BOOST_FOREACH( ActiveBasic::PM::FM::File &file, folder.files )
     217    {
     218        _splitpath(file.GetRelationalPath().c_str(),0,0,temporary,temp2);
    215219        lstrcat(temporary,temp2);
     220
     221        TV_INSERTSTRUCT tv;
     222        tv.hInsertAfter=TVI_SORT;
     223        tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
     224        tv.hParent = hFolder;
    216225        tv.item.iImage=2;
    217226        tv.item.iSelectedImage=2;
    218227        tv.item.pszText=temporary;
    219         pFileInfos->ppobj_FileInfo[i]->m_hTreeItem = this->InsertItem( &tv );
    220     }
    221 }
     228        file.SetTreeViewHandle( this->InsertItem( &tv ) );
     229    }
     230}
     231void FileListTreeViewCtrl::Reset( ActiveBasic::PM::FM::FileSystem &fileSystem )
     232{
     233    this->DeleteAllItems();
     234
     235    this->Reset( TVI_ROOT, fileSystem.root );
     236}
Note: See TracChangeset for help on using the changeset viewer.