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.2 by yutakakn, Sat Jan 8 15:20:15 2005 UTC revision 1.3 by yutakakn, Thu Feb 3 14:36:16 2005 UTC
# Line 25  HFONT VTFont[AttrFontMask+1]; Line 25  HFONT VTFont[AttrFontMask+1];
25  int FontHeight, FontWidth, ScreenWidth, ScreenHeight;  int FontHeight, FontWidth, ScreenWidth, ScreenHeight;
26  BOOL AdjustSize;  BOOL AdjustSize;
27  BOOL DontChangeSize=FALSE;  BOOL DontChangeSize=FALSE;
28    #ifdef ALPHABLEND_TYPE2
29    static int CRTWidth, CRTHeight;
30    #endif
31  int CursorX, CursorY;  int CursorX, CursorY;
32  /* Virtual screen region */  /* Virtual screen region */
33  RECT VirtualScreen;  RECT VirtualScreen;
# Line 59  static int dScroll = 0; Line 62  static int dScroll = 0;
62  static int SRegionTop;  static int SRegionTop;
63  static int SRegionBottom;  static int SRegionBottom;
64    
65    #ifdef ALPHABLEND_TYPE2
66    //<!--by AKASI
67    #include "ttlib.h"
68    #include <stdio.h>
69    #include <time.h>
70    
71    #define BG_SECTION "BG"
72    
73    typedef enum _BG_TYPE    {BG_COLOR = 0,BG_PICTURE,BG_WALLPAPER} BG_TYPE;
74    typedef enum _BG_PATTERN {BG_STRETCH = 0,BG_TILE,BG_CENTER,BG_FIT_WIDTH,BG_FIT_HEIGHT,BG_AUTOFIT} BG_PATTERN;
75    
76    typedef struct _BGSrc
77    {
78      HDC        hdc;
79      BG_TYPE    type;
80      BG_PATTERN pattern;
81      BOOL       antiAlias;
82      COLORREF   color;
83      int        alpha;
84      int        width;
85      int        height;
86      char       file[MAX_PATH];
87      char       fileTmp[MAX_PATH];
88    }BGSrc;
89    
90    BGSrc BGDest;
91    BGSrc BGSrc1;
92    BGSrc BGSrc2;
93    
94    int  BGEnable;
95    int  BGReverseTextAlpha;
96    int  BGUseAlphaBlendAPI;
97    BOOL BGNoFrame;
98    BOOL BGFastSizeMove;
99    
100    char BGSPIPath[MAX_PATH];
101    
102    COLORREF BGVTColor[2];
103    COLORREF BGVTBoldColor[2];
104    COLORREF BGVTBlinkColor[2];
105    
106    RECT BGPrevRect;
107    BOOL BGReverseText;
108    
109    BOOL   BGNoCopyBits;
110    BOOL   BGInSizeMove;
111    HBRUSH BGBrushInSizeMove;
112    
113    HDC hdcBGWork;
114    HDC hdcBGBuffer;
115    HDC hdcBG;
116    
117    typedef struct tagWallpaperInfo
118    {
119      char filename[MAX_PATH];
120      int  pattern;
121    }WallpaperInfo;
122    
123    typedef struct _BGBLENDFUNCTION
124    {
125        BYTE     BlendOp;
126        BYTE     BlendFlags;
127        BYTE     SourceConstantAlpha;
128        BYTE     AlphaFormat;
129    }BGBLENDFUNCTION;
130    
131    BOOL (FAR WINAPI *BGAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BGBLENDFUNCTION);
132    BOOL (FAR WINAPI *BGEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
133    
134    
135    //便利関数☆
136    
137    void dprintf(char *format, ...)
138    {
139      va_list args;
140      char    buffer[1024];
141    
142      va_start(args,format);
143    
144      vsprintf(buffer,format,args);
145      strcat(buffer,"\n");
146    
147      OutputDebugString(buffer);
148    }
149    
150    HBITMAP CreateScreenCompatibleBitmap(int width,int height)
151    {
152      HDC     hdc;
153      HBITMAP hbm;
154    
155      #ifdef _DEBUG
156        dprintf("CreateScreenCompatibleBitmap : width = %d height = %d",width,height);
157      #endif
158    
159      hdc = GetDC(NULL);
160    
161      hbm = CreateCompatibleBitmap(hdc,width,height);
162    
163      ReleaseDC(NULL,hdc);
164    
165      #ifdef _DEBUG
166        if(!hbm)
167          dprintf("CreateScreenCompatibleBitmap : fail in CreateCompatibleBitmap");
168      #endif
169    
170      return hbm;
171    }
172    
173    HBITMAP CreateDIB24BPP(int width,int height,unsigned char **buf,int *lenBuf)
174    {
175      HDC        hdc;
176      HBITMAP    hbm;
177      BITMAPINFO bmi;
178    
179      #ifdef _DEBUG
180        dprintf("CreateDIB24BPP : width = %d height = %d",width,height);
181      #endif
182    
183      if(!width || !height)
184        return NULL;
185    
186      ZeroMemory(&bmi,sizeof(bmi));
187    
188      *lenBuf = ((width * 3 + 3) & ~3) * height;
189    
190      bmi.bmiHeader.biSize        = sizeof(bmi.bmiHeader);
191      bmi.bmiHeader.biWidth       = width;
192      bmi.bmiHeader.biHeight      = height;
193      bmi.bmiHeader.biPlanes      = 1;
194      bmi.bmiHeader.biBitCount    = 24;
195      bmi.bmiHeader.biSizeImage   = *lenBuf;
196      bmi.bmiHeader.biCompression = BI_RGB;
197    
198      hdc = GetDC(NULL);
199    
200      hbm = CreateDIBSection(hdc,&bmi,DIB_RGB_COLORS,(void**)buf,NULL,0);
201    
202      ReleaseDC(NULL,hdc);
203    
204      return hbm;
205    }
206    
207    HDC  CreateBitmapDC(HBITMAP hbm)
208    {
209      HDC hdc;
210    
211      #ifdef _DEBUG
212        dprintf("CreateBitmapDC : hbm = %x",hbm);
213      #endif
214    
215      hdc = CreateCompatibleDC(NULL);
216    
217      SaveDC(hdc);
218      SelectObject(hdc,hbm);
219    
220      return hdc;
221    }
222    
223    void DeleteBitmapDC(HDC *hdc)
224    {
225      HBITMAP hbm;
226    
227      #ifdef _DEBUG
228        dprintf("DeleteBitmapDC : *hdc = %x",hdc);
229      #endif
230    
231      if(!hdc)
232        return;
233    
234      if(!(*hdc))
235        return;
236    
237      hbm = GetCurrentObject(*hdc,OBJ_BITMAP);
238    
239      RestoreDC(*hdc,-1);
240      DeleteObject(hbm);
241      DeleteDC(*hdc);
242    
243      *hdc = 0;
244    }
245    
246    void FillBitmapDC(HDC hdc,COLORREF color)
247    {
248      HBITMAP hbm;
249      BITMAP  bm;
250      RECT    rect;
251      HBRUSH  hBrush;
252    
253      #ifdef _DEBUG
254        dprintf("FillBitmapDC : hdc = %x color = %x",hdc,color);
255      #endif
256    
257      if(!hdc)
258        return;
259    
260      hbm = GetCurrentObject(hdc,OBJ_BITMAP);
261      GetObject(hbm,sizeof(bm),&bm);
262    
263      SetRect(&rect,0,0,bm.bmWidth,bm.bmHeight);
264      hBrush = CreateSolidBrush(color);
265      FillRect(hdc,&rect,hBrush);
266      DeleteObject(hBrush);
267    }
268    
269    FARPROC GetProcAddressWithDllName(char *dllName,char *procName)
270    {
271      HINSTANCE hDll;
272    
273      hDll = LoadLibrary(dllName);
274    
275      if(hDll)
276        return GetProcAddress(hDll,procName);
277      else
278        return 0;
279    }
280    
281    void RandomFile(char *filespec,char *filename)
282    {
283      int    i;
284      int    file_num;
285      char   fullpath[MAX_PATH];
286      char   *filePart;
287    
288      HANDLE hFind;
289      WIN32_FIND_DATA fd;
290    
291      strcpy(filename,"");
292    
293      //絶対パスに変換
294      if(!GetFullPathName(filespec,MAX_PATH,fullpath,&filePart))
295        return;
296    
297      //ファイルを数える
298      hFind = FindFirstFile(fullpath,&fd);
299      
300      file_num = 0;
301    
302      if(hFind != INVALID_HANDLE_VALUE && filePart)
303      {
304    
305        do{
306        
307          if(!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
308            file_num ++;
309        
310        }while(FindNextFile(hFind,&fd));
311    
312      }
313    
314      if(!file_num)
315        return;
316    
317      FindClose(hFind);
318    
319      //何番目のファイルにするか決める。
320      file_num = rand()%file_num + 1;
321    
322      hFind = FindFirstFile(fullpath,&fd);
323    
324      if(hFind != INVALID_HANDLE_VALUE)
325      {
326        i = 0;
327    
328        do{
329        
330          if(!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
331            i ++;
332        
333        }while(i < file_num && FindNextFile(hFind,&fd));
334    
335      }else{
336        return;
337      }
338    
339      FindClose(hFind);
340    
341      //ディレクトリ取得
342      ZeroMemory(filename,MAX_PATH);
343      strncpy(filename,fullpath,filePart - fullpath);
344      strcat(filename,fd.cFileName);
345    }
346    
347    BOOL LoadPictureWithSPI(char *nameSPI,char *nameFile,unsigned char *bufFile,long sizeFile,HLOCAL *hbuf,HLOCAL *hbmi)
348    {
349      HINSTANCE hSPI;
350      char spiVersion[8];
351      int (FAR PASCAL *SPI_IsSupported)(LPSTR,DWORD);
352      int (FAR PASCAL *SPI_GetPicture)(LPSTR,long,unsigned int,HANDLE *,HANDLE *,FARPROC,long);
353      int (FAR PASCAL *SPI_GetPluginInfo)(int,LPSTR,int);
354      int ret;
355    
356      ret  = FALSE;
357      hSPI = NULL;
358    
359      //SPI をロード
360      hSPI = LoadLibrary(nameSPI);
361    
362      if(!hSPI)
363        goto error;
364    
365      (FARPROC)SPI_GetPluginInfo = GetProcAddress(hSPI,"GetPluginInfo");
366      (FARPROC)SPI_IsSupported   = GetProcAddress(hSPI,"IsSupported");
367      (FARPROC)SPI_GetPicture    = GetProcAddress(hSPI,"GetPicture");
368    
369      if(!SPI_GetPluginInfo || !SPI_IsSupported || !SPI_GetPicture)
370        goto error;
371    
372      //バージョンチェック
373      SPI_GetPluginInfo(0,spiVersion,8);
374    
375      if(spiVersion[2] != 'I' || spiVersion[3] != 'N')
376        goto error;
377    
378      if(!(SPI_IsSupported)(nameFile,(unsigned long)bufFile))
379        goto error;
380    
381      if((SPI_GetPicture)(bufFile,sizeFile,1,hbmi,hbuf,NULL,0))
382        goto error;
383    
384      ret = TRUE;
385    
386      error :
387    
388      if(hSPI)
389        FreeLibrary(hSPI);
390    
391      return ret;
392    }
393    
394    BOOL SaveBitmapFile(char *nameFile,unsigned char *pbuf,BITMAPINFO *pbmi)
395    {
396      int    bmiSize;
397      DWORD  writtenByte;
398      HANDLE hFile;
399      BITMAPFILEHEADER bfh;
400    
401      hFile = CreateFile(nameFile,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
402    
403      if(hFile == INVALID_HANDLE_VALUE)
404        return FALSE;
405    
406      bmiSize = pbmi->bmiHeader.biSize;
407      
408      switch(pbmi->bmiHeader.biBitCount)
409      {
410        case 1:
411          bmiSize += pbmi->bmiHeader.biClrUsed ? sizeof(RGBQUAD) * 2 : 0;
412          break;
413        
414        case 2 :
415          bmiSize += sizeof(RGBQUAD) * 4;
416          break;
417    
418        case 4 :
419          bmiSize += sizeof(RGBQUAD) * 16;
420          break;
421    
422        case 8 :
423          bmiSize += sizeof(RGBQUAD) * 256;
424          break;
425      }
426    
427      ZeroMemory(&bfh,sizeof(bfh));
428      bfh.bfType    = MAKEWORD('B','M');
429      bfh.bfOffBits = sizeof(bfh) + bmiSize;
430      bfh.bfSize    = bfh.bfOffBits + pbmi->bmiHeader.biSizeImage;
431    
432      WriteFile(hFile,&bfh,sizeof(bfh)                ,&writtenByte,0);
433      WriteFile(hFile,pbmi,bmiSize                    ,&writtenByte,0);
434      WriteFile(hFile,pbuf,pbmi->bmiHeader.biSizeImage,&writtenByte,0);
435    
436      CloseHandle(hFile);
437    
438      return TRUE;
439    }
440    
441    BOOL FAR WINAPI AlphaBlendWithoutAPI(HDC hdcDest,int dx,int dy,int width,int height,HDC hdcSrc,int sx,int sy,int sw,int sh,BGBLENDFUNCTION bf)
442    {
443      HDC hdcDestWork,hdcSrcWork;
444      int i,invAlpha,alpha;
445      int lenBuf;
446      unsigned char *bufDest;
447      unsigned char *bufSrc;
448    
449      if(dx != 0 || dy != 0 || sx != 0 || sy != 0 || width != sw || height != sh)
450        return FALSE;
451    
452      hdcDestWork = CreateBitmapDC(CreateDIB24BPP(width,height,&bufDest,&lenBuf));
453      hdcSrcWork  = CreateBitmapDC(CreateDIB24BPP(width,height,&bufSrc ,&lenBuf));
454    
455      if(!bufDest || !bufSrc)
456        return FALSE;
457    
458      BitBlt(hdcDestWork,0,0,width,height,hdcDest,0,0,SRCCOPY);
459      BitBlt(hdcSrcWork ,0,0,width,height,hdcSrc ,0,0,SRCCOPY);
460    
461      alpha = bf.SourceConstantAlpha;
462      invAlpha = 255 - alpha;
463    
464      for(i = 0;i < lenBuf;i++,bufDest++,bufSrc++)
465        *bufDest = (*bufDest * invAlpha + *bufSrc * alpha)>>8;
466    
467      BitBlt(hdcDest,0,0,width,height,hdcDestWork,0,0,SRCCOPY);
468    
469      DeleteBitmapDC(&hdcDestWork);
470      DeleteBitmapDC(&hdcSrcWork);
471    
472      return TRUE;
473    }
474    
475    // 画像読み込み関係
476    
477    void BGPreloadPicture(BGSrc *src)
478    {
479      char  spiPath[MAX_PATH];
480      char  filespec[MAX_PATH];
481      char *filePart;
482      int   fileSize;
483      int   readByte;
484      unsigned char *fileBuf;
485    
486      HBITMAP hbm;
487      HANDLE  hPictureFile;
488      HANDLE  hFind;
489      WIN32_FIND_DATA fd;
490    
491      #ifdef _DEBUG
492        dprintf("Preload Picture : %s",src->file);
493      #endif
494    
495      //ファイルを読み込む
496      hPictureFile = CreateFile(src->file,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
497    
498      if(hPictureFile == INVALID_HANDLE_VALUE)
499        return;
500      
501      fileSize = GetFileSize(hPictureFile,0);
502    
503      //最低 2kb は確保 (Susie plugin の仕様より)
504      fileBuf  = GlobalAlloc(GPTR,fileSize + 2048);
505    
506      //頭の 2kb は0で初期化
507      ZeroMemory(fileBuf,2048);
508    
509      ReadFile(hPictureFile,fileBuf,fileSize,&readByte,0);
510    
511      CloseHandle(hPictureFile);
512    
513      // SPIPath を絶対パスに変換
514      if(!GetFullPathName(BGSPIPath,MAX_PATH,filespec,&filePart))
515        return;
516    
517      //プラグインを当たっていく
518      hFind = FindFirstFile(filespec,&fd);
519    
520      if(hFind != INVALID_HANDLE_VALUE && filePart)
521      {
522        //ディレクトリ取得
523        ZeroMemory(spiPath,MAX_PATH);
524        strncpy(spiPath,filespec,filePart - filespec);
525    
526        do{
527          HLOCAL hbuf,hbmi;
528          BITMAPINFO *pbmi;
529          char       *pbuf;
530          char spiFileName[MAX_PATH];
531    
532          if(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
533            continue;
534    
535          strcpy(spiFileName,spiPath);
536          strcat(spiFileName,fd.cFileName);
537    
538          if(LoadPictureWithSPI(spiFileName,src->file,fileBuf,fileSize,&hbuf,&hbmi))
539          {
540            pbuf = LocalLock(hbuf);
541            pbmi = LocalLock(hbmi);
542    
543            SaveBitmapFile(src->fileTmp,pbuf,pbmi);
544    
545            LocalUnlock(hbmi);
546            LocalUnlock(hbuf);
547    
548            LocalFree(hbmi);
549            LocalFree(hbuf);
550        
551            strcpy(src->file,src->fileTmp);
552    
553            break;
554          }
555        }while(FindNextFile(hFind,&fd));
556    
557        FindClose(hFind);
558      }
559    
560      GlobalFree(fileBuf);
561    
562      //画像をビットマップとして読み込み
563    
564      hbm = LoadImage(0,src->file,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
565    
566      if(hbm)
567      {
568        BITMAP bm;
569    
570        GetObject(hbm,sizeof(bm),&bm);
571    
572        src->hdc    = CreateBitmapDC(hbm);
573        src->width  = bm.bmWidth;
574        src->height = bm.bmHeight;
575      }else{
576        src->type = BG_COLOR;
577      }
578    }
579    
580    void BGGetWallpaperInfo(WallpaperInfo *wi)
581    {
582      int  length;
583      int  tile;
584      char str[256];
585      HKEY hKey;
586    
587      wi->pattern = BG_CENTER;
588      strcpy(wi->filename,"");
589    
590      //レジストリキーのオープン
591      if(RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
592        return;
593    
594      //壁紙名ゲット
595      length = MAX_PATH;
596      RegQueryValueEx(hKey,"Wallpaper"     ,NULL,NULL,(BYTE*)(wi->filename),&length);
597    
598      //壁紙スタイルゲット
599      length = 256;
600      RegQueryValueEx(hKey,"WallpaperStyle",NULL,NULL,(BYTE*)str,&length);
601      wi->pattern = atoi(str);
602    
603      //壁紙スタイルゲット
604      length = 256;
605      RegQueryValueEx(hKey,"TileWallpaper" ,NULL,NULL,(BYTE*)str,&length);
606      tile = atoi(str);
607    
608      //これでいいの?
609      if(tile)
610        wi->pattern = BG_TILE;
611      else
612      if(wi->pattern == 0)
613        wi->pattern = BG_CENTER;
614      else
615      if(wi->pattern == 2)
616        wi->pattern = BG_STRETCH;
617    
618      //レジストリキーのクローズ
619      RegCloseKey(hKey);
620    }
621    
622    void BGPreloadWallpaper(BGSrc *src)
623    {
624      HBITMAP       hbm;
625      WallpaperInfo wi;
626    
627      BGGetWallpaperInfo(&wi);
628    
629      //壁紙を読み込み
630      //LR_CREATEDIBSECTION を指定するのがコツ
631      if(wi.pattern == BG_STRETCH)
632        hbm = LoadImage(0,wi.filename,IMAGE_BITMAP,CRTWidth,CRTHeight,LR_LOADFROMFILE | LR_CREATEDIBSECTION);
633      else
634        hbm = LoadImage(0,wi.filename,IMAGE_BITMAP,        0,       0,LR_LOADFROMFILE);
635    
636      //壁紙DCを作る
637      if(hbm)
638      {
639        BITMAP bm;
640    
641        GetObject(hbm,sizeof(bm),&bm);
642    
643        src->hdc     = CreateBitmapDC(hbm);
644        src->width   = bm.bmWidth;
645        src->height  = bm.bmHeight;
646        src->pattern = wi.pattern;
647      }else{
648        src->hdc = NULL;
649      }
650    
651      src->color = GetSysColor(COLOR_DESKTOP);
652    }
653    
654    void BGPreloadSrc(BGSrc *src)
655    {
656      DeleteBitmapDC(&(src->hdc));
657    
658      switch(src->type)
659      {
660        case BG_COLOR :
661          break;
662    
663        case BG_WALLPAPER :
664          BGPreloadWallpaper(src);
665          break;
666    
667        case BG_PICTURE :
668          BGPreloadPicture(src);
669          break;
670      }
671    }
672    
673    void BGStretchPicture(HDC hdcDest,BGSrc *src,int x,int y,int width,int height,BOOL bAntiAlias)
674    {
675      if(!hdcDest || !src)
676        return;
677    
678      if(bAntiAlias)
679      {
680        if(src->width != width || src->height != height)
681        {
682          HBITMAP hbm;
683    
684          hbm = LoadImage(0,src->file,IMAGE_BITMAP,width,height,LR_LOADFROMFILE);
685    
686          if(!hbm)
687            return;
688          
689          DeleteBitmapDC(&(src->hdc));
690          src->hdc = CreateBitmapDC(hbm);
691          src->width  = width;
692          src->height = height;
693        }
694      
695        BitBlt(hdcDest,x,y,width,height,src->hdc,0,0,SRCCOPY);
696      }else{
697        SetStretchBltMode(src->hdc,COLORONCOLOR);
698        StretchBlt(hdcDest,x,y,width,height,src->hdc,0,0,src->width,src->height,SRCCOPY);
699      }
700    }
701    
702    void BGLoadPicture(HDC hdcDest,BGSrc *src)
703    {
704      int x,y,width,height,pattern;
705      HDC hdc = NULL;
706    
707      FillBitmapDC(hdcDest,src->color);
708    
709      if(!src->height || !src->width)
710        return;
711    
712      if(src->pattern == BG_AUTOFIT){
713        if((src->height * ScreenWidth) > (ScreenHeight * src->width))
714          pattern = BG_FIT_WIDTH;
715        else
716          pattern = BG_FIT_HEIGHT;
717      }else{
718        pattern = src->pattern;
719      }
720    
721      switch(pattern)
722      {
723        case BG_STRETCH :
724          BGStretchPicture(hdcDest,src,0,0,ScreenWidth,ScreenHeight,src->antiAlias);
725          break;
726    
727        case BG_FIT_WIDTH :
728    
729          height = (src->height * ScreenWidth) / src->width;
730          y      = (ScreenHeight - height) / 2;
731          
732          BGStretchPicture(hdcDest,src,0,y,ScreenWidth,height,src->antiAlias);
733          break;
734    
735        case BG_FIT_HEIGHT :
736    
737          width = (src->width * ScreenHeight) / src->height;
738          x     = (ScreenWidth - width) / 2;
739    
740          BGStretchPicture(hdcDest,src,x,0,width,ScreenHeight,src->antiAlias);
741          break;
742    
743        case BG_TILE :
744          for(x = 0;x < ScreenWidth ;x += src->width )
745          for(y = 0;y < ScreenHeight;y += src->height)
746            BitBlt(hdcDest,x,y,src->width,src->height,src->hdc,0,0,SRCCOPY);
747          break;
748    
749        case BG_CENTER :
750          x = (ScreenWidth  -  src->width) / 2;
751          y = (ScreenHeight - src->height) / 2;
752    
753          BitBlt(hdcDest,x,y,src->width,src->height,src->hdc,0,0,SRCCOPY);
754          break;
755      }
756    }
757    
758    typedef struct tagLoadWallpaperStruct
759    {
760      RECT *rectClient;
761      HDC hdcDest;
762      BGSrc *src;
763    }LoadWallpaperStruct;
764    
765    BOOL CALLBACK BGLoadWallpaperEnumFunc(HMONITOR hMonitor,HDC hdcMonitor,LPRECT lprcMonitor,LPARAM dwData)
766    {
767      RECT rectDest;
768      RECT rectRgn;
769      int  monitorWidth;
770      int  monitorHeight;
771      int  destWidth;
772      int  destHeight;
773      HRGN hRgn;
774      int  x;
775      int  y;
776    
777      LoadWallpaperStruct *lws = (LoadWallpaperStruct*)dwData;
778    
779      if(!IntersectRect(&rectDest,lprcMonitor,lws->rectClient))
780        return TRUE;
781    
782      //モニターにかかってる部分をマスク
783      SaveDC(lws->hdcDest);
784      CopyRect(&rectRgn,&rectDest);
785      OffsetRect(&rectRgn,- lws->rectClient->left,- lws->rectClient->top);
786      hRgn = CreateRectRgnIndirect(&rectRgn);
787      SelectObject(lws->hdcDest,hRgn);
788    
789      //モニターの大きさ
790      monitorWidth  = lprcMonitor->right  - lprcMonitor->left;
791      monitorHeight = lprcMonitor->bottom - lprcMonitor->top;
792    
793      destWidth  = rectDest.right  - rectDest.left;
794      destHeight = rectDest.bottom - rectDest.top;
795    
796      switch(lws->src->pattern)
797      {
798        case BG_CENTER  :
799        case BG_STRETCH :
800    
801          SetWindowOrgEx(lws->src->hdc,
802                         lprcMonitor->left + (monitorWidth  - lws->src->width )/2,
803                         lprcMonitor->top  + (monitorHeight - lws->src->height)/2,NULL);
804          BitBlt(lws->hdcDest ,rectDest.left,rectDest.top,destWidth,destHeight,
805                 lws->src->hdc,rectDest.left,rectDest.top,SRCCOPY);
806    
807          break;
808        case BG_TILE :
809          
810          SetWindowOrgEx(lws->src->hdc,0,0,NULL);
811    
812          for(x = rectDest.left - (rectDest.left % lws->src->width ) - lws->src->width ;
813              x < rectDest.right ;x += lws->src->width )
814          for(y = rectDest.top  - (rectDest.top  % lws->src->height) - lws->src->height;
815              y < rectDest.bottom;y += lws->src->height)
816            BitBlt(lws->hdcDest,x,y,lws->src->width,lws->src->height,lws->src->hdc,0,0,SRCCOPY);
817          break;
818      }
819    
820      //リージョンを破棄
821      RestoreDC(lws->hdcDest,-1);
822      DeleteObject(hRgn);
823    
824      return TRUE;
825    }
826    
827    void BGLoadWallpaper(HDC hdcDest,BGSrc *src)
828    {
829      RECT  rectClient;
830      POINT point;
831      LoadWallpaperStruct lws;
832    
833      //取りあえずデスクトップ色で塗りつぶす
834      FillBitmapDC(hdcDest,src->color);
835    
836      //壁紙が設定されていない
837      if(!src->hdc)
838        return;
839    
840      //hdcDestの座標系を仮想スクリーンに合わせる
841      point.x = 0;
842      point.y = 0;
843      ClientToScreen(HVTWin,&point);
844    
845      SetWindowOrgEx(hdcDest,point.x,point.y,NULL);
846    
847      //仮想スクリーンでのクライアント領域
848      GetClientRect(HVTWin,&rectClient);
849      OffsetRect(&rectClient,point.x,point.y);
850    
851      //モニターを列挙
852      lws.rectClient = &rectClient;
853      lws.src        = src;
854      lws.hdcDest    = hdcDest;
855    
856      if(BGEnumDisplayMonitors)
857      {
858        (*BGEnumDisplayMonitors)(NULL,NULL,BGLoadWallpaperEnumFunc,(LPARAM)&lws);
859      }else{
860        RECT rectMonitor;
861      
862        SetRect(&rectMonitor,0,0,CRTWidth,CRTHeight);
863        BGLoadWallpaperEnumFunc(NULL,NULL,&rectMonitor,(LPARAM)&lws);
864      }
865    
866      //座標系を戻す
867      SetWindowOrgEx(hdcDest,0,0,NULL);
868    }
869    
870    void BGLoadSrc(HDC hdcDest,BGSrc *src)
871    {
872      switch(src->type)
873      {
874        case BG_COLOR :
875          FillBitmapDC(hdcDest,src->color);
876          break;
877    
878        case BG_WALLPAPER :
879          BGLoadWallpaper(hdcDest,src);
880          break;
881    
882        case BG_PICTURE :
883          BGLoadPicture(hdcDest,src);
884          break;
885      }
886    }
887    
888    void BGSetupPrimary(BOOL forceSetup)
889    {
890      POINT point;
891      RECT rect;
892    
893      if(!BGEnable)
894        return;
895    
896      //窓の位置、大きさが変わったかチェック
897      point.x = 0;
898      point.y = 0;
899      ClientToScreen(HVTWin,&point);
900      
901      GetClientRect(HVTWin,&rect);
902      OffsetRect(&rect,point.x,point.y);
903    
904      if(!forceSetup && EqualRect(&rect,&BGPrevRect))
905        return;
906    
907      CopyRect(&BGPrevRect,&rect);
908    
909      #ifdef _DEBUG
910        dprintf("BGSetupPrimary : BGInSizeMove = %d",BGInSizeMove);
911      #endif
912    
913      //作業用 DC 作成
914      if(hdcBGWork)   DeleteBitmapDC(&hdcBGWork);
915      if(hdcBGBuffer) DeleteBitmapDC(&hdcBGBuffer);
916    
917      hdcBGWork   = CreateBitmapDC(CreateScreenCompatibleBitmap(ScreenWidth,FontHeight));
918      hdcBGBuffer = CreateBitmapDC(CreateScreenCompatibleBitmap(ScreenWidth,FontHeight));
919    
920      //hdcBGBuffer の属性設定
921      SetBkMode(hdcBGBuffer,TRANSPARENT);
922    
923      if(!BGInSizeMove)
924      {
925        BGBLENDFUNCTION bf;
926        HDC hdcSrc = NULL;
927    
928        //背景 HDC
929        if(hdcBG) DeleteBitmapDC(&hdcBG);
930          hdcBG = CreateBitmapDC(CreateScreenCompatibleBitmap(ScreenWidth,ScreenHeight));
931    
932        //作業用DC
933        hdcSrc = CreateBitmapDC(CreateScreenCompatibleBitmap(ScreenWidth,ScreenHeight));
934    
935        //背景生成
936        BGLoadSrc(hdcBG,&BGDest);
937    
938        ZeroMemory(&bf,sizeof(bf));
939        bf.BlendOp = AC_SRC_OVER;
940    
941        if(bf.SourceConstantAlpha = BGSrc1.alpha)
942        {
943          BGLoadSrc(hdcSrc,&BGSrc1);
944          (BGAlphaBlend)(hdcBG,0,0,ScreenWidth,ScreenHeight,hdcSrc,0,0,ScreenWidth,ScreenHeight,bf);
945        }
946    
947        if(bf.SourceConstantAlpha = BGSrc2.alpha)
948        {
949          BGLoadSrc(hdcSrc,&BGSrc2);
950          (BGAlphaBlend)(hdcBG,0,0,ScreenWidth,ScreenHeight,hdcSrc,0,0,ScreenWidth,ScreenHeight,bf);
951        }
952    
953        DeleteBitmapDC(&hdcSrc);
954      }
955    }
956    
957    COLORREF BGGetColor(char *name,COLORREF defcolor,char *file)
958    {
959      unsigned int r,g,b;
960      char colorstr[256],defstr[256];
961    
962      sprintf(defstr,"%d,%d,%d",GetRValue(defcolor),GetGValue(defcolor),GetBValue(defcolor));
963    
964      GetPrivateProfileString(BG_SECTION,name,defstr,colorstr,255,file);
965    
966      r = g = b = 0;
967    
968      sscanf(colorstr,"%d , %d , %d",&r,&g,&b);
969    
970      return RGB(r,g,b);
971    }
972    
973    BG_PATTERN BGGetStrIndex(char *name,BG_PATTERN def,char *file,char **strList,int nList)
974    {
975      char defstr[64],str[64];
976      int  i;
977    
978      def %= nList;
979    
980      strcpy(defstr,strList[def]);
981      GetPrivateProfileString(BG_SECTION,name,defstr,str,64,file);
982    
983      for(i = 0;i < nList;i++)
984        if(!stricmp(str,strList[i]))
985          return i;
986    
987      return 0;
988    }
989    
990    BOOL BGGetOnOff(char *name,BOOL def,char *file)
991    {
992      char *strList[2] = {"Off","On"};
993    
994      return BGGetStrIndex(name,def,file,strList,2);
995    }
996    
997    BG_PATTERN BGGetPattern(char *name,BG_PATTERN def,char *file)
998    {
999      char *strList[6]={"stretch","tile","center","fitwidth","fitheight","autofit"};
1000    
1001      return BGGetStrIndex(name,def,file,strList,6);
1002    }
1003    
1004    BG_PATTERN BGGetType(char *name,BG_TYPE def,char *file)
1005    {
1006      char *strList[3]={"color","picture","wallpaper"};
1007    
1008      return BGGetStrIndex(name,def,file,strList,3);
1009    }
1010    
1011    void BGReadTextColorConfig(char *file)
1012    {
1013      ANSIColor[IdFore   ] = BGGetColor("Fore"   ,ANSIColor[IdFore],file);
1014      ANSIColor[IdBack   ] = BGGetColor("Back"   ,ANSIColor[IdBack],file);
1015      ANSIColor[IdRed    ] = BGGetColor("Red"    ,ANSIColor[IdRed    ],file);
1016      ANSIColor[IdGreen  ] = BGGetColor("Green"  ,ANSIColor[IdGreen  ],file);
1017      ANSIColor[IdYellow ] = BGGetColor("Yellow" ,ANSIColor[IdYellow ],file);
1018      ANSIColor[IdBlue   ] = BGGetColor("Blue"   ,ANSIColor[IdBlue   ],file);
1019      ANSIColor[IdMagenta] = BGGetColor("Magenta",ANSIColor[IdMagenta],file);
1020      ANSIColor[IdCyan   ] = BGGetColor("Cyan"   ,ANSIColor[IdCyan   ],file);
1021    
1022      ANSIColor[IdFore   + 8] = BGGetColor("DarkFore"   ,ANSIColor[IdFore   + 8],file);
1023      ANSIColor[IdBack   + 8] = BGGetColor("DarkBack"   ,ANSIColor[IdBack   + 8],file);
1024      ANSIColor[IdRed    + 8] = BGGetColor("DarkRed"    ,ANSIColor[IdRed    + 8],file);
1025      ANSIColor[IdGreen  + 8] = BGGetColor("DarkGreen"  ,ANSIColor[IdGreen  + 8],file);
1026      ANSIColor[IdYellow + 8] = BGGetColor("DarkYellow" ,ANSIColor[IdYellow + 8],file);
1027      ANSIColor[IdBlue   + 8] = BGGetColor("DarkBlue"   ,ANSIColor[IdBlue   + 8],file);
1028      ANSIColor[IdMagenta+ 8] = BGGetColor("DarkMagenta",ANSIColor[IdMagenta+ 8],file);
1029      ANSIColor[IdCyan   + 8] = BGGetColor("DarkCyan"   ,ANSIColor[IdCyan   + 8],file);
1030    
1031      BGVTColor[0]      = BGGetColor("VTFore",BGVTColor[0],file);
1032      BGVTColor[1]      = BGGetColor("VTBack",BGVTColor[1],file);
1033    
1034      BGVTBlinkColor[0] = BGGetColor("VTBlinkFore",BGVTBlinkColor[0],file);
1035      BGVTBlinkColor[1] = BGGetColor("VTBlinkBack",BGVTBlinkColor[1],file);
1036    
1037      BGVTBoldColor[0]  = BGGetColor("VTBoldFore" ,BGVTBoldColor[0],file);
1038      BGVTBoldColor[1]  = BGGetColor("VTBoldBack" ,BGVTBoldColor[1],file);
1039    }
1040    
1041    void BGReadIniFile(char *file)
1042    {
1043      char path[MAX_PATH];
1044    
1045      // Easy Setting
1046      BGDest.pattern = BGGetPattern("BGPicturePattern",BGSrc1.pattern,file);
1047      BGDest.color   = BGGetColor("BGPictureBaseColor",BGSrc1.color,file);
1048    
1049      GetPrivateProfileString(BG_SECTION,"BGPictureFile",BGSrc1.file,path,MAX_PATH,file);
1050      RandomFile(path,BGDest.file);
1051    
1052      BGSrc1.alpha   = 255 - GetPrivateProfileInt(BG_SECTION,"BGPictureTone",255 - BGSrc1.alpha,file);
1053    
1054      if(!strcmp(BGDest.file,""))
1055        BGSrc1.alpha = 255;
1056    
1057      BGSrc2.alpha   = 255 - GetPrivateProfileInt(BG_SECTION,"BGFadeTone",255 - BGSrc2.alpha,file);
1058      BGSrc2.color   = BGGetColor("BGFadeColor",BGSrc2.color,file);
1059    
1060      BGReverseTextAlpha = GetPrivateProfileInt(BG_SECTION,"BGReverseTextTone",BGReverseTextAlpha,file);
1061    
1062      //Src1 の読み出し
1063      BGSrc1.type      = BGGetType("BGSrc1Type",BGSrc1.type,file);
1064      BGSrc1.pattern   = BGGetPattern("BGSrc1Pattern",BGSrc1.pattern,file);
1065      BGSrc1.antiAlias = BGGetOnOff("BGSrc1AntiAlias",BGSrc1.antiAlias,file);
1066      BGSrc1.alpha     = GetPrivateProfileInt(BG_SECTION,"BGSrc1Alpha"  ,BGSrc1.alpha  ,file);
1067      BGSrc1.color     = BGGetColor("BGSrc1Color",BGSrc1.color,file);
1068    
1069      GetPrivateProfileString(BG_SECTION,"BGSrc1File",BGSrc1.file,path,MAX_PATH,file);
1070      RandomFile(path,BGSrc1.file);
1071      
1072      //Src2 の読み出し
1073      BGSrc2.type      = BGGetType("BGSrc2Type",BGSrc2.type,file);
1074      BGSrc2.pattern   = BGGetPattern("BGSrc2Pattern",BGSrc2.pattern,file);
1075      BGSrc2.antiAlias = BGGetOnOff("BGSrc2AntiAlias",BGSrc2.antiAlias,file);
1076      BGSrc2.alpha     = GetPrivateProfileInt(BG_SECTION,"BGSrc2Alpha"  ,BGSrc2.alpha  ,file);
1077      BGSrc2.color     = BGGetColor("BGSrc2Color",BGSrc2.color,file);
1078    
1079      GetPrivateProfileString(BG_SECTION,"BGSrc2File",BGSrc2.file,path,MAX_PATH,file);
1080      RandomFile(path,BGSrc2.file);
1081    
1082      //Dest の読み出し
1083      BGDest.type      = BGGetType("BGDestType",BGDest.type,file);
1084      BGDest.pattern   = BGGetPattern("BGDestPattern",BGDest.pattern,file);
1085      BGDest.antiAlias = BGGetOnOff("BGDestAntiAlias",BGDest.antiAlias,file);
1086      BGDest.color     = BGGetColor("BGDestColor",BGDest.color,file);
1087    
1088      GetPrivateProfileString(BG_SECTION,"BGDestFile",BGDest.file,path,MAX_PATH,file);
1089      RandomFile(path,BGDest.file);
1090    
1091      //その他読み出し
1092      BGReverseTextAlpha = GetPrivateProfileInt(BG_SECTION,"BGReverseTextAlpha",BGReverseTextAlpha,file);
1093      BGReadTextColorConfig(file);
1094    }
1095    
1096    void BGDestruct(void)
1097    {
1098      if(!BGEnable)
1099        return;
1100    
1101      DeleteBitmapDC(&hdcBGBuffer);
1102      DeleteBitmapDC(&hdcBGWork);
1103      DeleteBitmapDC(&hdcBG);
1104      DeleteBitmapDC(&(BGDest.hdc));
1105      DeleteBitmapDC(&(BGSrc1.hdc));
1106      DeleteBitmapDC(&(BGSrc2.hdc));
1107    
1108      //テンポラリーファイル削除
1109      DeleteFile(BGDest.fileTmp);
1110      DeleteFile(BGSrc1.fileTmp);
1111      DeleteFile(BGSrc2.fileTmp);
1112    }
1113    
1114    void BGInitialize(void)
1115    {
1116      char path[MAX_PATH],config_file[MAX_PATH],tempPath[MAX_PATH];
1117      int i;
1118    
1119      // VTColor を読み込み
1120      BGVTColor[0] = ts.VTColor[0];
1121      BGVTColor[1] = ts.VTColor[1];
1122    
1123      BGVTBoldColor[0] = ts.VTBoldColor[0];
1124      BGVTBoldColor[1] = ts.VTBoldColor[1];
1125    
1126      BGVTBlinkColor[0] = ts.VTBlinkColor[0];
1127      BGVTBlinkColor[1] = ts.VTBlinkColor[1];
1128    
1129      // ANSI color設定のほうを優先させる (2005.2.3 yutaka)
1130    #ifndef NO_ANSI_COLOR_EXTENSION
1131      for (i = IdBack ; i <= IdFore+8 ; i++)
1132        ANSIColor[i] = ts.ANSIColor[i];
1133      if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) // use background color for "Black"
1134        ANSIColor[IdBack ]   = ts.VTColor[1];
1135      if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) // use text color for "white"
1136        ANSIColor[IdFore ]   = ts.VTColor[0];
1137    #else /* NO_ANSI_COLOR_EXTENSION */
1138      ANSIColor[IdBack ]     = RGB(  0,  0,  0);
1139      ANSIColor[IdRed  ]     = RGB(255,  0,  0);
1140      ANSIColor[IdGreen]     = RGB(  0,255,  0);
1141      ANSIColor[IdYellow]    = RGB(255,255,  0);
1142      ANSIColor[IdBlue]      = RGB(  0,  0,255);
1143      ANSIColor[IdMagenta]   = RGB(255,  0,255);
1144      ANSIColor[IdCyan]      = RGB(  0,255,255);
1145      ANSIColor[IdFore ]     = RGB(255,255,255);
1146      ANSIColor[IdBack+8]    = RGB(128,128,128);
1147      ANSIColor[IdRed+8]     = RGB(128,  0,  0);
1148      ANSIColor[IdGreen+8]   = RGB(  0,128,  0);
1149      ANSIColor[IdYellow+8]  = RGB(128,128,  0);
1150      ANSIColor[IdBlue+8]    = RGB(  0,  0,128);
1151      ANSIColor[IdMagenta+8] = RGB(128,  0,128);
1152      ANSIColor[IdCyan+8]    = RGB(  0,128,128);
1153      ANSIColor[IdFore+8]    = RGB(192,192,192);
1154    #endif
1155    
1156      //リソース解放
1157      BGDestruct();
1158    
1159      //BG が有効かチェック
1160      BGEnable = BGGetOnOff("BGEnable",FALSE,ts.SetupFName);
1161    
1162      if(!BGEnable)
1163        return;
1164    
1165      //乱数初期化
1166      srand(time(NULL));
1167    
1168      //BGシステム設定読み出し
1169      BGUseAlphaBlendAPI = BGGetOnOff("BGUseAlphaBlendAPI",TRUE ,ts.SetupFName);
1170      BGNoFrame          = BGGetOnOff("BGNoFrame"         ,FALSE,ts.SetupFName);
1171      BGFastSizeMove     = BGGetOnOff("BGFastSizeMove"    ,TRUE ,ts.SetupFName);
1172      BGNoCopyBits       = BGGetOnOff("BGFlickerlessMove" ,TRUE ,ts.SetupFName);
1173      
1174      GetPrivateProfileString(BG_SECTION,"BGSPIPath","plugin",BGSPIPath,MAX_PATH,ts.SetupFName);
1175    
1176      //テンポラリーファイル名を生成
1177      GetTempPath(MAX_PATH,tempPath);
1178      GetTempFileName(tempPath,"ttAK",0,BGDest.fileTmp);
1179      GetTempFileName(tempPath,"ttAK",0,BGSrc1.fileTmp);
1180      GetTempFileName(tempPath,"ttAK",0,BGSrc2.fileTmp);
1181      
1182      //デフォルト値
1183      BGDest.type      = BG_PICTURE;
1184      BGDest.pattern   = BG_STRETCH;
1185      BGDest.color     = RGB(0,0,0);
1186      BGDest.antiAlias = TRUE;
1187      strcpy(BGDest.file,"");
1188    
1189      BGSrc1.type      = BG_WALLPAPER;
1190      BGSrc1.pattern   = BG_STRETCH;
1191      BGSrc1.color     = RGB(255,255,255);
1192      BGSrc1.antiAlias = TRUE;
1193      BGSrc1.alpha     = 255;
1194      strcpy(BGSrc1.file,"");
1195    
1196      BGSrc2.type      = BG_COLOR;
1197      BGSrc2.pattern   = BG_STRETCH;
1198      BGSrc2.color     = RGB(0,0,0);
1199      BGSrc2.antiAlias = TRUE;
1200      BGSrc2.alpha     = 128;
1201      strcpy(BGSrc2.file,"");
1202    
1203      BGReverseTextAlpha = 255;
1204    
1205      //設定の読み出し
1206      BGReadIniFile(ts.SetupFName);
1207    
1208      //コンフィグファイルの決定
1209      GetPrivateProfileString(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName);
1210      RandomFile(path,config_file);
1211    
1212      //設定のオーバーライド
1213      if(strcmp(config_file,""))
1214      {
1215        char dir[MAX_PATH],prevDir[MAX_PATH];
1216        
1217        //INIファイルのあるディレクトリに一時的に移動
1218        GetCurrentDirectory(MAX_PATH,prevDir);
1219    
1220        ExtractDirName(config_file,dir);
1221        SetCurrentDirectory(dir);
1222    
1223        BGReadIniFile(config_file);
1224    
1225        SetCurrentDirectory(prevDir);
1226      }
1227    
1228      //SPI のパスを整形
1229      AppendSlash(BGSPIPath);
1230      strcat(BGSPIPath,"*");
1231    
1232      //壁紙 or 背景をプリロード
1233      BGPreloadSrc(&BGDest);
1234      BGPreloadSrc(&BGSrc1);
1235      BGPreloadSrc(&BGSrc2);
1236    
1237      // AlphaBlend のアドレスを読み込み
1238      if(BGUseAlphaBlendAPI)
1239        (FARPROC)BGAlphaBlend = GetProcAddressWithDllName("msimg32.dll","AlphaBlend");
1240      else
1241        BGAlphaBlend = NULL;
1242    
1243      if(!BGAlphaBlend)
1244        BGAlphaBlend = AlphaBlendWithoutAPI;
1245    
1246      //EnumDisplayMonitors を探す
1247      (FARPROC)BGEnumDisplayMonitors = GetProcAddressWithDllName("user32.dll","EnumDisplayMonitors");
1248    }
1249    
1250    void BGFillRect(HDC hdc,RECT *R,HBRUSH brush)
1251    {
1252      if(!BGEnable)
1253        FillRect(hdc,R,brush);
1254      else
1255        BitBlt(VTDC,R->left,R->top,R->right - R->left,R->bottom - R->top,hdcBG,R->left,R->top,SRCCOPY);
1256    }
1257    
1258    void BGScrollWindow(HWND hwnd,int xa,int ya,RECT *Rect,RECT *ClipRect)
1259    {
1260      if(!BGEnable)
1261        ScrollWindow(hwnd,xa,ya,Rect,ClipRect);
1262      else
1263        InvalidateRect(HVTWin,ClipRect,FALSE);
1264    }
1265    
1266    void BGOnEnterSizeMove(void)
1267    {
1268      int  r,g,b;
1269    
1270      if(!BGEnable || !BGFastSizeMove)
1271        return;
1272    
1273      BGInSizeMove = TRUE;
1274    
1275      //背景色生成
1276      r = GetRValue(BGDest.color);
1277      g = GetGValue(BGDest.color);
1278      b = GetBValue(BGDest.color);
1279    
1280      r = (r * (255 - BGSrc1.alpha) + GetRValue(BGSrc1.color) * BGSrc1.alpha) >> 8;
1281      g = (g * (255 - BGSrc1.alpha) + GetGValue(BGSrc1.color) * BGSrc1.alpha) >> 8;
1282      b = (b * (255 - BGSrc1.alpha) + GetBValue(BGSrc1.color) * BGSrc1.alpha) >> 8;
1283    
1284      r = (r * (255 - BGSrc2.alpha) + GetRValue(BGSrc2.color) * BGSrc2.alpha) >> 8;
1285      g = (g * (255 - BGSrc2.alpha) + GetGValue(BGSrc2.color) * BGSrc2.alpha) >> 8;
1286      b = (b * (255 - BGSrc2.alpha) + GetBValue(BGSrc2.color) * BGSrc2.alpha) >> 8;
1287    
1288      BGBrushInSizeMove = CreateSolidBrush(RGB(r,g,b));
1289    }
1290    
1291    void BGOnExitSizeMove(void)
1292    {
1293      if(!BGEnable || !BGFastSizeMove)
1294        return;
1295    
1296      BGInSizeMove = FALSE;
1297    
1298      BGSetupPrimary(TRUE);
1299      InvalidateRect(HVTWin,NULL,FALSE);
1300    
1301      //ブラシを削除
1302      if(BGBrushInSizeMove)
1303      {
1304        DeleteObject(BGBrushInSizeMove);
1305        BGBrushInSizeMove = NULL;
1306      }
1307    }
1308    
1309    void BGOnSettingChange(void)
1310    {
1311      if(!BGEnable)
1312        return;
1313    
1314      CRTWidth  = GetSystemMetrics(SM_CXSCREEN);
1315      CRTHeight = GetSystemMetrics(SM_CYSCREEN);
1316    
1317      //壁紙 or 背景をプリロード
1318      BGPreloadSrc(&BGDest);
1319      BGPreloadSrc(&BGSrc1);
1320      BGPreloadSrc(&BGSrc2);
1321    
1322      BGSetupPrimary(TRUE);
1323      InvalidateRect(HVTWin,0,FALSE);
1324    }
1325    
1326    //-->
1327    #endif  // ALPHABLEND_TYPE2
1328    
1329  void InitDisp()  void InitDisp()
1330  {  {
1331    HDC TmpDC;    HDC TmpDC;
# Line 100  void InitDisp() Line 1367  void InitDisp()
1367    ANSIColor[IdFore+8]    = RGB(192,192,192);    ANSIColor[IdFore+8]    = RGB(192,192,192);
1368  #endif /* NO_ANSI_COLOR_EXTENSION */  #endif /* NO_ANSI_COLOR_EXTENSION */
1369    
1370    #ifdef ALPHABLEND_TYPE2
1371      CRTWidth  = GetSystemMetrics(SM_CXSCREEN);
1372      CRTHeight = GetSystemMetrics(SM_CYSCREEN);
1373    
1374      BGInitialize();
1375    
1376      if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0)
1377      {
1378        ANSIColor[IdBack ]   = BGVTColor[1];
1379        ANSIColor[IdFore ]   = BGVTColor[0];
1380      }
1381    #endif  // ALPHABLEND_TYPE2
1382    
1383    for (i = IdBack ; i <= IdFore+8 ; i++)    for (i = IdBack ; i <= IdFore+8 ; i++)
1384      ANSIColor[i] = GetNearestColor(TmpDC, ANSIColor[i]);      ANSIColor[i] = GetNearestColor(TmpDC, ANSIColor[i]);
1385    
# Line 191  void EndDisp() Line 1471  void EndDisp()
1471          DeleteObject(Background);          DeleteObject(Background);
1472          Background = 0;          Background = 0;
1473    }    }
1474    
1475    #ifdef ALPHABLEND_TYPE2
1476    //<!--by AKASI
1477      BGDestruct();
1478    //-->
1479    #endif  // ALPHABLEND_TYPE2
1480    
1481  }  }
1482    
1483  void DispReset()  void DispReset()
# Line 541  void PaintWindow(HDC PaintDC, RECT Paint Line 1828  void PaintWindow(HDC PaintDC, RECT Paint
1828    VTDC = PaintDC;    VTDC = PaintDC;
1829    DCPrevFont = SelectObject(VTDC, VTFont[0]);    DCPrevFont = SelectObject(VTDC, VTFont[0]);
1830    DispInitDC();    DispInitDC();
1831    
1832    #ifdef ALPHABLEND_TYPE2
1833    //<!--by AKASI
1834    //if (fBkGnd)
1835      if(!BGEnable && fBkGnd)
1836    //-->
1837    #else
1838    if (fBkGnd)    if (fBkGnd)
1839    #endif  // ALPHABLEND_TYPE2
1840    
1841      FillRect(VTDC, &PaintRect,Background);      FillRect(VTDC, &PaintRect,Background);
1842    
1843    *Xs = PaintRect.left / FontWidth + WinOrgX;    *Xs = PaintRect.left / FontWidth + WinOrgX;
# Line 583  void DispChangeBackground() Line 1879  void DispChangeBackground()
1879  {  {
1880    DispReleaseDC();    DispReleaseDC();
1881    if (Background != NULL) DeleteObject(Background);    if (Background != NULL) DeleteObject(Background);
1882    #ifdef ALPHABLEND_TYPE2
1883      Background = CreateSolidBrush(BGVTColor[1]);
1884    #else
1885    Background = CreateSolidBrush(ts.VTColor[1]);    Background = CreateSolidBrush(ts.VTColor[1]);
1886    #endif  // ALPHABLEND_TYPE2
1887    
1888    
1889    InvalidateRect(HVTWin,NULL,TRUE);    InvalidateRect(HVTWin,NULL,TRUE);
1890  }  }
# Line 614  void DispChangeWin() Line 1915  void DispChangeWin()
1915    else { // use text (background) color for "white (black)"    else { // use text (background) color for "white (black)"
1916      ANSIColor[IdFore ]   = ts.VTColor[0];      ANSIColor[IdFore ]   = ts.VTColor[0];
1917      ANSIColor[IdBack ]   = ts.VTColor[1];      ANSIColor[IdBack ]   = ts.VTColor[1];
1918    
1919    #ifdef ALPHABLEND_TYPE2
1920          ANSIColor[IdFore ]   = BGVTColor[0];
1921         ANSIColor[IdBack ]   = BGVTColor[1];
1922    #endif  // ALPHABLEND_TYPE2
1923    
1924    }    }
1925    
1926    /* change background color */    /* change background color */
# Line 629  void DispInitDC() Line 1936  void DispInitDC()
1936    }    }
1937    else    else
1938      SelectObject(VTDC, VTFont[0]);      SelectObject(VTDC, VTFont[0]);
1939    
1940    #ifdef ALPHABLEND_TYPE2
1941      SetTextColor(VTDC, BGVTColor[0]);
1942      SetBkColor(VTDC, BGVTColor[1]);
1943    #else
1944    SetTextColor(VTDC, ts.VTColor[0]);    SetTextColor(VTDC, ts.VTColor[0]);
1945    SetBkColor(VTDC, ts.VTColor[1]);    SetBkColor(VTDC, ts.VTColor[1]);
1946    #endif  // ALPHABLEND_TYPE2
1947    
1948    SetBkMode(VTDC,OPAQUE);    SetBkMode(VTDC,OPAQUE);
1949    DCAttr = AttrDefault;    DCAttr = AttrDefault;
1950    DCAttr2 = AttrDefault2;    DCAttr2 = AttrDefault2;
1951    DCReverse = FALSE;    DCReverse = FALSE;
1952    
1953    #ifdef ALPHABLEND_TYPE2
1954    //<!--by AKASI
1955      BGReverseText = FALSE;
1956    //-->
1957    #endif  // ALPHABLEND_TYPE2
1958  }  }
1959    
1960  void DispReleaseDC()  void DispReleaseDC()
# Line 667  void DispSetupDC(BYTE Attr, BYTE Attr2, Line 1987  void DispSetupDC(BYTE Attr, BYTE Attr2,
1987    {    {
1988          if ((Attr & AttrBlink) != 0)          if ((Attr & AttrBlink) != 0)
1989          {          {
1990            TextColor = ts.VTBlinkColor[0];  
1991            BackColor = ts.VTBlinkColor[1];  #ifdef ALPHABLEND_TYPE2
1992    //<!--by AKASI
1993    //  TextColor = ts.VTBlinkColor[0];
1994    //  BackColor = ts.VTBlinkColor[1];
1995              TextColor = BGVTBlinkColor[0];
1996              BackColor = BGVTBlinkColor[1];
1997    //-->
1998    #else
1999      TextColor = ts.VTBlinkColor[0];
2000      BackColor = ts.VTBlinkColor[1];
2001    #endif
2002          }          }
2003          else if ((Attr & AttrBold) != 0)          else if ((Attr & AttrBold) != 0)
2004          {          {
2005            TextColor = ts.VTBoldColor[0];  #ifdef ALPHABLEND_TYPE2
2006            BackColor = ts.VTBoldColor[1];  //<!--by AKASI
2007    //  TextColor = ts.VTBoldColor[0];
2008    //  BackColor = ts.VTBoldColor[1];
2009              TextColor = BGVTBoldColor[0];
2010              BackColor = BGVTBoldColor[1];
2011    //-->
2012    #else
2013      TextColor = ts.VTBoldColor[0];
2014      BackColor = ts.VTBoldColor[1];
2015    #endif
2016          }          }
2017          else {          else {
2018            if ((Attr2 & Attr2Fore) != 0)            if ((Attr2 & Attr2Fore) != 0)
# Line 682  void DispSetupDC(BYTE Attr, BYTE Attr2, Line 2021  void DispSetupDC(BYTE Attr, BYTE Attr2,
2021                  TextColor = ANSIColor[j];                  TextColor = ANSIColor[j];
2022            }            }
2023            else            else
2024                  TextColor = ts.VTColor[0];  #ifdef ALPHABLEND_TYPE2
2025    //<!--by AKASI
2026    //  TextColor = ts.VTColor[0];
2027        TextColor = BGVTColor[0];
2028    //-->
2029    #else
2030      TextColor = ts.VTColor[0];
2031    #endif
2032    
2033            if ((Attr2 & Attr2Back) != 0)            if ((Attr2 & Attr2Back) != 0)
2034            {            {
# Line 690  void DispSetupDC(BYTE Attr, BYTE Attr2, Line 2036  void DispSetupDC(BYTE Attr, BYTE Attr2,
2036                  BackColor = ANSIColor[j];                  BackColor = ANSIColor[j];
2037            }            }
2038            else            else
2039                  BackColor = ts.VTColor[1];  #ifdef ALPHABLEND_TYPE2
2040    //<!--by AKASI
2041    //  BackColor = ts.VTColor[1];
2042        BackColor = BGVTColor[1];
2043    //-->
2044    #else
2045      BackColor = ts.VTColor[1];
2046    #endif
2047          }          }
2048    }    }
2049    else { // full color    else { // full color
# Line 708  void DispSetupDC(BYTE Attr, BYTE Attr2, Line 2061  void DispSetupDC(BYTE Attr, BYTE Attr2,
2061            TextColor = ANSIColor[j];            TextColor = ANSIColor[j];
2062          }          }
2063          else if ((Attr & AttrBlink) != 0)          else if ((Attr & AttrBlink) != 0)
2064            TextColor = ts.VTBlinkColor[0];  #ifdef ALPHABLEND_TYPE2
2065    //<!--by AKASI
2066    //  TextColor = ts.VTBlinkColor[0];
2067        TextColor = BGVTBlinkColor[0];
2068    //-->
2069            else if ((Attr & AttrBold) != 0)
2070    //<!--by AKASI
2071    //  TextColor = ts.VTBoldColor[0];
2072        TextColor = BGVTBoldColor[0];
2073    //-->
2074      else
2075    //<!--by AKASI
2076    //  TextColor = ts.VTColor[0];
2077        TextColor = BGVTColor[0];
2078    //-->
2079    #else
2080      TextColor = ts.VTBlinkColor[0];
2081          else if ((Attr & AttrBold) != 0)          else if ((Attr & AttrBold) != 0)
2082            TextColor = ts.VTBoldColor[0];              TextColor = ts.VTBoldColor[0];
2083          else    else
2084            TextColor = ts.VTColor[0];    TextColor = ts.VTColor[0];
2085    #endif
2086    
2087          if ((Attr2 & Attr2Back) != 0)          if ((Attr2 & Attr2Back) != 0)
2088          {          {
# Line 728  void DispSetupDC(BYTE Attr, BYTE Attr2, Line 2098  void DispSetupDC(BYTE Attr, BYTE Attr2,
2098            BackColor = ANSIColor[j];            BackColor = ANSIColor[j];
2099          }          }
2100          else if ((Attr & AttrBlink) != 0)          else if ((Attr & AttrBlink) != 0)
2101            BackColor = ts.VTBlinkColor[1];  #ifdef ALPHABLEND_TYPE2
2102    //<!--by AKASI
2103    //  BackColor = ts.VTBlinkColor[1];
2104        BackColor = BGVTBlinkColor[1];
2105    //-->
2106            else if ((Attr & AttrBold) != 0)
2107    //<!--by AKASI
2108    //  BackColor = ts.VTBoldColor[1];
2109        BackColor = BGVTBoldColor[1];
2110    //-->
2111      else
2112      BackColor = ts.VTColor[1];
2113    #else
2114      BackColor = ts.VTBlinkColor[1];
2115          else if ((Attr & AttrBold) != 0)          else if ((Attr & AttrBold) != 0)
2116            BackColor = ts.VTBoldColor[1];              BackColor = ts.VTBoldColor[1];
2117          else    else
2118            BackColor = ts.VTColor[1];    BackColor = ts.VTColor[1];
2119    #endif
2120    }    }
2121    
2122    if (Reverse != ((Attr & AttrReverse) != 0))    if (Reverse != ((Attr & AttrReverse) != 0))
2123    {    {
2124    #ifdef ALPHABLEND_TYPE2
2125    //<!--by AKASI
2126        BGReverseText = TRUE;
2127    //-->
2128    #endif
2129      SetTextColor(VTDC,BackColor);      SetTextColor(VTDC,BackColor);
2130      SetBkColor(  VTDC,TextColor);      SetBkColor(  VTDC,TextColor);
2131    }    }
2132    else {    else {
2133    #ifdef ALPHABLEND_TYPE2
2134    //<!--by AKASI
2135        BGReverseText = FALSE;
2136    //-->
2137    #endif
2138      SetTextColor(VTDC,TextColor);      SetTextColor(VTDC,TextColor);
2139      SetBkColor(  VTDC,BackColor);      SetBkColor(  VTDC,BackColor);
2140    }    }
# Line 766  void DispStr(PCHAR Buff, int Count, int Line 2160  void DispStr(PCHAR Buff, int Count, int
2160    RText.bottom = Y+FontHeight;    RText.bottom = Y+FontHeight;
2161    RText.left = *X;    RText.left = *X;
2162    RText.right = *X + Count*FontWidth;    RText.right = *X + Count*FontWidth;
2163    
2164    #ifdef ALPHABLEND_TYPE2
2165    //<!--by AKASI
2166      if(!BGEnable)
2167      {
2168        ExtTextOut(VTDC,*X+ts.FontDX,Y+ts.FontDY,
2169                   ETO_CLIPPED | ETO_OPAQUE,
2170                   &RText,Buff,Count,&Dx[0]);
2171      }else{
2172    
2173        int   width;
2174        int   height;
2175        int   eto_options = ETO_CLIPPED;
2176        RECT  rect;
2177        HFONT hPrevFont;
2178    
2179        width  = Count*FontWidth;
2180        height = FontHeight;
2181        SetRect(&rect,0,0,width,height);
2182    
2183        //hdcBGBuffer の属性を設定
2184        hPrevFont = SelectObject(hdcBGBuffer,GetCurrentObject(VTDC,OBJ_FONT));
2185        SetTextColor(hdcBGBuffer,GetTextColor(VTDC));
2186        SetBkColor(hdcBGBuffer,GetBkColor(VTDC));
2187    
2188        //窓の移動、リサイズ中は背景を BGBrushInSizeMove で塗りつぶす
2189        if(BGInSizeMove)
2190          FillRect(hdcBGBuffer,&rect,BGBrushInSizeMove);
2191    
2192        BitBlt(hdcBGBuffer,0,0,width,height,hdcBG,*X,Y,SRCCOPY);
2193    
2194        if(BGReverseText == TRUE)
2195        {
2196          if(BGReverseTextAlpha < 255)
2197          {
2198            BGBLENDFUNCTION bf;
2199            HBRUSH hbr;
2200    
2201            hbr = CreateSolidBrush(GetBkColor(hdcBGBuffer));
2202            FillRect(hdcBGWork,&rect,hbr);
2203            DeleteObject(hbr);
2204    
2205            ZeroMemory(&bf,sizeof(bf));
2206            bf.BlendOp             = AC_SRC_OVER;
2207            bf.SourceConstantAlpha = BGReverseTextAlpha;
2208    
2209            BGAlphaBlend(hdcBGBuffer,0,0,width,height,hdcBGWork,0,0,width,height,bf);
2210          }else{
2211            eto_options |= ETO_OPAQUE;
2212          }
2213        }
2214        
2215        ExtTextOut(hdcBGBuffer,ts.FontDX,ts.FontDY,eto_options,&rect,Buff,Count,&Dx[0]);
2216        BitBlt(VTDC,*X,Y,width,height,hdcBGBuffer,0,0,SRCCOPY);
2217    
2218        SelectObject(hdcBGBuffer,hPrevFont);
2219      }
2220    //-->
2221    #else
2222    ExtTextOut(VTDC,*X+ts.FontDX,Y+ts.FontDY,    ExtTextOut(VTDC,*X+ts.FontDX,Y+ts.FontDY,
2223               ETO_CLIPPED | ETO_OPAQUE,               ETO_CLIPPED | ETO_OPAQUE,
2224               &RText,Buff,Count,&Dx[0]);               &RText,Buff,Count,&Dx[0]);
2225    #endif
2226    *X = RText.right;    *X = RText.right;
2227    
2228    if ((ts.Language==IdRussian) &&    if ((ts.Language==IdRussian) &&
# Line 857  void DispEraseCurToEnd(int YEnd) Line 2311  void DispEraseCurToEnd(int YEnd)
2311    R.right = ScreenWidth;    R.right = ScreenWidth;
2312    R.top = (CursorY+1-WinOrgY)*FontHeight;    R.top = (CursorY+1-WinOrgY)*FontHeight;
2313    R.bottom = (YEnd+1-WinOrgY)*FontHeight;    R.bottom = (YEnd+1-WinOrgY)*FontHeight;
2314    
2315    #ifdef ALPHABLEND_TYPE2
2316    //<!--by AKASI
2317    //  FillRect(VTDC,&R,Background);
2318      BGFillRect(VTDC,&R,Background);
2319    //-->
2320    #else
2321    FillRect(VTDC,&R,Background);    FillRect(VTDC,&R,Background);
2322    #endif
2323    
2324    R.left = (CursorX-WinOrgX)*FontWidth;    R.left = (CursorX-WinOrgX)*FontWidth;
2325    R.bottom = R.top;    R.bottom = R.top;
2326    R.top = R.bottom-FontHeight;    R.top = R.bottom-FontHeight;
2327    
2328    #ifdef ALPHABLEND_TYPE2
2329    //<!--by AKASI
2330    //  FillRect(VTDC,&R,Background);
2331      BGFillRect(VTDC,&R,Background);
2332    //-->
2333    #else
2334    FillRect(VTDC,&R,Background);    FillRect(VTDC,&R,Background);
2335    #endif
2336  }  }
2337    
2338  void DispEraseHomeToCur(int YHome)  void DispEraseHomeToCur(int YHome)
# Line 873  void DispEraseHomeToCur(int YHome) Line 2344  void DispEraseHomeToCur(int YHome)
2344    R.right = ScreenWidth;    R.right = ScreenWidth;
2345    R.top = (YHome-WinOrgY)*FontHeight;    R.top = (YHome-WinOrgY)*FontHeight;
2346    R.bottom = (CursorY-WinOrgY)*FontHeight;    R.bottom = (CursorY-WinOrgY)*FontHeight;
2347    
2348    #ifdef ALPHABLEND_TYPE2
2349    //<!--by AKASI
2350    //  FillRect(VTDC,&R,Background);
2351      BGFillRect(VTDC,&R,Background);
2352    //-->
2353    #else
2354    FillRect(VTDC,&R,Background);    FillRect(VTDC,&R,Background);
2355    #endif
2356    
2357    R.top = R.bottom;    R.top = R.bottom;
2358    R.bottom = R.top + FontHeight;    R.bottom = R.top + FontHeight;
2359    R.right = (CursorX+1-WinOrgX)*FontWidth;    R.right = (CursorX+1-WinOrgX)*FontWidth;
2360    
2361    #ifdef ALPHABLEND_TYPE2
2362    //<!--by AKASI
2363    //  FillRect(VTDC,&R,Background);
2364      BGFillRect(VTDC,&R,Background);
2365    //-->
2366    #else
2367    FillRect(VTDC,&R,Background);    FillRect(VTDC,&R,Background);
2368    #endif
2369  }  }
2370    
2371  void DispEraseCharsInLine(int XStart, int Count)  void DispEraseCharsInLine(int XStart, int Count)
# Line 889  void DispEraseCharsInLine(int XStart, in Line 2377  void DispEraseCharsInLine(int XStart, in
2377    R.bottom = R.top+FontHeight;    R.bottom = R.top+FontHeight;
2378    R.left = (XStart-WinOrgX)*FontWidth;    R.left = (XStart-WinOrgX)*FontWidth;
2379    R.right = R.left + Count * FontWidth;    R.right = R.left + Count * FontWidth;
2380    
2381    #ifdef ALPHABLEND_TYPE2
2382    //<!--by AKASI
2383    //  FillRect(VTDC,&R,Background);
2384      BGFillRect(VTDC,&R,Background);
2385    //-->
2386    #else
2387    FillRect(VTDC,&R,Background);    FillRect(VTDC,&R,Background);
2388    #endif
2389  }  }
2390    
2391  BOOL DispDeleteLines(int Count, int YEnd)  BOOL DispDeleteLines(int Count, int YEnd)
# Line 906  BOOL DispDeleteLines(int Count, int YEnd Line 2402  BOOL DispDeleteLines(int Count, int YEnd
2402          R.right = ScreenWidth;          R.right = ScreenWidth;
2403          R.top = (CursorY-WinOrgY)*FontHeight;          R.top = (CursorY-WinOrgY)*FontHeight;
2404          R.bottom = (YEnd+1-WinOrgY)*FontHeight;          R.bottom = (YEnd+1-WinOrgY)*FontHeight;
2405          ScrollWindow(HVTWin,0,-FontHeight*Count,&R,&R);  #ifdef ALPHABLEND_TYPE2
2406    //<!--by AKASI
2407    //  ScrollWindow(HVTWin,0,-FontHeight*Count,&R,&R);
2408      BGScrollWindow(HVTWin,0,-FontHeight*Count,&R,&R);
2409    //-->
2410    #else
2411      ScrollWindow(HVTWin,0,-FontHeight*Count,&R,&R);
2412    #endif
2413          UpdateWindow(HVTWin);          UpdateWindow(HVTWin);
2414          return TRUE;          return TRUE;
2415    }    }
# Line 928  BOOL DispInsertLines(int Count, int YEnd Line 2431  BOOL DispInsertLines(int Count, int YEnd
2431      R.right = ScreenWidth;      R.right = ScreenWidth;
2432      R.top = (CursorY-WinOrgY)*FontHeight;      R.top = (CursorY-WinOrgY)*FontHeight;
2433      R.bottom = (YEnd+1-WinOrgY)*FontHeight;      R.bottom = (YEnd+1-WinOrgY)*FontHeight;
2434      ScrollWindow(HVTWin,0,FontHeight*Count,&R,&R);  #ifdef ALPHABLEND_TYPE2
2435    //<!--by AKASI
2436    //  ScrollWindow(HVTWin,0,FontHeight*Count,&R,&R);
2437        BGScrollWindow(HVTWin,0,FontHeight*Count,&R,&R);
2438    //-->
2439    #else
2440      ScrollWindow(HVTWin,0,FontHeight*Count,&R,&R);
2441    #endif
2442          UpdateWindow(HVTWin);          UpdateWindow(HVTWin);
2443      return TRUE;      return TRUE;
2444    }    }
# Line 1068  void DispUpdateScroll() Line 2578  void DispUpdateScroll()
2578      R.right = ScreenWidth;      R.right = ScreenWidth;
2579      R.top = (SRegionTop-WinOrgY)*FontHeight;      R.top = (SRegionTop-WinOrgY)*FontHeight;
2580      R.bottom = (SRegionBottom+1-WinOrgY)*FontHeight;      R.bottom = (SRegionBottom+1-WinOrgY)*FontHeight;
2581      ScrollWindow(HVTWin,0,-d,&R,&R);  #ifdef ALPHABLEND_TYPE2
2582    //<!--by AKASI
2583    //  ScrollWindow(HVTWin,0,-d,&R,&R);
2584        BGScrollWindow(HVTWin,0,-d,&R,&R);
2585    //-->
2586    #else
2587      ScrollWindow(HVTWin,0,-d,&R,&R);
2588    #endif
2589    
2590      if ((SRegionTop==0) && (dScroll>0))      if ((SRegionTop==0) && (dScroll>0))
2591          { // update scroll bar if BuffEnd is changed          { // update scroll bar if BuffEnd is changed
2592            if ((BuffEnd==WinHeight) &&            if ((BuffEnd==WinHeight) &&
# Line 1095  void DispUpdateScroll() Line 2613  void DispUpdateScroll()
2613    if (NewOrgX==WinOrgX)    if (NewOrgX==WinOrgX)
2614    {    {
2615      d = (NewOrgY-WinOrgY) * FontHeight;      d = (NewOrgY-WinOrgY) * FontHeight;
2616      ScrollWindow(HVTWin,0,-d,NULL,NULL);  #ifdef ALPHABLEND_TYPE2
2617    //<!--by AKASI
2618    //  ScrollWindow(HVTWin,0,-d,NULL,NULL);
2619        BGScrollWindow(HVTWin,0,-d,NULL,NULL);
2620    //-->
2621    #else
2622      ScrollWindow(HVTWin,0,-d,NULL,NULL);
2623    #endif
2624    }    }
2625    else if (NewOrgY==WinOrgY)    else if (NewOrgY==WinOrgY)
2626    {    {
2627      d = (NewOrgX-WinOrgX) * FontWidth;      d = (NewOrgX-WinOrgX) * FontWidth;
2628      ScrollWindow(HVTWin,-d,0,NULL,NULL);  #ifdef ALPHABLEND_TYPE2
2629    //<!--by AKASI
2630    //  ScrollWindow(HVTWin,-d,0,NULL,NULL);
2631        BGScrollWindow(HVTWin,-d,0,NULL,NULL);
2632    //-->
2633    #else
2634      ScrollWindow(HVTWin,-d,0,NULL,NULL);
2635    #endif
2636    }    }
2637    else    else
2638      InvalidateRect(HVTWin,NULL,TRUE);      InvalidateRect(HVTWin,NULL,TRUE);
# Line 1257  void DispSetWinPos() Line 2789  void DispSetWinPos()
2789    Point.y = ScreenHeight;    Point.y = ScreenHeight;
2790    ClientToScreen(HVTWin,&Point);    ClientToScreen(HVTWin,&Point);
2791    CompletelyVisible = (Point.y <= VirtualScreen.bottom);    CompletelyVisible = (Point.y <= VirtualScreen.bottom);
2792    
2793    #ifdef ALPHABLEND_TYPE2
2794       if(BGEnable)
2795            InvalidateRect(HVTWin,0,FALSE);
2796    #endif
2797  }  }
2798    
2799  void DispSetActive(BOOL ActiveFlag)  void DispSetActive(BOOL ActiveFlag)

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

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