Changeset 622 in dev for trunk/ab5.0/abdev/abdev


Ignore:
Timestamp:
May 21, 2008, 1:16:21 PM (16 years ago)
Author:
dai_9181
Message:

ResourceManagerクラスを追加。既存のリソース管理モジュールの置き換えを行った。

Location:
trunk/ab5.0/abdev/abdev
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/abdev/Common.h

    r620 r622  
    664664char *ReadBuffer( const std::string &path );
    665665char *ReadBuffer_NonErrMsg( const std::string &path );
    666 _int8 WriteBuffer(char *path,char *buffer,int length, bool isEnableError = true);
    667 _int8 WriteBuffer_NonErrMsg(char *path,char *buffer,int length);
     666_int8 WriteBuffer(const std::string &path,char *buffer,int length, bool isEnableError = true);
     667_int8 WriteBuffer_NonErrMsg(const std::string &path,char *buffer,int length);
    668668void GetRelationalPath(char *path,char *dir);
    669669void GetFullPath(char *path,const char *dir);
  • trunk/ab5.0/abdev/abdev/FileOperation.cpp

    r621 r622  
    5757    return buffer;
    5858}
    59 _int8 WriteBuffer(char *path,char *buffer,int length, bool isEnableError){
     59_int8 WriteBuffer(const std::string &path,char *buffer,int length, bool isEnableError){
    6060    HANDLE hFile;
    6161    DWORD dw;
    62     hFile=CreateFile(path,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
     62    hFile=CreateFile(path.c_str(),GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
    6363    if(hFile==INVALID_HANDLE_VALUE){
    6464        char temporary[MAX_PATH];
     
    7575    return 1;
    7676}
    77 _int8 WriteBuffer_NonErrMsg(char *path,char *buffer,int length){
     77_int8 WriteBuffer_NonErrMsg(const std::string &path,char *buffer,int length){
    7878    return WriteBuffer( path, buffer, length, false );
    7979}
  • trunk/ab5.0/abdev/abdev/Resource.cpp

    r620 r622  
    1717    HANDLE hFile;
    1818
    19     lstrcpy(temporary,projectInfo.ResourceFileName);
    20     lstrcpy( temporary, projectInfo.GetWorkDir().GetFullPath( temporary ).c_str() );
    21 
    22     hFile=CreateFile(temporary,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
     19    hFile=CreateFile( projectInfo.GetResourceFileFullPath().c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
    2320    if(hFile==INVALID_HANDLE_VALUE) return;
    2421    i2=GetFileSize(hFile,NULL);
     
    123120    }
    124121
    125     //リソースが空の場合
    126     if(projectInfo.res.NumberOfCursorRes==0&&
    127         projectInfo.res.NumberOfBitmapRes==0&&
    128         projectInfo.res.NumberOfIconRes==0)
    129         projectInfo.ResourceFileName[0]=0;
    130 
    131122    HeapDefaultFree(buffer);
    132123}
     
    137128    int i2,i3;
    138129    char temporary[MAX_PATH];
    139 
    140     if(!projectInfo.ResourceFileName[0])
    141         sprintf(projectInfo.ResourceFileName,"%s.rc",projectInfo.GetName().c_str());
    142130
    143131    //"カーソル ファイルを指定してください"
     
    242230    char temporary[MAX_PATH];
    243231
    244     if(!projectInfo.ResourceFileName[0])
    245         sprintf(projectInfo.ResourceFileName,"%s.rc",projectInfo.GetName().c_str());
    246 
    247232    //"ビットマップ ファイルを指定してください"
    248233    if(!GetFilePathDialog(hOwner,temporary,BitmapFileFilter,STRING_FILEOPENTITLE_BITMAP,TRUE)) return;
     
    355340    int i2,i3;
    356341    char temporary[MAX_PATH];
    357 
    358     if(!projectInfo.ResourceFileName[0])
    359         sprintf(projectInfo.ResourceFileName,"%s.rc",projectInfo.GetName().c_str());
    360342
    361343    //"アイコン ファイルを指定してください"
  • trunk/ab5.0/abdev/abdev/include/ProjectManager/ProjectManager.h

    r621 r622  
    2727    }
    2828
     29    const std::string GetResourceFileFullPath() const
     30    {
     31        return this->GetWorkDir().GetFullPath( this->GetName() + ".rc" );
     32    }
     33
    2934    bool IsOpened() const
    3035    {
     
    4045
    4146    CDBFileInfo *pobj_DBFileInfo;
    42 
    43     char ResourceFileName[MAX_PATH];
    4447
    4548    int NumberOfMenu;
  • trunk/ab5.0/abdev/abdev/src/ProjectManager/ProjectManager.cpp

    r621 r622  
    196196                    temporary[i2]=buffer[i];
    197197                }
    198                 if(temporary[0]!='\0'&&(!(temporary[0]=='0'&&temporary[1]=='\0'))){
    199                     lstrcpy(this->ResourceFileName,temporary);
    200                     GetResourceData();
    201                 }
    202                 else{
    203                     sprintf(this->ResourceFileName,"%s.rc",this->GetName().c_str());
    204                 }
     198
     199                // このパラメータは使用しなくなった
    205200            }
    206201            else if(lstrcmpi(temporary,"SOURCE")==0&&buffer[i]=='\r'&&buffer[i+1]=='\n'){
     
    244239        }
    245240        sprintf(this->lpszOutput_Debug,".\\%s_debug.exe",this->GetName().c_str());
     241    }
     242
     243    // リソースを読み込む
     244    Jenga::Common::Path resourcePath( projectInfo.GetResourceFileFullPath() );
     245    if( resourcePath.IsExistFile() )
     246    {
     247        GetResourceData();
    246248    }
    247249
     
    347349    sprintf(buffer+i2,"#DEBUG_EXE_PATH=%s\r\n\r\n",this->szExePath);
    348350    i2+=lstrlen(buffer+i2);
    349     if(this->ResourceFileName[0]){
    350         sprintf(buffer+i2,"#RESOURCE=%s\r\n\r\n",this->ResourceFileName);
    351         i2+=lstrlen(buffer+i2);
    352     }
    353     else{
    354         lstrcpy(buffer+i2,"#RESOURCE=0\r\n\r\n");
    355         i2+=lstrlen(buffer+i2);
    356     }
    357351    sprintf(buffer+i2,"#SOURCE\r\n");
    358352    i2+=lstrlen(buffer+i2);
     
    369363    //////////////////////////////////
    370364    // リソースファイル(*.rc、resource.ab)を作成
    371     if(this->ResourceFileName[0]){
     365    {
    372366        i2=0;
    373367        i3=101;
     
    392386
    393387        //保存(resource.ab)
    394         lstrcpy(temporary,"resource.ab");
    395         lstrcpy( temporary, this->GetWorkDir().GetFullPath( temporary ).c_str() );
    396         WriteBuffer(temporary,buffer,i2);
     388        WriteBuffer(this->GetWorkDir().GetFullPath( "resource.ab" ),buffer,i2);
    397389
    398390        i2=0;
     
    424416
    425417        //保存
    426         lstrcpy(temporary,this->ResourceFileName);
    427         lstrcpy( temporary, this->GetWorkDir().GetFullPath( temporary ).c_str() );
    428         WriteBuffer(temporary,buffer,i2);
     418        WriteBuffer(this->GetResourceFileFullPath(),buffer,i2);
    429419    }
    430420
     
    498488        i2+=lstrlen(buffer+i2);
    499489    }
    500     if(this->ResourceFileName[0]){
    501         //リソースファイルが含まれる場合
    502         lstrcpy(buffer+i2,"\r\n");
    503         i2+=lstrlen(buffer+i2);
    504         lstrcpy(buffer+i2,"'リソースファイル\r\n");
    505         i2+=lstrlen(buffer+i2);
    506         lstrcpy(buffer+i2,"#include \"resource.ab\"\r\n");
    507         i2+=lstrlen(buffer+i2);
    508         sprintf(buffer+i2,"#resource \"%s.rc\"\r\n",this->GetName().c_str());
    509         i2+=lstrlen(buffer+i2);
    510     }
     490
     491    //リソースファイル
     492    lstrcpy(buffer+i2,"\r\n");
     493    i2+=lstrlen(buffer+i2);
     494    lstrcpy(buffer+i2,"'リソースファイル\r\n");
     495    i2+=lstrlen(buffer+i2);
     496    lstrcpy(buffer+i2,"#include \"resource.ab\"\r\n");
     497    i2+=lstrlen(buffer+i2);
     498    sprintf(buffer+i2,"#resource \"%s.rc\"\r\n",this->GetName().c_str());
     499    i2+=lstrlen(buffer+i2);
    511500
    512501    //保存
Note: See TracChangeset for help on using the changeset viewer.