[Ttssh2-commit] [4579] Windows7 の新しい壁紙設定に対応した。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 8月 13日 (土) 18:11:06 JST


Revision: 4579
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4579
Author:   yutakapon
Date:     2011-08-13 18:11:06 +0900 (Sat, 13 Aug 2011)

Log Message:
-----------
Windows7 の新しい壁紙設定に対応した。

      WallpaperStyle  動作
Fill  10              高さをめいっぱいにする(左右ががはみ出す)
Fit   6               幅をめいっぱいにする(上下がはみ出す)

Modified Paths:
--------------
    trunk/teraterm/teraterm/vtdisp.c


-------------- next part --------------
Modified: trunk/teraterm/teraterm/vtdisp.c
===================================================================
--- trunk/teraterm/teraterm/vtdisp.c	2011-08-13 08:26:34 UTC (rev 4578)
+++ trunk/teraterm/teraterm/vtdisp.c	2011-08-13 09:11:06 UTC (rev 4579)
@@ -632,6 +632,12 @@
   else
   if(wi->pattern == 2)
     wi->pattern = BG_STRETCH;
+  else
+  if(wi->pattern == 10)
+	  wi->pattern = BG_FIT_HEIGHT;
+  else
+  if(wi->pattern == 6)
+	  wi->pattern = BG_FIT_WIDTH;
 
   //ƒŒƒWƒXƒgƒŠƒL[‚̃Nƒ[ƒY
   RegCloseKey(hKey);
@@ -793,6 +799,7 @@
 	HBITMAP       hbm;
 	WallpaperInfo wi;
 	OSVERSIONINFO osvi;
+	int s_width, s_height;
 
 	BGGetWallpaperInfo(&wi);
 
@@ -816,15 +823,41 @@
 		}
 	}
 	else {
+		BITMAP bm;
+		float ratio;
+
 		hbm = GetBitmapHandle(wi.filename);
 
 #ifdef DEBUG_XP
-		wi.pattern = BG_STRETCH; 
+		//wi.pattern = BG_STRETCH; 
+		//wi.pattern = BG_FIT_WIDTH; 
+		//wi.pattern = BG_FIT_HEIGHT; 
 #endif
+
+		GetObject(hbm,sizeof(bm),&bm);
+		// •ÇŽ†‚̐ݒè‚ɍ‡‚킹‚āA‰æ‘œ‚̃XƒgƒŒƒbƒ`ƒTƒCƒY‚ðŒˆ‚ß‚éB
 		if (wi.pattern == BG_STRETCH) {
-			HBITMAP newhbm = CreateStretched32BppBitmapBilinear(hbm, CRTWidth, CRTHeight);
+			s_width = CRTWidth;
+			s_height = CRTHeight;
+		} else if (wi.pattern == BG_FIT_WIDTH) {
+			ratio = (float)CRTWidth / bm.bmWidth;
+			s_width = CRTWidth;
+			s_height = (int)(CRTHeight * ratio);
+		} else if (wi.pattern == BG_FIT_HEIGHT) {
+			ratio = (float)CRTHeight / bm.bmHeight;
+			s_width = (int)(CRTWidth * ratio);
+			s_height = CRTHeight;
+		} else {
+			s_width = 0;
+			s_height = 0;
+		}
+
+		if (s_width && s_height) {
+			HBITMAP newhbm = CreateStretched32BppBitmapBilinear(hbm, s_width, s_height);
 			DeleteObject(hbm);
 			hbm = newhbm;
+
+			wi.pattern = BG_STRETCH; 
 		}
 	}
 



Ttssh2-commit メーリングリストの案内
Back to archive index