Develop and Download Open Source Software

Browse CVS Repository

Diff of /ttssh2/teraterm/source/teraterm/vtdisp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.10 by doda, Tue Jul 10 14:01:46 2007 UTC revision 1.11 by maya, Wed Aug 8 15:56:35 2007 UTC
# Line 144  void dprintf(char *format, ...) Line 144  void dprintf(char *format, ...)
144    
145    va_start(args,format);    va_start(args,format);
146    
147    vsprintf(buffer,format,args);    _vsnprintf_s(buffer,sizeof(buffer),_TRUNCATE,format,args);
148    strcat(buffer,"\n");    strncat_s(buffer,sizeof(buffer),"\n",_TRUNCATE);
149    
150    OutputDebugString(buffer);    OutputDebugString(buffer);
151  }  }
# Line 281  FARPROC GetProcAddressWithDllName(char * Line 281  FARPROC GetProcAddressWithDllName(char *
281      return 0;      return 0;
282  }  }
283    
284  void RandomFile(char *filespec,char *filename)  void RandomFile(char *filespec,char *filename, int destlen)
285  {  {
286    int    i;    int    i;
287    int    file_num;    int    file_num;
# Line 291  void RandomFile(char *filespec,char *fil Line 291  void RandomFile(char *filespec,char *fil
291    HANDLE hFind;    HANDLE hFind;
292    WIN32_FIND_DATA fd;    WIN32_FIND_DATA fd;
293    
   strcpy(filename,"");  
   
294    //絶対パスに変換    //絶対パスに変換
295    if(!GetFullPathName(filespec,MAX_PATH,fullpath,&filePart))    if(!GetFullPathName(filespec,MAX_PATH,fullpath,&filePart))
296      return;      return;
# Line 342  void RandomFile(char *filespec,char *fil Line 340  void RandomFile(char *filespec,char *fil
340    FindClose(hFind);    FindClose(hFind);
341    
342    //ディレクトリ取得    //ディレクトリ取得
343    ZeroMemory(filename,MAX_PATH);    ZeroMemory(filename,destlen);
344    strncpy(filename,fullpath,filePart - fullpath);    {
345    strcat(filename,fd.cFileName);      int tmplen;
346        char *tmp;
347        tmplen = filePart - fullpath + 1;
348        tmp = (char *)_alloca(tmplen);
349        strncpy_s(tmp,tmplen,fullpath,filePart - fullpath);
350        strncpy_s(filename,destlen,tmp,_TRUNCATE);
351      }
352      strncat_s(filename,destlen,fd.cFileName,_TRUNCATE);
353  }  }
354    
355  BOOL LoadPictureWithSPI(char *nameSPI,char *nameFile,unsigned char *bufFile,long sizeFile,HLOCAL *hbuf,HLOCAL *hbmi)  BOOL LoadPictureWithSPI(char *nameSPI,char *nameFile,unsigned char *bufFile,long sizeFile,HLOCAL *hbuf,HLOCAL *hbmi)
# Line 523  void BGPreloadPicture(BGSrc *src) Line 528  void BGPreloadPicture(BGSrc *src)
528    if(hFind != INVALID_HANDLE_VALUE && filePart)    if(hFind != INVALID_HANDLE_VALUE && filePart)
529    {    {
530      //ディレクトリ取得      //ディレクトリ取得
531      ZeroMemory(spiPath,MAX_PATH);      ExtractDirName(filespec, spiPath);
532      strncpy(spiPath,filespec,filePart - filespec);      AppendSlash(spiPath, sizeof(spiPath));
533    
534      do{      do{
535        HLOCAL hbuf,hbmi;        HLOCAL hbuf,hbmi;
# Line 535  void BGPreloadPicture(BGSrc *src) Line 540  void BGPreloadPicture(BGSrc *src)
540        if(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)        if(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
541          continue;          continue;
542    
543        strcpy(spiFileName,spiPath);        strncpy_s(spiFileName, sizeof(spiFileName), spiPath, _TRUNCATE);
544        strcat(spiFileName,fd.cFileName);        strncat_s(spiFileName, sizeof(spiFileName), fd.cFileName, _TRUNCATE);
545    
546        if(LoadPictureWithSPI(spiFileName,src->file,fileBuf,fileSize,&hbuf,&hbmi))        if(LoadPictureWithSPI(spiFileName,src->file,fileBuf,fileSize,&hbuf,&hbmi))
547        {        {
# Line 551  void BGPreloadPicture(BGSrc *src) Line 556  void BGPreloadPicture(BGSrc *src)
556          LocalFree(hbmi);          LocalFree(hbmi);
557          LocalFree(hbuf);          LocalFree(hbuf);
558            
559          strcpy(src->file,src->fileTmp);          strncpy_s(src->file, sizeof(src->file),src->fileTmp, _TRUNCATE);
560    
561          break;          break;
562        }        }
# Line 588  void BGGetWallpaperInfo(WallpaperInfo *w Line 593  void BGGetWallpaperInfo(WallpaperInfo *w
593    HKEY hKey;    HKEY hKey;
594    
595    wi->pattern = BG_CENTER;    wi->pattern = BG_CENTER;
596    strcpy(wi->filename,"");    strncpy_s(wi->filename, sizeof(wi->filename),"", _TRUNCATE);
597    
598    //レジストリキーのオープン    //レジストリキーのオープン
599    if(RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_READ, &hKey) != ERROR_SUCCESS)    if(RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
# Line 962  COLORREF BGGetColor(char *name,COLORREF Line 967  COLORREF BGGetColor(char *name,COLORREF
967    unsigned int r,g,b;    unsigned int r,g,b;
968    char colorstr[256],defstr[256];    char colorstr[256],defstr[256];
969    
970    sprintf(defstr,"%d,%d,%d",GetRValue(defcolor),GetGValue(defcolor),GetBValue(defcolor));    _snprintf_s(defstr,sizeof(defstr),_TRUNCATE,"%d,%d,%d",GetRValue(defcolor),GetGValue(defcolor),GetBValue(defcolor));
971    
972    GetPrivateProfileString(BG_SECTION,name,defstr,colorstr,255,file);    GetPrivateProfileString(BG_SECTION,name,defstr,colorstr,255,file);
973    
# Line 980  BG_PATTERN BGGetStrIndex(char *name,BG_P Line 985  BG_PATTERN BGGetStrIndex(char *name,BG_P
985    
986    def %= nList;    def %= nList;
987    
988    strcpy(defstr,strList[def]);    strncpy_s(defstr, sizeof(defstr),strList[def], _TRUNCATE);
989    GetPrivateProfileString(BG_SECTION,name,defstr,str,64,file);    GetPrivateProfileString(BG_SECTION,name,defstr,str,64,file);
990    
991    for(i = 0;i < nList;i++)    for(i = 0;i < nList;i++)
# Line 1055  void BGReadIniFile(char *file) Line 1060  void BGReadIniFile(char *file)
1060    BGDest.color   = BGGetColor("BGPictureBaseColor",BGSrc1.color,file);    BGDest.color   = BGGetColor("BGPictureBaseColor",BGSrc1.color,file);
1061    
1062    GetPrivateProfileString(BG_SECTION,"BGPictureFile",BGSrc1.file,path,MAX_PATH,file);    GetPrivateProfileString(BG_SECTION,"BGPictureFile",BGSrc1.file,path,MAX_PATH,file);
1063    RandomFile(path,BGDest.file);    RandomFile(path,BGDest.file,sizeof(BGDest.file));
1064    
1065    BGSrc1.alpha   = 255 - GetPrivateProfileInt(BG_SECTION,"BGPictureTone",255 - BGSrc1.alpha,file);    BGSrc1.alpha   = 255 - GetPrivateProfileInt(BG_SECTION,"BGPictureTone",255 - BGSrc1.alpha,file);
1066    
# Line 1075  void BGReadIniFile(char *file) Line 1080  void BGReadIniFile(char *file)
1080    BGSrc1.color     = BGGetColor("BGSrc1Color",BGSrc1.color,file);    BGSrc1.color     = BGGetColor("BGSrc1Color",BGSrc1.color,file);
1081    
1082    GetPrivateProfileString(BG_SECTION,"BGSrc1File",BGSrc1.file,path,MAX_PATH,file);    GetPrivateProfileString(BG_SECTION,"BGSrc1File",BGSrc1.file,path,MAX_PATH,file);
1083    RandomFile(path,BGSrc1.file);    RandomFile(path,BGSrc1.file,sizeof(BGSrc1.file));
1084        
1085    //Src2 の読み出し    //Src2 の読み出し
1086    BGSrc2.type      = BGGetType("BGSrc2Type",BGSrc2.type,file);    BGSrc2.type      = BGGetType("BGSrc2Type",BGSrc2.type,file);
# Line 1085  void BGReadIniFile(char *file) Line 1090  void BGReadIniFile(char *file)
1090    BGSrc2.color     = BGGetColor("BGSrc2Color",BGSrc2.color,file);    BGSrc2.color     = BGGetColor("BGSrc2Color",BGSrc2.color,file);
1091    
1092    GetPrivateProfileString(BG_SECTION,"BGSrc2File",BGSrc2.file,path,MAX_PATH,file);    GetPrivateProfileString(BG_SECTION,"BGSrc2File",BGSrc2.file,path,MAX_PATH,file);
1093    RandomFile(path,BGSrc2.file);    RandomFile(path,BGSrc2.file,sizeof(BGSrc2.file));
1094    
1095    //Dest の読み出し    //Dest の読み出し
1096    BGDest.type      = BGGetType("BGDestType",BGDest.type,file);    BGDest.type      = BGGetType("BGDestType",BGDest.type,file);
# Line 1094  void BGReadIniFile(char *file) Line 1099  void BGReadIniFile(char *file)
1099    BGDest.color     = BGGetColor("BGDestColor",BGDest.color,file);    BGDest.color     = BGGetColor("BGDestColor",BGDest.color,file);
1100    
1101    GetPrivateProfileString(BG_SECTION,"BGDestFile",BGDest.file,path,MAX_PATH,file);    GetPrivateProfileString(BG_SECTION,"BGDestFile",BGDest.file,path,MAX_PATH,file);
1102    RandomFile(path,BGDest.file);    RandomFile(path,BGDest.file,sizeof(BGDest.file));
1103    
1104    //その他読み出し    //その他読み出し
1105    BGReverseTextAlpha = GetPrivateProfileInt(BG_SECTION,"BGReverseTextAlpha",BGReverseTextAlpha,file);    BGReverseTextAlpha = GetPrivateProfileInt(BG_SECTION,"BGReverseTextAlpha",BGReverseTextAlpha,file);
# Line 1184  void BGInitialize(void) Line 1189  void BGInitialize(void)
1189    ts.EtermLookfeel.BGNoCopyBits = BGGetOnOff("BGFlickerlessMove" ,TRUE ,ts.SetupFName);    ts.EtermLookfeel.BGNoCopyBits = BGGetOnOff("BGFlickerlessMove" ,TRUE ,ts.SetupFName);
1190    
1191    GetPrivateProfileString(BG_SECTION,"BGSPIPath","plugin",BGSPIPath,MAX_PATH,ts.SetupFName);    GetPrivateProfileString(BG_SECTION,"BGSPIPath","plugin",BGSPIPath,MAX_PATH,ts.SetupFName);
1192    strcpy(ts.EtermLookfeel.BGSPIPath, BGSPIPath);    strncpy_s(ts.EtermLookfeel.BGSPIPath, sizeof(ts.EtermLookfeel.BGSPIPath), BGSPIPath, _TRUNCATE);
1193    
1194    //コンフィグファイルの決定    //コンフィグファイルの決定
1195    GetPrivateProfileString(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName);    GetPrivateProfileString(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName);
1196    strcpy(ts.EtermLookfeel.BGThemeFile, path);    strncpy_s(ts.EtermLookfeel.BGThemeFile, sizeof(ts.EtermLookfeel.BGThemeFile), path, _TRUNCATE);
1197    
1198    if(!BGEnable)    if(!BGEnable)
1199      return;      return;
# Line 1205  void BGInitialize(void) Line 1210  void BGInitialize(void)
1210        
1211  #if 0  #if 0
1212    GetPrivateProfileString(BG_SECTION,"BGSPIPath","plugin",BGSPIPath,MAX_PATH,ts.SetupFName);    GetPrivateProfileString(BG_SECTION,"BGSPIPath","plugin",BGSPIPath,MAX_PATH,ts.SetupFName);
1213    strcpy(ts.EtermLookfeel.BGSPIPath, BGSPIPath);    strncpy_s(ts.EtermLookfeel.BGSPIPath, sizeof(ts.EtermLookfeel.BGSPIPath), BGSPIPath, _TRUNCATE);
1214  #endif  #endif
1215    
1216    //テンポラリーファイル名を生成    //テンポラリーファイル名を生成
# Line 1219  void BGInitialize(void) Line 1224  void BGInitialize(void)
1224    BGDest.pattern   = BG_STRETCH;    BGDest.pattern   = BG_STRETCH;
1225    BGDest.color     = RGB(0,0,0);    BGDest.color     = RGB(0,0,0);
1226    BGDest.antiAlias = TRUE;    BGDest.antiAlias = TRUE;
1227    strcpy(BGDest.file,"");    strncpy_s(BGDest.file, sizeof(BGDest.file),"", _TRUNCATE);
1228    
1229    BGSrc1.type      = BG_WALLPAPER;    BGSrc1.type      = BG_WALLPAPER;
1230    BGSrc1.pattern   = BG_STRETCH;    BGSrc1.pattern   = BG_STRETCH;
1231    BGSrc1.color     = RGB(255,255,255);    BGSrc1.color     = RGB(255,255,255);
1232    BGSrc1.antiAlias = TRUE;    BGSrc1.antiAlias = TRUE;
1233    BGSrc1.alpha     = 255;    BGSrc1.alpha     = 255;
1234    strcpy(BGSrc1.file,"");    strncpy_s(BGSrc1.file, sizeof(BGSrc1.file),"", _TRUNCATE);
1235    
1236    BGSrc2.type      = BG_COLOR;    BGSrc2.type      = BG_COLOR;
1237    BGSrc2.pattern   = BG_STRETCH;    BGSrc2.pattern   = BG_STRETCH;
1238    BGSrc2.color     = RGB(0,0,0);    BGSrc2.color     = RGB(0,0,0);
1239    BGSrc2.antiAlias = TRUE;    BGSrc2.antiAlias = TRUE;
1240    BGSrc2.alpha     = 128;    BGSrc2.alpha     = 128;
1241    strcpy(BGSrc2.file,"");    strncpy_s(BGSrc2.file, sizeof(BGSrc2.file),"", _TRUNCATE);
1242    
1243    BGReverseTextAlpha = 255;    BGReverseTextAlpha = 255;
1244    
# Line 1242  void BGInitialize(void) Line 1247  void BGInitialize(void)
1247    
1248    //コンフィグファイルの決定    //コンフィグファイルの決定
1249    GetPrivateProfileString(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName);    GetPrivateProfileString(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName);
1250    RandomFile(path,config_file);    RandomFile(path,config_file,sizeof(config_file));
1251    
1252    //設定のオーバーライド    //設定のオーバーライド
1253    if(strcmp(config_file,""))    if(strcmp(config_file,""))
# Line 1261  void BGInitialize(void) Line 1266  void BGInitialize(void)
1266    }    }
1267    
1268    //SPI のパスを整形    //SPI のパスを整形
1269    AppendSlash(BGSPIPath);    AppendSlash(BGSPIPath,sizeof(BGSPIPath));
1270    strcat(BGSPIPath,"*");    strncat_s(BGSPIPath,sizeof(BGSPIPath),"*",_TRUNCATE);
1271    
1272    //壁紙 or 背景をプリロード    //壁紙 or 背景をプリロード
1273    BGPreloadSrc(&BGDest);    BGPreloadSrc(&BGDest);
# Line 1560  void SetLogFont() Line 1565  void SetLogFont()
1565    VTlf.lfClipPrecision = CLIP_CHARACTER_PRECIS;    VTlf.lfClipPrecision = CLIP_CHARACTER_PRECIS;
1566    VTlf.lfQuality       = DEFAULT_QUALITY;    VTlf.lfQuality       = DEFAULT_QUALITY;
1567    VTlf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;    VTlf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
1568    strcpy(VTlf.lfFaceName,ts.VTFont);    strncpy_s(VTlf.lfFaceName, sizeof(VTlf.lfFaceName),ts.VTFont, _TRUNCATE);
1569  }  }
1570    
1571  void ChangeFont()  void ChangeFont()
# Line 1621  void ChangeFont() Line 1626  void ChangeFont()
1626    VTlf.lfHeight = FontHeight;    VTlf.lfHeight = FontHeight;
1627    VTlf.lfCharSet = SYMBOL_CHARSET;    VTlf.lfCharSet = SYMBOL_CHARSET;
1628    
1629    strcpy(VTlf.lfFaceName,"Tera Special");    strncpy_s(VTlf.lfFaceName, sizeof(VTlf.lfFaceName),"Tera Special", _TRUNCATE);
1630    VTFont[AttrSpecial] = CreateFontIndirect(&VTlf);    VTFont[AttrSpecial] = CreateFontIndirect(&VTlf);
1631    VTFont[AttrSpecial | AttrBold] = VTFont[AttrSpecial];    VTFont[AttrSpecial | AttrBold] = VTFont[AttrSpecial];
1632    VTFont[AttrSpecial | AttrUnder] = VTFont[AttrSpecial];    VTFont[AttrSpecial | AttrUnder] = VTFont[AttrSpecial];
# Line 2814  void DispSetupFontDlg() Line 2819  void DispSetupFontDlg()
2819    FreeTTDLG();    FreeTTDLG();
2820    if (! Ok) return;    if (! Ok) return;
2821    
2822    strcpy(ts.VTFont,VTlf.lfFaceName);    strncpy_s(ts.VTFont, sizeof(ts.VTFont),VTlf.lfFaceName, _TRUNCATE);
2823    ts.VTFontSize.x = VTlf.lfWidth;    ts.VTFontSize.x = VTlf.lfWidth;
2824    ts.VTFontSize.y = VTlf.lfHeight;    ts.VTFontSize.y = VTlf.lfHeight;
2825    ts.VTFontCharSet = VTlf.lfCharSet;    ts.VTFontCharSet = VTlf.lfCharSet;
# Line 2892  void DispSetActive(BOOL ActiveFlag) Line 2897  void DispSetActive(BOOL ActiveFlag)
2897    
2898  /*  /*
2899   * $Log$   * $Log$
2900     * Revision 1.11  2007/08/08 15:56:35  maya
2901     * 安全な関数を使用するように変更した。
2902     *
2903   * Revision 1.10  2007/07/10 14:01:46  doda   * Revision 1.10  2007/07/10 14:01:46  doda
2904   * ウィンドウの横幅をある程度より小さくすると、それ以降マウスでのウィンドウサイズ変更が出来なくなる問題を修正した。   * ウィンドウの横幅をある程度より小さくすると、それ以降マウスでのウィンドウサイズ変更が出来なくなる問題を修正した。
2905   *   *

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26