| 1 |
yutakakn |
1.1 |
/* Tera Term |
| 2 |
|
|
Copyright(C) 1994-1998 T. Teranishi |
| 3 |
|
|
All rights reserved. */ |
| 4 |
|
|
|
| 5 |
|
|
/* TERATERM.EXE, VT terminal display routines */ |
| 6 |
|
|
#include "teraterm.h" |
| 7 |
|
|
#include "tttypes.h" |
| 8 |
|
|
#include "string.h" |
| 9 |
|
|
|
| 10 |
|
|
#include "ttwinman.h" |
| 11 |
|
|
#include "ttime.h" |
| 12 |
|
|
#include "ttdialog.h" |
| 13 |
|
|
#include "ttcommon.h" |
| 14 |
|
|
|
| 15 |
|
|
#include "vtdisp.h" |
| 16 |
|
|
|
| 17 |
|
|
#include <locale.h> |
| 18 |
|
|
|
| 19 |
|
|
#define CurWidth 2 |
| 20 |
|
|
|
| 21 |
|
|
int WinWidth, WinHeight; |
| 22 |
|
|
static BOOL Active = FALSE; |
| 23 |
|
|
static BOOL CompletelyVisible; |
| 24 |
|
|
HFONT VTFont[AttrFontMask+1]; |
| 25 |
|
|
int FontHeight, FontWidth, ScreenWidth, ScreenHeight; |
| 26 |
|
|
BOOL AdjustSize; |
| 27 |
|
|
BOOL DontChangeSize=FALSE; |
| 28 |
yutakakn |
1.3 |
#ifdef ALPHABLEND_TYPE2 |
| 29 |
|
|
static int CRTWidth, CRTHeight; |
| 30 |
|
|
#endif |
| 31 |
|
|
int CursorX, CursorY; |
| 32 |
|
|
/* Virtual screen region */ |
| 33 |
|
|
RECT VirtualScreen; |
| 34 |
|
|
|
| 35 |
|
|
// --- scrolling status flags |
| 36 |
|
|
int WinOrgX, WinOrgY, NewOrgX, NewOrgY; |
| 37 |
|
|
|
| 38 |
|
|
int NumOfLines, NumOfColumns; |
| 39 |
|
|
int PageStart, BuffEnd; |
| 40 |
|
|
|
| 41 |
|
|
static BOOL CursorOnDBCS = FALSE; |
| 42 |
|
|
static LOGFONT VTlf; |
| 43 |
|
|
static BOOL SaveWinSize = FALSE; |
| 44 |
|
|
static int WinWidthOld, WinHeightOld; |
| 45 |
|
|
static HBRUSH Background; |
| 46 |
doda |
1.25 |
static COLORREF ANSIColor[256]; |
| 47 |
yutakakn |
1.3 |
static int Dx[256]; |
| 48 |
|
|
|
| 49 |
|
|
// caret variables |
| 50 |
|
|
static int CaretStatus; |
| 51 |
|
|
static BOOL CaretEnabled = TRUE; |
| 52 |
|
|
|
| 53 |
|
|
// ---- device context and status flags |
| 54 |
|
|
static HDC VTDC = NULL; /* Device context for VT window */ |
| 55 |
doda |
1.25 |
static TCharAttr DCAttr; |
| 56 |
yutakakn |
1.3 |
static BOOL DCReverse; |
| 57 |
|
|
static HFONT DCPrevFont; |
| 58 |
|
|
|
| 59 |
doda |
1.25 |
TCharAttr DefCharAttr = { |
| 60 |
|
|
AttrDefault, |
| 61 |
|
|
AttrDefault, |
| 62 |
|
|
AttrDefaultFG, |
| 63 |
|
|
AttrDefaultBG |
| 64 |
|
|
}; |
| 65 |
|
|
|
| 66 |
yutakakn |
1.3 |
// scrolling |
| 67 |
|
|
static int ScrollCount = 0; |
| 68 |
|
|
static int dScroll = 0; |
| 69 |
|
|
static int SRegionTop; |
| 70 |
|
|
static int SRegionBottom; |
| 71 |
|
|
|
| 72 |
|
|
#ifdef ALPHABLEND_TYPE2 |
| 73 |
|
|
//<!--by AKASI |
| 74 |
|
|
#include "ttlib.h" |
| 75 |
|
|
#include <stdio.h> |
| 76 |
|
|
#include <time.h> |
| 77 |
|
|
|
| 78 |
|
|
#define BG_SECTION "BG" |
| 79 |
|
|
|
| 80 |
|
|
typedef enum _BG_TYPE {BG_COLOR = 0,BG_PICTURE,BG_WALLPAPER} BG_TYPE; |
| 81 |
|
|
typedef enum _BG_PATTERN {BG_STRETCH = 0,BG_TILE,BG_CENTER,BG_FIT_WIDTH,BG_FIT_HEIGHT,BG_AUTOFIT} BG_PATTERN; |
| 82 |
|
|
|
| 83 |
|
|
typedef struct _BGSrc |
| 84 |
|
|
{ |
| 85 |
|
|
HDC hdc; |
| 86 |
|
|
BG_TYPE type; |
| 87 |
|
|
BG_PATTERN pattern; |
| 88 |
|
|
BOOL antiAlias; |
| 89 |
|
|
COLORREF color; |
| 90 |
|
|
int alpha; |
| 91 |
|
|
int width; |
| 92 |
|
|
int height; |
| 93 |
|
|
char file[MAX_PATH]; |
| 94 |
|
|
char fileTmp[MAX_PATH]; |
| 95 |
|
|
}BGSrc; |
| 96 |
|
|
|
| 97 |
|
|
BGSrc BGDest; |
| 98 |
|
|
BGSrc BGSrc1; |
| 99 |
|
|
BGSrc BGSrc2; |
| 100 |
|
|
|
| 101 |
|
|
int BGEnable; |
| 102 |
|
|
int BGReverseTextAlpha; |
| 103 |
|
|
int BGUseAlphaBlendAPI; |
| 104 |
|
|
BOOL BGNoFrame; |
| 105 |
|
|
BOOL BGFastSizeMove; |
| 106 |
|
|
|
| 107 |
|
|
char BGSPIPath[MAX_PATH]; |
| 108 |
|
|
|
| 109 |
|
|
COLORREF BGVTColor[2]; |
| 110 |
|
|
COLORREF BGVTBoldColor[2]; |
| 111 |
|
|
COLORREF BGVTBlinkColor[2]; |
| 112 |
yutakakn |
1.5 |
/* begin - ishizaki */ |
| 113 |
|
|
COLORREF BGURLColor[2]; |
| 114 |
|
|
/* end - ishizaki */ |
| 115 |
yutakakn |
1.3 |
|
| 116 |
|
|
RECT BGPrevRect; |
| 117 |
|
|
BOOL BGReverseText; |
| 118 |
|
|
|
| 119 |
|
|
BOOL BGNoCopyBits; |
| 120 |
|
|
BOOL BGInSizeMove; |
| 121 |
|
|
HBRUSH BGBrushInSizeMove; |
| 122 |
|
|
|
| 123 |
|
|
HDC hdcBGWork; |
| 124 |
|
|
HDC hdcBGBuffer; |
| 125 |
|
|
HDC hdcBG; |
| 126 |
|
|
|
| 127 |
|
|
typedef struct tagWallpaperInfo |
| 128 |
|
|
{ |
| 129 |
|
|
char filename[MAX_PATH]; |
| 130 |
|
|
int pattern; |
| 131 |
|
|
}WallpaperInfo; |
| 132 |
|
|
|
| 133 |
|
|
typedef struct _BGBLENDFUNCTION |
| 134 |
|
|
{ |
| 135 |
|
|
BYTE BlendOp; |
| 136 |
|
|
BYTE BlendFlags; |
| 137 |
|
|
BYTE SourceConstantAlpha; |
| 138 |
|
|
BYTE AlphaFormat; |
| 139 |
|
|
}BGBLENDFUNCTION; |
| 140 |
|
|
|
| 141 |
|
|
BOOL (FAR WINAPI *BGAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BGBLENDFUNCTION); |
| 142 |
|
|
BOOL (FAR WINAPI *BGEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM); |
| 143 |
|
|
|
| 144 |
|
|
|
| 145 |
|
|
//?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 146 |
|
|
|
| 147 |
|
|
void dprintf(char *format, ...) |
| 148 |
|
|
{ |
| 149 |
|
|
va_list args; |
| 150 |
|
|
char buffer[1024]; |
| 151 |
|
|
|
| 152 |
|
|
va_start(args,format); |
| 153 |
|
|
|
| 154 |
maya |
1.11 |
_vsnprintf_s(buffer,sizeof(buffer),_TRUNCATE,format,args); |
| 155 |
|
|
strncat_s(buffer,sizeof(buffer),"\n",_TRUNCATE); |
| 156 |
yutakakn |
1.3 |
|
| 157 |
|
|
OutputDebugString(buffer); |
| 158 |
|
|
} |
| 159 |
|
|
|
| 160 |
|
|
HBITMAP CreateScreenCompatibleBitmap(int width,int height) |
| 161 |
|
|
{ |
| 162 |
|
|
HDC hdc; |
| 163 |
|
|
HBITMAP hbm; |
| 164 |
|
|
|
| 165 |
|
|
#ifdef _DEBUG |
| 166 |
|
|
dprintf("CreateScreenCompatibleBitmap : width = %d height = %d",width,height); |
| 167 |
|
|
#endif |
| 168 |
|
|
|
| 169 |
|
|
hdc = GetDC(NULL); |
| 170 |
|
|
|
| 171 |
|
|
hbm = CreateCompatibleBitmap(hdc,width,height); |
| 172 |
|
|
|
| 173 |
|
|
ReleaseDC(NULL,hdc); |
| 174 |
|
|
|
| 175 |
|
|
#ifdef _DEBUG |
| 176 |
|
|
if(!hbm) |
| 177 |
|
|
dprintf("CreateScreenCompatibleBitmap : fail in CreateCompatibleBitmap"); |
| 178 |
|
|
#endif |
| 179 |
|
|
|
| 180 |
|
|
return hbm; |
| 181 |
|
|
} |
| 182 |
|
|
|
| 183 |
|
|
HBITMAP CreateDIB24BPP(int width,int height,unsigned char **buf,int *lenBuf) |
| 184 |
|
|
{ |
| 185 |
|
|
HDC hdc; |
| 186 |
|
|
HBITMAP hbm; |
| 187 |
|
|
BITMAPINFO bmi; |
| 188 |
|
|
|
| 189 |
|
|
#ifdef _DEBUG |
| 190 |
|
|
dprintf("CreateDIB24BPP : width = %d height = %d",width,height); |
| 191 |
|
|
#endif |
| 192 |
|
|
|
| 193 |
|
|
if(!width || !height) |
| 194 |
|
|
return NULL; |
| 195 |
|
|
|
| 196 |
|
|
ZeroMemory(&bmi,sizeof(bmi)); |
| 197 |
|
|
|
| 198 |
|
|
*lenBuf = ((width * 3 + 3) & ~3) * height; |
| 199 |
|
|
|
| 200 |
|
|
bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); |
| 201 |
|
|
bmi.bmiHeader.biWidth = width; |
| 202 |
|
|
bmi.bmiHeader.biHeight = height; |
| 203 |
|
|
bmi.bmiHeader.biPlanes = 1; |
| 204 |
|
|
bmi.bmiHeader.biBitCount = 24; |
| 205 |
|
|
bmi.bmiHeader.biSizeImage = *lenBuf; |
| 206 |
|
|
bmi.bmiHeader.biCompression = BI_RGB; |
| 207 |
|
|
|
| 208 |
|
|
hdc = GetDC(NULL); |
| 209 |
|
|
|
| 210 |
|
|
hbm = CreateDIBSection(hdc,&bmi,DIB_RGB_COLORS,(void**)buf,NULL,0); |
| 211 |
|
|
|
| 212 |
|
|
ReleaseDC(NULL,hdc); |
| 213 |
|
|
|
| 214 |
|
|
return hbm; |
| 215 |
|
|
} |
| 216 |
|
|
|
| 217 |
|
|
HDC CreateBitmapDC(HBITMAP hbm) |
| 218 |
|
|
{ |
| 219 |
|
|
HDC hdc; |
| 220 |
|
|
|
| 221 |
|
|
#ifdef _DEBUG |
| 222 |
|
|
dprintf("CreateBitmapDC : hbm = %x",hbm); |
| 223 |
|
|
#endif |
| 224 |
|
|
|
| 225 |
|
|
hdc = CreateCompatibleDC(NULL); |
| 226 |
|
|
|
| 227 |
|
|
SaveDC(hdc); |
| 228 |
|
|
SelectObject(hdc,hbm); |
| 229 |
|
|
|
| 230 |
|
|
return hdc; |
| 231 |
|
|
} |
| 232 |
|
|
|
| 233 |
|
|
void DeleteBitmapDC(HDC *hdc) |
| 234 |
|
|
{ |
| 235 |
|
|
HBITMAP hbm; |
| 236 |
|
|
|
| 237 |
|
|
#ifdef _DEBUG |
| 238 |
|
|
dprintf("DeleteBitmapDC : *hdc = %x",hdc); |
| 239 |
|
|
#endif |
| 240 |
|
|
|
| 241 |
|
|
if(!hdc) |
| 242 |
|
|
return; |
| 243 |
|
|
|
| 244 |
|
|
if(!(*hdc)) |
| 245 |
|
|
return; |
| 246 |
|
|
|
| 247 |
|
|
hbm = GetCurrentObject(*hdc,OBJ_BITMAP); |
| 248 |
|
|
|
| 249 |
|
|
RestoreDC(*hdc,-1); |
| 250 |
|
|
DeleteObject(hbm); |
| 251 |
|
|
DeleteDC(*hdc); |
| 252 |
|
|
|
| 253 |
|
|
*hdc = 0; |
| 254 |
|
|
} |
| 255 |
|
|
|
| 256 |
|
|
void FillBitmapDC(HDC hdc,COLORREF color) |
| 257 |
|
|
{ |
| 258 |
|
|
HBITMAP hbm; |
| 259 |
|
|
BITMAP bm; |
| 260 |
|
|
RECT rect; |
| 261 |
|
|
HBRUSH hBrush; |
| 262 |
|
|
|
| 263 |
|
|
#ifdef _DEBUG |
| 264 |
|
|
dprintf("FillBitmapDC : hdc = %x color = %x",hdc,color); |
| 265 |
|
|
#endif |
| 266 |
|
|
|
| 267 |
|
|
if(!hdc) |
| 268 |
|
|
return; |
| 269 |
|
|
|
| 270 |
|
|
hbm = GetCurrentObject(hdc,OBJ_BITMAP); |
| 271 |
|
|
GetObject(hbm,sizeof(bm),&bm); |
| 272 |
|
|
|
| 273 |
|
|
SetRect(&rect,0,0,bm.bmWidth,bm.bmHeight); |
| 274 |
|
|
hBrush = CreateSolidBrush(color); |
| 275 |
|
|
FillRect(hdc,&rect,hBrush); |
| 276 |
|
|
DeleteObject(hBrush); |
| 277 |
|
|
} |
| 278 |
|
|
|
| 279 |
|
|
FARPROC GetProcAddressWithDllName(char *dllName,char *procName) |
| 280 |
|
|
{ |
| 281 |
|
|
HINSTANCE hDll; |
| 282 |
|
|
|
| 283 |
|
|
hDll = LoadLibrary(dllName); |
| 284 |
|
|
|
| 285 |
|
|
if(hDll) |
| 286 |
|
|
return GetProcAddress(hDll,procName); |
| 287 |
|
|
else |
| 288 |
|
|
return 0; |
| 289 |
|
|
} |
| 290 |
|
|
|
| 291 |
maya |
1.11 |
void RandomFile(char *filespec,char *filename, int destlen) |
| 292 |
yutakakn |
1.3 |
{ |
| 293 |
|
|
int i; |
| 294 |
|
|
int file_num; |
| 295 |
|
|
char fullpath[MAX_PATH]; |
| 296 |
|
|
char *filePart; |
| 297 |
|
|
|
| 298 |
|
|
HANDLE hFind; |
| 299 |
|
|
WIN32_FIND_DATA fd; |
| 300 |
|
|
|
| 301 |
|
|
//?ス?ス?ス?ス?スp?スX?ス?ス?ス?ス?ス?ス |
| 302 |
|
|
if(!GetFullPathName(filespec,MAX_PATH,fullpath,&filePart)) |
| 303 |
|
|
return; |
| 304 |
|
|
|
| 305 |
|
|
//?スt?ス@?スC?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 306 |
|
|
hFind = FindFirstFile(fullpath,&fd); |
| 307 |
|
|
|
| 308 |
|
|
file_num = 0; |
| 309 |
|
|
|
| 310 |
|
|
if(hFind != INVALID_HANDLE_VALUE && filePart) |
| 311 |
|
|
{ |
| 312 |
|
|
|
| 313 |
|
|
do{ |
| 314 |
|
|
|
| 315 |
|
|
if(!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) |
| 316 |
|
|
file_num ++; |
| 317 |
|
|
|
| 318 |
|
|
}while(FindNextFile(hFind,&fd)); |
| 319 |
|
|
|
| 320 |
|
|
} |
| 321 |
|
|
|
| 322 |
|
|
if(!file_num) |
| 323 |
|
|
return; |
| 324 |
|
|
|
| 325 |
|
|
FindClose(hFind); |
| 326 |
|
|
|
| 327 |
|
|
//?ス?ス?ス?ス?ス?ス?ス?ス?スt?ス@?スC?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スB |
| 328 |
|
|
file_num = rand()%file_num + 1; |
| 329 |
|
|
|
| 330 |
|
|
hFind = FindFirstFile(fullpath,&fd); |
| 331 |
|
|
|
| 332 |
|
|
if(hFind != INVALID_HANDLE_VALUE) |
| 333 |
|
|
{ |
| 334 |
|
|
i = 0; |
| 335 |
|
|
|
| 336 |
|
|
do{ |
| 337 |
|
|
|
| 338 |
|
|
if(!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) |
| 339 |
|
|
i ++; |
| 340 |
|
|
|
| 341 |
|
|
}while(i < file_num && FindNextFile(hFind,&fd)); |
| 342 |
|
|
|
| 343 |
|
|
}else{ |
| 344 |
|
|
return; |
| 345 |
|
|
} |
| 346 |
|
|
|
| 347 |
|
|
FindClose(hFind); |
| 348 |
|
|
|
| 349 |
|
|
//?スf?スB?ス?ス?スN?スg?ス?ス?ス?ス?ス?ス |
| 350 |
maya |
1.11 |
ZeroMemory(filename,destlen); |
| 351 |
|
|
{ |
| 352 |
|
|
int tmplen; |
| 353 |
|
|
char *tmp; |
| 354 |
|
|
tmplen = filePart - fullpath + 1; |
| 355 |
|
|
tmp = (char *)_alloca(tmplen); |
| 356 |
|
|
strncpy_s(tmp,tmplen,fullpath,filePart - fullpath); |
| 357 |
|
|
strncpy_s(filename,destlen,tmp,_TRUNCATE); |
| 358 |
|
|
} |
| 359 |
|
|
strncat_s(filename,destlen,fd.cFileName,_TRUNCATE); |
| 360 |
yutakakn |
1.3 |
} |
| 361 |
|
|
|
| 362 |
|
|
BOOL LoadPictureWithSPI(char *nameSPI,char *nameFile,unsigned char *bufFile,long sizeFile,HLOCAL *hbuf,HLOCAL *hbmi) |
| 363 |
|
|
{ |
| 364 |
|
|
HINSTANCE hSPI; |
| 365 |
|
|
char spiVersion[8]; |
| 366 |
|
|
int (FAR PASCAL *SPI_IsSupported)(LPSTR,DWORD); |
| 367 |
|
|
int (FAR PASCAL *SPI_GetPicture)(LPSTR,long,unsigned int,HANDLE *,HANDLE *,FARPROC,long); |
| 368 |
|
|
int (FAR PASCAL *SPI_GetPluginInfo)(int,LPSTR,int); |
| 369 |
|
|
int ret; |
| 370 |
|
|
|
| 371 |
|
|
ret = FALSE; |
| 372 |
|
|
hSPI = NULL; |
| 373 |
|
|
|
| 374 |
|
|
//SPI ?ス?ス?ス?ス?ス[?スh |
| 375 |
|
|
hSPI = LoadLibrary(nameSPI); |
| 376 |
|
|
|
| 377 |
|
|
if(!hSPI) |
| 378 |
|
|
goto error; |
| 379 |
|
|
|
| 380 |
|
|
(FARPROC)SPI_GetPluginInfo = GetProcAddress(hSPI,"GetPluginInfo"); |
| 381 |
|
|
(FARPROC)SPI_IsSupported = GetProcAddress(hSPI,"IsSupported"); |
| 382 |
|
|
(FARPROC)SPI_GetPicture = GetProcAddress(hSPI,"GetPicture"); |
| 383 |
|
|
|
| 384 |
|
|
if(!SPI_GetPluginInfo || !SPI_IsSupported || !SPI_GetPicture) |
| 385 |
|
|
goto error; |
| 386 |
|
|
|
| 387 |
|
|
//?スo?ス[?スW?ス?ス?ス?ス?ス`?スF?スb?スN |
| 388 |
|
|
SPI_GetPluginInfo(0,spiVersion,8); |
| 389 |
|
|
|
| 390 |
|
|
if(spiVersion[2] != 'I' || spiVersion[3] != 'N') |
| 391 |
|
|
goto error; |
| 392 |
|
|
|
| 393 |
|
|
if(!(SPI_IsSupported)(nameFile,(unsigned long)bufFile)) |
| 394 |
|
|
goto error; |
| 395 |
|
|
|
| 396 |
|
|
if((SPI_GetPicture)(bufFile,sizeFile,1,hbmi,hbuf,NULL,0)) |
| 397 |
|
|
goto error; |
| 398 |
|
|
|
| 399 |
|
|
ret = TRUE; |
| 400 |
|
|
|
| 401 |
|
|
error : |
| 402 |
|
|
|
| 403 |
|
|
if(hSPI) |
| 404 |
|
|
FreeLibrary(hSPI); |
| 405 |
|
|
|
| 406 |
|
|
return ret; |
| 407 |
|
|
} |
| 408 |
|
|
|
| 409 |
|
|
BOOL SaveBitmapFile(char *nameFile,unsigned char *pbuf,BITMAPINFO *pbmi) |
| 410 |
|
|
{ |
| 411 |
|
|
int bmiSize; |
| 412 |
|
|
DWORD writtenByte; |
| 413 |
|
|
HANDLE hFile; |
| 414 |
|
|
BITMAPFILEHEADER bfh; |
| 415 |
|
|
|
| 416 |
|
|
hFile = CreateFile(nameFile,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); |
| 417 |
|
|
|
| 418 |
|
|
if(hFile == INVALID_HANDLE_VALUE) |
| 419 |
|
|
return FALSE; |
| 420 |
|
|
|
| 421 |
|
|
bmiSize = pbmi->bmiHeader.biSize; |
| 422 |
|
|
|
| 423 |
|
|
switch(pbmi->bmiHeader.biBitCount) |
| 424 |
|
|
{ |
| 425 |
|
|
case 1: |
| 426 |
|
|
bmiSize += pbmi->bmiHeader.biClrUsed ? sizeof(RGBQUAD) * 2 : 0; |
| 427 |
|
|
break; |
| 428 |
|
|
|
| 429 |
|
|
case 2 : |
| 430 |
|
|
bmiSize += sizeof(RGBQUAD) * 4; |
| 431 |
|
|
break; |
| 432 |
|
|
|
| 433 |
|
|
case 4 : |
| 434 |
|
|
bmiSize += sizeof(RGBQUAD) * 16; |
| 435 |
|
|
break; |
| 436 |
|
|
|
| 437 |
|
|
case 8 : |
| 438 |
|
|
bmiSize += sizeof(RGBQUAD) * 256; |
| 439 |
|
|
break; |
| 440 |
|
|
} |
| 441 |
|
|
|
| 442 |
|
|
ZeroMemory(&bfh,sizeof(bfh)); |
| 443 |
|
|
bfh.bfType = MAKEWORD('B','M'); |
| 444 |
|
|
bfh.bfOffBits = sizeof(bfh) + bmiSize; |
| 445 |
|
|
bfh.bfSize = bfh.bfOffBits + pbmi->bmiHeader.biSizeImage; |
| 446 |
|
|
|
| 447 |
|
|
WriteFile(hFile,&bfh,sizeof(bfh) ,&writtenByte,0); |
| 448 |
|
|
WriteFile(hFile,pbmi,bmiSize ,&writtenByte,0); |
| 449 |
|
|
WriteFile(hFile,pbuf,pbmi->bmiHeader.biSizeImage,&writtenByte,0); |
| 450 |
|
|
|
| 451 |
|
|
CloseHandle(hFile); |
| 452 |
|
|
|
| 453 |
|
|
return TRUE; |
| 454 |
|
|
} |
| 455 |
|
|
|
| 456 |
|
|
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) |
| 457 |
|
|
{ |
| 458 |
|
|
HDC hdcDestWork,hdcSrcWork; |
| 459 |
|
|
int i,invAlpha,alpha; |
| 460 |
|
|
int lenBuf; |
| 461 |
|
|
unsigned char *bufDest; |
| 462 |
|
|
unsigned char *bufSrc; |
| 463 |
|
|
|
| 464 |
|
|
if(dx != 0 || dy != 0 || sx != 0 || sy != 0 || width != sw || height != sh) |
| 465 |
|
|
return FALSE; |
| 466 |
|
|
|
| 467 |
|
|
hdcDestWork = CreateBitmapDC(CreateDIB24BPP(width,height,&bufDest,&lenBuf)); |
| 468 |
|
|
hdcSrcWork = CreateBitmapDC(CreateDIB24BPP(width,height,&bufSrc ,&lenBuf)); |
| 469 |
|
|
|
| 470 |
|
|
if(!bufDest || !bufSrc) |
| 471 |
|
|
return FALSE; |
| 472 |
|
|
|
| 473 |
|
|
BitBlt(hdcDestWork,0,0,width,height,hdcDest,0,0,SRCCOPY); |
| 474 |
|
|
BitBlt(hdcSrcWork ,0,0,width,height,hdcSrc ,0,0,SRCCOPY); |
| 475 |
|
|
|
| 476 |
|
|
alpha = bf.SourceConstantAlpha; |
| 477 |
|
|
invAlpha = 255 - alpha; |
| 478 |
|
|
|
| 479 |
|
|
for(i = 0;i < lenBuf;i++,bufDest++,bufSrc++) |
| 480 |
|
|
*bufDest = (*bufDest * invAlpha + *bufSrc * alpha)>>8; |
| 481 |
|
|
|
| 482 |
|
|
BitBlt(hdcDest,0,0,width,height,hdcDestWork,0,0,SRCCOPY); |
| 483 |
|
|
|
| 484 |
|
|
DeleteBitmapDC(&hdcDestWork); |
| 485 |
|
|
DeleteBitmapDC(&hdcSrcWork); |
| 486 |
|
|
|
| 487 |
|
|
return TRUE; |
| 488 |
|
|
} |
| 489 |
|
|
|
| 490 |
|
|
// ?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スW |
| 491 |
|
|
|
| 492 |
|
|
void BGPreloadPicture(BGSrc *src) |
| 493 |
|
|
{ |
| 494 |
|
|
char spiPath[MAX_PATH]; |
| 495 |
|
|
char filespec[MAX_PATH]; |
| 496 |
|
|
char *filePart; |
| 497 |
|
|
int fileSize; |
| 498 |
|
|
int readByte; |
| 499 |
|
|
unsigned char *fileBuf; |
| 500 |
|
|
|
| 501 |
|
|
HBITMAP hbm; |
| 502 |
|
|
HANDLE hPictureFile; |
| 503 |
|
|
HANDLE hFind; |
| 504 |
|
|
WIN32_FIND_DATA fd; |
| 505 |
|
|
|
| 506 |
|
|
#ifdef _DEBUG |
| 507 |
|
|
dprintf("Preload Picture : %s",src->file); |
| 508 |
|
|
#endif |
| 509 |
|
|
|
| 510 |
|
|
//?スt?ス@?スC?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 511 |
|
|
hPictureFile = CreateFile(src->file,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); |
| 512 |
|
|
|
| 513 |
|
|
if(hPictureFile == INVALID_HANDLE_VALUE) |
| 514 |
|
|
return; |
| 515 |
|
|
|
| 516 |
|
|
fileSize = GetFileSize(hPictureFile,0); |
| 517 |
|
|
|
| 518 |
|
|
//?ス?ス?ス?ス 2kb ?ス?ス?スm?ス?ス (Susie plugin ?ス?ス?スd?スl?ス?ス?ス?ス) |
| 519 |
|
|
fileBuf = GlobalAlloc(GPTR,fileSize + 2048); |
| 520 |
|
|
|
| 521 |
|
|
//?ス?ス?ス?ス 2kb ?ス?ス?スO?ス?ス?ス?ス?ス?ス?ス?ス |
| 522 |
|
|
ZeroMemory(fileBuf,2048); |
| 523 |
|
|
|
| 524 |
|
|
ReadFile(hPictureFile,fileBuf,fileSize,&readByte,0); |
| 525 |
|
|
|
| 526 |
|
|
CloseHandle(hPictureFile); |
| 527 |
|
|
|
| 528 |
|
|
// SPIPath ?ス?ス?ス?ス?ス?ス?スp?スX?ス?ス?ス?ス?ス?ス |
| 529 |
|
|
if(!GetFullPathName(BGSPIPath,MAX_PATH,filespec,&filePart)) |
| 530 |
|
|
return; |
| 531 |
|
|
|
| 532 |
|
|
//?スv?ス?ス?スO?スC?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 533 |
|
|
hFind = FindFirstFile(filespec,&fd); |
| 534 |
|
|
|
| 535 |
|
|
if(hFind != INVALID_HANDLE_VALUE && filePart) |
| 536 |
|
|
{ |
| 537 |
|
|
//?スf?スB?ス?ス?スN?スg?ス?ス?ス?ス?ス?ス |
| 538 |
maya |
1.11 |
ExtractDirName(filespec, spiPath); |
| 539 |
|
|
AppendSlash(spiPath, sizeof(spiPath)); |
| 540 |
yutakakn |
1.3 |
|
| 541 |
|
|
do{ |
| 542 |
|
|
HLOCAL hbuf,hbmi; |
| 543 |
|
|
BITMAPINFO *pbmi; |
| 544 |
|
|
char *pbuf; |
| 545 |
|
|
char spiFileName[MAX_PATH]; |
| 546 |
|
|
|
| 547 |
|
|
if(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) |
| 548 |
|
|
continue; |
| 549 |
|
|
|
| 550 |
maya |
1.11 |
strncpy_s(spiFileName, sizeof(spiFileName), spiPath, _TRUNCATE); |
| 551 |
|
|
strncat_s(spiFileName, sizeof(spiFileName), fd.cFileName, _TRUNCATE); |
| 552 |
yutakakn |
1.3 |
|
| 553 |
|
|
if(LoadPictureWithSPI(spiFileName,src->file,fileBuf,fileSize,&hbuf,&hbmi)) |
| 554 |
|
|
{ |
| 555 |
|
|
pbuf = LocalLock(hbuf); |
| 556 |
|
|
pbmi = LocalLock(hbmi); |
| 557 |
|
|
|
| 558 |
|
|
SaveBitmapFile(src->fileTmp,pbuf,pbmi); |
| 559 |
|
|
|
| 560 |
|
|
LocalUnlock(hbmi); |
| 561 |
|
|
LocalUnlock(hbuf); |
| 562 |
|
|
|
| 563 |
|
|
LocalFree(hbmi); |
| 564 |
|
|
LocalFree(hbuf); |
| 565 |
|
|
|
| 566 |
maya |
1.11 |
strncpy_s(src->file, sizeof(src->file),src->fileTmp, _TRUNCATE); |
| 567 |
yutakakn |
1.3 |
|
| 568 |
|
|
break; |
| 569 |
|
|
} |
| 570 |
|
|
}while(FindNextFile(hFind,&fd)); |
| 571 |
|
|
|
| 572 |
|
|
FindClose(hFind); |
| 573 |
|
|
} |
| 574 |
|
|
|
| 575 |
|
|
GlobalFree(fileBuf); |
| 576 |
|
|
|
| 577 |
|
|
//?ス?ス?ス?ス?ス?ス?スr?スb?スg?ス}?スb?スv?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 578 |
|
|
|
| 579 |
|
|
hbm = LoadImage(0,src->file,IMAGE_BITMAP,0,0,LR_LOADFROMFILE); |
| 580 |
|
|
|
| 581 |
|
|
if(hbm) |
| 582 |
|
|
{ |
| 583 |
|
|
BITMAP bm; |
| 584 |
|
|
|
| 585 |
|
|
GetObject(hbm,sizeof(bm),&bm); |
| 586 |
|
|
|
| 587 |
|
|
src->hdc = CreateBitmapDC(hbm); |
| 588 |
|
|
src->width = bm.bmWidth; |
| 589 |
|
|
src->height = bm.bmHeight; |
| 590 |
|
|
}else{ |
| 591 |
|
|
src->type = BG_COLOR; |
| 592 |
|
|
} |
| 593 |
|
|
} |
| 594 |
|
|
|
| 595 |
|
|
void BGGetWallpaperInfo(WallpaperInfo *wi) |
| 596 |
|
|
{ |
| 597 |
|
|
int length; |
| 598 |
|
|
int tile; |
| 599 |
|
|
char str[256]; |
| 600 |
|
|
HKEY hKey; |
| 601 |
|
|
|
| 602 |
|
|
wi->pattern = BG_CENTER; |
| 603 |
maya |
1.11 |
strncpy_s(wi->filename, sizeof(wi->filename),"", _TRUNCATE); |
| 604 |
yutakakn |
1.3 |
|
| 605 |
|
|
//?ス?ス?スW?スX?スg?ス?ス?スL?ス[?ス?ス?スI?ス[?スv?ス?ス |
| 606 |
|
|
if(RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_READ, &hKey) != ERROR_SUCCESS) |
| 607 |
|
|
return; |
| 608 |
|
|
|
| 609 |
|
|
//?ス?ス?ス?ス?ス?ス?スQ?スb?スg |
| 610 |
|
|
length = MAX_PATH; |
| 611 |
|
|
RegQueryValueEx(hKey,"Wallpaper" ,NULL,NULL,(BYTE*)(wi->filename),&length); |
| 612 |
|
|
|
| 613 |
|
|
//?ス?ス?ス?ス?スX?ス^?スC?ス?ス?スQ?スb?スg |
| 614 |
|
|
length = 256; |
| 615 |
|
|
RegQueryValueEx(hKey,"WallpaperStyle",NULL,NULL,(BYTE*)str,&length); |
| 616 |
|
|
wi->pattern = atoi(str); |
| 617 |
|
|
|
| 618 |
|
|
//?ス?ス?ス?ス?スX?ス^?スC?ス?ス?スQ?スb?スg |
| 619 |
|
|
length = 256; |
| 620 |
|
|
RegQueryValueEx(hKey,"TileWallpaper" ,NULL,NULL,(BYTE*)str,&length); |
| 621 |
|
|
tile = atoi(str); |
| 622 |
|
|
|
| 623 |
|
|
//?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スH |
| 624 |
|
|
if(tile) |
| 625 |
|
|
wi->pattern = BG_TILE; |
| 626 |
|
|
else |
| 627 |
|
|
if(wi->pattern == 0) |
| 628 |
|
|
wi->pattern = BG_CENTER; |
| 629 |
|
|
else |
| 630 |
|
|
if(wi->pattern == 2) |
| 631 |
|
|
wi->pattern = BG_STRETCH; |
| 632 |
|
|
|
| 633 |
|
|
//?ス?ス?スW?スX?スg?ス?ス?スL?ス[?ス?ス?スN?ス?ス?ス[?スY |
| 634 |
|
|
RegCloseKey(hKey); |
| 635 |
|
|
} |
| 636 |
|
|
|
| 637 |
|
|
void BGPreloadWallpaper(BGSrc *src) |
| 638 |
|
|
{ |
| 639 |
|
|
HBITMAP hbm; |
| 640 |
|
|
WallpaperInfo wi; |
| 641 |
|
|
|
| 642 |
|
|
BGGetWallpaperInfo(&wi); |
| 643 |
|
|
|
| 644 |
|
|
//?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 645 |
|
|
//LR_CREATEDIBSECTION ?ス?ス?スw?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スR?スc |
| 646 |
|
|
if(wi.pattern == BG_STRETCH) |
| 647 |
|
|
hbm = LoadImage(0,wi.filename,IMAGE_BITMAP,CRTWidth,CRTHeight,LR_LOADFROMFILE | LR_CREATEDIBSECTION); |
| 648 |
|
|
else |
| 649 |
|
|
hbm = LoadImage(0,wi.filename,IMAGE_BITMAP, 0, 0,LR_LOADFROMFILE); |
| 650 |
|
|
|
| 651 |
|
|
//?ス?ス?ス?スDC?ス?ス?ス?ス?ス?ス |
| 652 |
|
|
if(hbm) |
| 653 |
|
|
{ |
| 654 |
|
|
BITMAP bm; |
| 655 |
|
|
|
| 656 |
|
|
GetObject(hbm,sizeof(bm),&bm); |
| 657 |
|
|
|
| 658 |
|
|
src->hdc = CreateBitmapDC(hbm); |
| 659 |
|
|
src->width = bm.bmWidth; |
| 660 |
|
|
src->height = bm.bmHeight; |
| 661 |
|
|
src->pattern = wi.pattern; |
| 662 |
|
|
}else{ |
| 663 |
|
|
src->hdc = NULL; |
| 664 |
|
|
} |
| 665 |
|
|
|
| 666 |
|
|
src->color = GetSysColor(COLOR_DESKTOP); |
| 667 |
|
|
} |
| 668 |
|
|
|
| 669 |
|
|
void BGPreloadSrc(BGSrc *src) |
| 670 |
|
|
{ |
| 671 |
|
|
DeleteBitmapDC(&(src->hdc)); |
| 672 |
|
|
|
| 673 |
|
|
switch(src->type) |
| 674 |
|
|
{ |
| 675 |
|
|
case BG_COLOR : |
| 676 |
|
|
break; |
| 677 |
|
|
|
| 678 |
|
|
case BG_WALLPAPER : |
| 679 |
|
|
BGPreloadWallpaper(src); |
| 680 |
|
|
break; |
| 681 |
|
|
|
| 682 |
|
|
case BG_PICTURE : |
| 683 |
|
|
BGPreloadPicture(src); |
| 684 |
|
|
break; |
| 685 |
|
|
} |
| 686 |
|
|
} |
| 687 |
|
|
|
| 688 |
|
|
void BGStretchPicture(HDC hdcDest,BGSrc *src,int x,int y,int width,int height,BOOL bAntiAlias) |
| 689 |
|
|
{ |
| 690 |
|
|
if(!hdcDest || !src) |
| 691 |
|
|
return; |
| 692 |
|
|
|
| 693 |
|
|
if(bAntiAlias) |
| 694 |
|
|
{ |
| 695 |
|
|
if(src->width != width || src->height != height) |
| 696 |
|
|
{ |
| 697 |
|
|
HBITMAP hbm; |
| 698 |
|
|
|
| 699 |
|
|
hbm = LoadImage(0,src->file,IMAGE_BITMAP,width,height,LR_LOADFROMFILE); |
| 700 |
|
|
|
| 701 |
|
|
if(!hbm) |
| 702 |
|
|
return; |
| 703 |
|
|
|
| 704 |
|
|
DeleteBitmapDC(&(src->hdc)); |
| 705 |
|
|
src->hdc = CreateBitmapDC(hbm); |
| 706 |
|
|
src->width = width; |
| 707 |
|
|
src->height = height; |
| 708 |
|
|
} |
| 709 |
|
|
|
| 710 |
|
|
BitBlt(hdcDest,x,y,width,height,src->hdc,0,0,SRCCOPY); |
| 711 |
|
|
}else{ |
| 712 |
|
|
SetStretchBltMode(src->hdc,COLORONCOLOR); |
| 713 |
|
|
StretchBlt(hdcDest,x,y,width,height,src->hdc,0,0,src->width,src->height,SRCCOPY); |
| 714 |
|
|
} |
| 715 |
|
|
} |
| 716 |
|
|
|
| 717 |
|
|
void BGLoadPicture(HDC hdcDest,BGSrc *src) |
| 718 |
|
|
{ |
| 719 |
|
|
int x,y,width,height,pattern; |
| 720 |
|
|
HDC hdc = NULL; |
| 721 |
|
|
|
| 722 |
|
|
FillBitmapDC(hdcDest,src->color); |
| 723 |
|
|
|
| 724 |
|
|
if(!src->height || !src->width) |
| 725 |
|
|
return; |
| 726 |
|
|
|
| 727 |
|
|
if(src->pattern == BG_AUTOFIT){ |
| 728 |
|
|
if((src->height * ScreenWidth) > (ScreenHeight * src->width)) |
| 729 |
|
|
pattern = BG_FIT_WIDTH; |
| 730 |
|
|
else |
| 731 |
|
|
pattern = BG_FIT_HEIGHT; |
| 732 |
|
|
}else{ |
| 733 |
|
|
pattern = src->pattern; |
| 734 |
|
|
} |
| 735 |
|
|
|
| 736 |
|
|
switch(pattern) |
| 737 |
|
|
{ |
| 738 |
|
|
case BG_STRETCH : |
| 739 |
|
|
BGStretchPicture(hdcDest,src,0,0,ScreenWidth,ScreenHeight,src->antiAlias); |
| 740 |
|
|
break; |
| 741 |
|
|
|
| 742 |
|
|
case BG_FIT_WIDTH : |
| 743 |
|
|
|
| 744 |
|
|
height = (src->height * ScreenWidth) / src->width; |
| 745 |
|
|
y = (ScreenHeight - height) / 2; |
| 746 |
|
|
|
| 747 |
|
|
BGStretchPicture(hdcDest,src,0,y,ScreenWidth,height,src->antiAlias); |
| 748 |
|
|
break; |
| 749 |
|
|
|
| 750 |
|
|
case BG_FIT_HEIGHT : |
| 751 |
|
|
|
| 752 |
|
|
width = (src->width * ScreenHeight) / src->height; |
| 753 |
|
|
x = (ScreenWidth - width) / 2; |
| 754 |
|
|
|
| 755 |
|
|
BGStretchPicture(hdcDest,src,x,0,width,ScreenHeight,src->antiAlias); |
| 756 |
|
|
break; |
| 757 |
|
|
|
| 758 |
|
|
case BG_TILE : |
| 759 |
|
|
for(x = 0;x < ScreenWidth ;x += src->width ) |
| 760 |
|
|
for(y = 0;y < ScreenHeight;y += src->height) |
| 761 |
|
|
BitBlt(hdcDest,x,y,src->width,src->height,src->hdc,0,0,SRCCOPY); |
| 762 |
|
|
break; |
| 763 |
|
|
|
| 764 |
|
|
case BG_CENTER : |
| 765 |
|
|
x = (ScreenWidth - src->width) / 2; |
| 766 |
|
|
y = (ScreenHeight - src->height) / 2; |
| 767 |
|
|
|
| 768 |
|
|
BitBlt(hdcDest,x,y,src->width,src->height,src->hdc,0,0,SRCCOPY); |
| 769 |
|
|
break; |
| 770 |
|
|
} |
| 771 |
|
|
} |
| 772 |
|
|
|
| 773 |
|
|
typedef struct tagLoadWallpaperStruct |
| 774 |
|
|
{ |
| 775 |
|
|
RECT *rectClient; |
| 776 |
|
|
HDC hdcDest; |
| 777 |
|
|
BGSrc *src; |
| 778 |
|
|
}LoadWallpaperStruct; |
| 779 |
|
|
|
| 780 |
|
|
BOOL CALLBACK BGLoadWallpaperEnumFunc(HMONITOR hMonitor,HDC hdcMonitor,LPRECT lprcMonitor,LPARAM dwData) |
| 781 |
|
|
{ |
| 782 |
|
|
RECT rectDest; |
| 783 |
|
|
RECT rectRgn; |
| 784 |
|
|
int monitorWidth; |
| 785 |
|
|
int monitorHeight; |
| 786 |
|
|
int destWidth; |
| 787 |
|
|
int destHeight; |
| 788 |
|
|
HRGN hRgn; |
| 789 |
|
|
int x; |
| 790 |
|
|
int y; |
| 791 |
|
|
|
| 792 |
|
|
LoadWallpaperStruct *lws = (LoadWallpaperStruct*)dwData; |
| 793 |
|
|
|
| 794 |
|
|
if(!IntersectRect(&rectDest,lprcMonitor,lws->rectClient)) |
| 795 |
|
|
return TRUE; |
| 796 |
|
|
|
| 797 |
|
|
//?ス?ス?スj?ス^?ス[?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス}?スX?スN |
| 798 |
|
|
SaveDC(lws->hdcDest); |
| 799 |
|
|
CopyRect(&rectRgn,&rectDest); |
| 800 |
|
|
OffsetRect(&rectRgn,- lws->rectClient->left,- lws->rectClient->top); |
| 801 |
|
|
hRgn = CreateRectRgnIndirect(&rectRgn); |
| 802 |
|
|
SelectObject(lws->hdcDest,hRgn); |
| 803 |
|
|
|
| 804 |
|
|
//?ス?ス?スj?ス^?ス[?ス?ス?ス?ス?ス?ス?ス?ス |
| 805 |
|
|
monitorWidth = lprcMonitor->right - lprcMonitor->left; |
| 806 |
|
|
monitorHeight = lprcMonitor->bottom - lprcMonitor->top; |
| 807 |
|
|
|
| 808 |
|
|
destWidth = rectDest.right - rectDest.left; |
| 809 |
|
|
destHeight = rectDest.bottom - rectDest.top; |
| 810 |
|
|
|
| 811 |
|
|
switch(lws->src->pattern) |
| 812 |
|
|
{ |
| 813 |
|
|
case BG_CENTER : |
| 814 |
|
|
case BG_STRETCH : |
| 815 |
|
|
|
| 816 |
|
|
SetWindowOrgEx(lws->src->hdc, |
| 817 |
|
|
lprcMonitor->left + (monitorWidth - lws->src->width )/2, |
| 818 |
|
|
lprcMonitor->top + (monitorHeight - lws->src->height)/2,NULL); |
| 819 |
|
|
BitBlt(lws->hdcDest ,rectDest.left,rectDest.top,destWidth,destHeight, |
| 820 |
|
|
lws->src->hdc,rectDest.left,rectDest.top,SRCCOPY); |
| 821 |
|
|
|
| 822 |
|
|
break; |
| 823 |
|
|
case BG_TILE : |
| 824 |
|
|
|
| 825 |
|
|
SetWindowOrgEx(lws->src->hdc,0,0,NULL); |
| 826 |
|
|
|
| 827 |
|
|
for(x = rectDest.left - (rectDest.left % lws->src->width ) - lws->src->width ; |
| 828 |
|
|
x < rectDest.right ;x += lws->src->width ) |
| 829 |
|
|
for(y = rectDest.top - (rectDest.top % lws->src->height) - lws->src->height; |
| 830 |
|
|
y < rectDest.bottom;y += lws->src->height) |
| 831 |
|
|
BitBlt(lws->hdcDest,x,y,lws->src->width,lws->src->height,lws->src->hdc,0,0,SRCCOPY); |
| 832 |
|
|
break; |
| 833 |
|
|
} |
| 834 |
|
|
|
| 835 |
|
|
//?ス?ス?ス[?スW?ス?ス?ス?ス?ス?ス?スj?ス?ス |
| 836 |
|
|
RestoreDC(lws->hdcDest,-1); |
| 837 |
|
|
DeleteObject(hRgn); |
| 838 |
|
|
|
| 839 |
|
|
return TRUE; |
| 840 |
|
|
} |
| 841 |
|
|
|
| 842 |
|
|
void BGLoadWallpaper(HDC hdcDest,BGSrc *src) |
| 843 |
|
|
{ |
| 844 |
|
|
RECT rectClient; |
| 845 |
|
|
POINT point; |
| 846 |
|
|
LoadWallpaperStruct lws; |
| 847 |
|
|
|
| 848 |
|
|
//?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スf?スX?スN?スg?スb?スv?スF?ス?ス?スh?ス?ス?ス?ス?ス?ス?ス?ス |
| 849 |
|
|
FillBitmapDC(hdcDest,src->color); |
| 850 |
|
|
|
| 851 |
|
|
//?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 852 |
|
|
if(!src->hdc) |
| 853 |
|
|
return; |
| 854 |
|
|
|
| 855 |
|
|
//hdcDest?ス?ス?ス?ス?スW?スn?ス?ス?ス?ス?スz?スX?スN?ス?ス?ス[?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 856 |
|
|
point.x = 0; |
| 857 |
|
|
point.y = 0; |
| 858 |
|
|
ClientToScreen(HVTWin,&point); |
| 859 |
|
|
|
| 860 |
|
|
SetWindowOrgEx(hdcDest,point.x,point.y,NULL); |
| 861 |
|
|
|
| 862 |
|
|
//?ス?ス?スz?スX?スN?ス?ス?ス[?ス?ス?ス?ス?ス?ス?スN?ス?ス?スC?スA?ス?ス?スg?ス?ス?ス?ス |
| 863 |
|
|
GetClientRect(HVTWin,&rectClient); |
| 864 |
|
|
OffsetRect(&rectClient,point.x,point.y); |
| 865 |
|
|
|
| 866 |
|
|
//?ス?ス?スj?ス^?ス[?ス?ス?ス?ス?ス?ス |
| 867 |
|
|
lws.rectClient = &rectClient; |
| 868 |
|
|
lws.src = src; |
| 869 |
|
|
lws.hdcDest = hdcDest; |
| 870 |
|
|
|
| 871 |
|
|
if(BGEnumDisplayMonitors) |
| 872 |
|
|
{ |
| 873 |
|
|
(*BGEnumDisplayMonitors)(NULL,NULL,BGLoadWallpaperEnumFunc,(LPARAM)&lws); |
| 874 |
|
|
}else{ |
| 875 |
|
|
RECT rectMonitor; |
| 876 |
|
|
|
| 877 |
|
|
SetRect(&rectMonitor,0,0,CRTWidth,CRTHeight); |
| 878 |
|
|
BGLoadWallpaperEnumFunc(NULL,NULL,&rectMonitor,(LPARAM)&lws); |
| 879 |
|
|
} |
| 880 |
|
|
|
| 881 |
|
|
//?ス?ス?スW?スn?ス?ス?ス?ス?ス?ス |
| 882 |
|
|
SetWindowOrgEx(hdcDest,0,0,NULL); |
| 883 |
|
|
} |
| 884 |
|
|
|
| 885 |
|
|
void BGLoadSrc(HDC hdcDest,BGSrc *src) |
| 886 |
|
|
{ |
| 887 |
|
|
switch(src->type) |
| 888 |
|
|
{ |
| 889 |
|
|
case BG_COLOR : |
| 890 |
|
|
FillBitmapDC(hdcDest,src->color); |
| 891 |
|
|
break; |
| 892 |
|
|
|
| 893 |
|
|
case BG_WALLPAPER : |
| 894 |
|
|
BGLoadWallpaper(hdcDest,src); |
| 895 |
|
|
break; |
| 896 |
|
|
|
| 897 |
|
|
case BG_PICTURE : |
| 898 |
|
|
BGLoadPicture(hdcDest,src); |
| 899 |
|
|
break; |
| 900 |
|
|
} |
| 901 |
|
|
} |
| 902 |
|
|
|
| 903 |
|
|
void BGSetupPrimary(BOOL forceSetup) |
| 904 |
|
|
{ |
| 905 |
|
|
POINT point; |
| 906 |
|
|
RECT rect; |
| 907 |
|
|
|
| 908 |
|
|
if(!BGEnable) |
| 909 |
|
|
return; |
| 910 |
|
|
|
| 911 |
|
|
//?ス?ス?ス?ス?ス?ス?スu?スA?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス`?スF?スb?スN |
| 912 |
|
|
point.x = 0; |
| 913 |
|
|
point.y = 0; |
| 914 |
|
|
ClientToScreen(HVTWin,&point); |
| 915 |
|
|
|
| 916 |
|
|
GetClientRect(HVTWin,&rect); |
| 917 |
|
|
OffsetRect(&rect,point.x,point.y); |
| 918 |
|
|
|
| 919 |
|
|
if(!forceSetup && EqualRect(&rect,&BGPrevRect)) |
| 920 |
|
|
return; |
| 921 |
|
|
|
| 922 |
|
|
CopyRect(&BGPrevRect,&rect); |
| 923 |
|
|
|
| 924 |
|
|
#ifdef _DEBUG |
| 925 |
|
|
dprintf("BGSetupPrimary : BGInSizeMove = %d",BGInSizeMove); |
| 926 |
|
|
#endif |
| 927 |
|
|
|
| 928 |
|
|
//?ス?ス?ス?ス?スp DC ?ス?ス?ス?ス |
| 929 |
|
|
if(hdcBGWork) DeleteBitmapDC(&hdcBGWork); |
| 930 |
|
|
if(hdcBGBuffer) DeleteBitmapDC(&hdcBGBuffer); |
| 931 |
|
|
|
| 932 |
|
|
hdcBGWork = CreateBitmapDC(CreateScreenCompatibleBitmap(ScreenWidth,FontHeight)); |
| 933 |
|
|
hdcBGBuffer = CreateBitmapDC(CreateScreenCompatibleBitmap(ScreenWidth,FontHeight)); |
| 934 |
|
|
|
| 935 |
|
|
//hdcBGBuffer ?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 936 |
|
|
SetBkMode(hdcBGBuffer,TRANSPARENT); |
| 937 |
|
|
|
| 938 |
|
|
if(!BGInSizeMove) |
| 939 |
|
|
{ |
| 940 |
|
|
BGBLENDFUNCTION bf; |
| 941 |
|
|
HDC hdcSrc = NULL; |
| 942 |
|
|
|
| 943 |
|
|
//?スw?スi HDC |
| 944 |
|
|
if(hdcBG) DeleteBitmapDC(&hdcBG); |
| 945 |
|
|
hdcBG = CreateBitmapDC(CreateScreenCompatibleBitmap(ScreenWidth,ScreenHeight)); |
| 946 |
|
|
|
| 947 |
|
|
//?ス?ス?ス?ス?スpDC |
| 948 |
|
|
hdcSrc = CreateBitmapDC(CreateScreenCompatibleBitmap(ScreenWidth,ScreenHeight)); |
| 949 |
|
|
|
| 950 |
|
|
//?スw?スi?ス?ス?ス?ス |
| 951 |
|
|
BGLoadSrc(hdcBG,&BGDest); |
| 952 |
|
|
|
| 953 |
|
|
ZeroMemory(&bf,sizeof(bf)); |
| 954 |
|
|
bf.BlendOp = AC_SRC_OVER; |
| 955 |
|
|
|
| 956 |
|
|
if(bf.SourceConstantAlpha = BGSrc1.alpha) |
| 957 |
|
|
{ |
| 958 |
|
|
BGLoadSrc(hdcSrc,&BGSrc1); |
| 959 |
|
|
(BGAlphaBlend)(hdcBG,0,0,ScreenWidth,ScreenHeight,hdcSrc,0,0,ScreenWidth,ScreenHeight,bf); |
| 960 |
|
|
} |
| 961 |
|
|
|
| 962 |
|
|
if(bf.SourceConstantAlpha = BGSrc2.alpha) |
| 963 |
|
|
{ |
| 964 |
|
|
BGLoadSrc(hdcSrc,&BGSrc2); |
| 965 |
|
|
(BGAlphaBlend)(hdcBG,0,0,ScreenWidth,ScreenHeight,hdcSrc,0,0,ScreenWidth,ScreenHeight,bf); |
| 966 |
|
|
} |
| 967 |
|
|
|
| 968 |
|
|
DeleteBitmapDC(&hdcSrc); |
| 969 |
|
|
} |
| 970 |
|
|
} |
| 971 |
|
|
|
| 972 |
|
|
COLORREF BGGetColor(char *name,COLORREF defcolor,char *file) |
| 973 |
|
|
{ |
| 974 |
|
|
unsigned int r,g,b; |
| 975 |
|
|
char colorstr[256],defstr[256]; |
| 976 |
|
|
|
| 977 |
maya |
1.11 |
_snprintf_s(defstr,sizeof(defstr),_TRUNCATE,"%d,%d,%d",GetRValue(defcolor),GetGValue(defcolor),GetBValue(defcolor)); |
| 978 |
yutakakn |
1.3 |
|
| 979 |
|
|
GetPrivateProfileString(BG_SECTION,name,defstr,colorstr,255,file); |
| 980 |
|
|
|
| 981 |
|
|
r = g = b = 0; |
| 982 |
|
|
|
| 983 |
|
|
sscanf(colorstr,"%d , %d , %d",&r,&g,&b); |
| 984 |
|
|
|
| 985 |
|
|
return RGB(r,g,b); |
| 986 |
|
|
} |
| 987 |
|
|
|
| 988 |
|
|
BG_PATTERN BGGetStrIndex(char *name,BG_PATTERN def,char *file,char **strList,int nList) |
| 989 |
|
|
{ |
| 990 |
|
|
char defstr[64],str[64]; |
| 991 |
|
|
int i; |
| 992 |
|
|
|
| 993 |
|
|
def %= nList; |
| 994 |
|
|
|
| 995 |
maya |
1.11 |
strncpy_s(defstr, sizeof(defstr),strList[def], _TRUNCATE); |
| 996 |
yutakakn |
1.3 |
GetPrivateProfileString(BG_SECTION,name,defstr,str,64,file); |
| 997 |
|
|
|
| 998 |
|
|
for(i = 0;i < nList;i++) |
| 999 |
yutakakn |
1.7 |
if(!_stricmp(str,strList[i])) |
| 1000 |
yutakakn |
1.3 |
return i; |
| 1001 |
|
|
|
| 1002 |
|
|
return 0; |
| 1003 |
|
|
} |
| 1004 |
|
|
|
| 1005 |
|
|
BOOL BGGetOnOff(char *name,BOOL def,char *file) |
| 1006 |
|
|
{ |
| 1007 |
|
|
char *strList[2] = {"Off","On"}; |
| 1008 |
|
|
|
| 1009 |
|
|
return BGGetStrIndex(name,def,file,strList,2); |
| 1010 |
|
|
} |
| 1011 |
|
|
|
| 1012 |
|
|
BG_PATTERN BGGetPattern(char *name,BG_PATTERN def,char *file) |
| 1013 |
|
|
{ |
| 1014 |
|
|
char *strList[6]={"stretch","tile","center","fitwidth","fitheight","autofit"}; |
| 1015 |
|
|
|
| 1016 |
|
|
return BGGetStrIndex(name,def,file,strList,6); |
| 1017 |
|
|
} |
| 1018 |
|
|
|
| 1019 |
|
|
BG_PATTERN BGGetType(char *name,BG_TYPE def,char *file) |
| 1020 |
|
|
{ |
| 1021 |
|
|
char *strList[3]={"color","picture","wallpaper"}; |
| 1022 |
|
|
|
| 1023 |
|
|
return BGGetStrIndex(name,def,file,strList,3); |
| 1024 |
|
|
} |
| 1025 |
|
|
|
| 1026 |
|
|
void BGReadTextColorConfig(char *file) |
| 1027 |
|
|
{ |
| 1028 |
|
|
ANSIColor[IdFore ] = BGGetColor("Fore" ,ANSIColor[IdFore],file); |
| 1029 |
|
|
ANSIColor[IdBack ] = BGGetColor("Back" ,ANSIColor[IdBack],file); |
| 1030 |
|
|
ANSIColor[IdRed ] = BGGetColor("Red" ,ANSIColor[IdRed ],file); |
| 1031 |
|
|
ANSIColor[IdGreen ] = BGGetColor("Green" ,ANSIColor[IdGreen ],file); |
| 1032 |
|
|
ANSIColor[IdYellow ] = BGGetColor("Yellow" ,ANSIColor[IdYellow ],file); |
| 1033 |
|
|
ANSIColor[IdBlue ] = BGGetColor("Blue" ,ANSIColor[IdBlue ],file); |
| 1034 |
|
|
ANSIColor[IdMagenta] = BGGetColor("Magenta",ANSIColor[IdMagenta],file); |
| 1035 |
|
|
ANSIColor[IdCyan ] = BGGetColor("Cyan" ,ANSIColor[IdCyan ],file); |
| 1036 |
|
|
|
| 1037 |
|
|
ANSIColor[IdFore + 8] = BGGetColor("DarkFore" ,ANSIColor[IdFore + 8],file); |
| 1038 |
|
|
ANSIColor[IdBack + 8] = BGGetColor("DarkBack" ,ANSIColor[IdBack + 8],file); |
| 1039 |
|
|
ANSIColor[IdRed + 8] = BGGetColor("DarkRed" ,ANSIColor[IdRed + 8],file); |
| 1040 |
|
|
ANSIColor[IdGreen + 8] = BGGetColor("DarkGreen" ,ANSIColor[IdGreen + 8],file); |
| 1041 |
|
|
ANSIColor[IdYellow + 8] = BGGetColor("DarkYellow" ,ANSIColor[IdYellow + 8],file); |
| 1042 |
|
|
ANSIColor[IdBlue + 8] = BGGetColor("DarkBlue" ,ANSIColor[IdBlue + 8],file); |
| 1043 |
|
|
ANSIColor[IdMagenta+ 8] = BGGetColor("DarkMagenta",ANSIColor[IdMagenta+ 8],file); |
| 1044 |
|
|
ANSIColor[IdCyan + 8] = BGGetColor("DarkCyan" ,ANSIColor[IdCyan + 8],file); |
| 1045 |
|
|
|
| 1046 |
|
|
BGVTColor[0] = BGGetColor("VTFore",BGVTColor[0],file); |
| 1047 |
|
|
BGVTColor[1] = BGGetColor("VTBack",BGVTColor[1],file); |
| 1048 |
|
|
|
| 1049 |
|
|
BGVTBlinkColor[0] = BGGetColor("VTBlinkFore",BGVTBlinkColor[0],file); |
| 1050 |
|
|
BGVTBlinkColor[1] = BGGetColor("VTBlinkBack",BGVTBlinkColor[1],file); |
| 1051 |
|
|
|
| 1052 |
|
|
BGVTBoldColor[0] = BGGetColor("VTBoldFore" ,BGVTBoldColor[0],file); |
| 1053 |
|
|
BGVTBoldColor[1] = BGGetColor("VTBoldBack" ,BGVTBoldColor[1],file); |
| 1054 |
yutakakn |
1.5 |
|
| 1055 |
|
|
/* begin - ishizaki */ |
| 1056 |
|
|
BGURLColor[0] = BGGetColor("URLFore" ,BGURLColor[0],file); |
| 1057 |
|
|
BGURLColor[1] = BGGetColor("URLBack" ,BGURLColor[1],file); |
| 1058 |
|
|
/* end - ishizaki */ |
| 1059 |
yutakakn |
1.3 |
} |
| 1060 |
|
|
|
| 1061 |
|
|
void BGReadIniFile(char *file) |
| 1062 |
|
|
{ |
| 1063 |
|
|
char path[MAX_PATH]; |
| 1064 |
|
|
|
| 1065 |
|
|
// Easy Setting |
| 1066 |
|
|
BGDest.pattern = BGGetPattern("BGPicturePattern",BGSrc1.pattern,file); |
| 1067 |
|
|
BGDest.color = BGGetColor("BGPictureBaseColor",BGSrc1.color,file); |
| 1068 |
|
|
|
| 1069 |
|
|
GetPrivateProfileString(BG_SECTION,"BGPictureFile",BGSrc1.file,path,MAX_PATH,file); |
| 1070 |
maya |
1.11 |
RandomFile(path,BGDest.file,sizeof(BGDest.file)); |
| 1071 |
yutakakn |
1.3 |
|
| 1072 |
|
|
BGSrc1.alpha = 255 - GetPrivateProfileInt(BG_SECTION,"BGPictureTone",255 - BGSrc1.alpha,file); |
| 1073 |
|
|
|
| 1074 |
|
|
if(!strcmp(BGDest.file,"")) |
| 1075 |
|
|
BGSrc1.alpha = 255; |
| 1076 |
|
|
|
| 1077 |
|
|
BGSrc2.alpha = 255 - GetPrivateProfileInt(BG_SECTION,"BGFadeTone",255 - BGSrc2.alpha,file); |
| 1078 |
|
|
BGSrc2.color = BGGetColor("BGFadeColor",BGSrc2.color,file); |
| 1079 |
|
|
|
| 1080 |
|
|
BGReverseTextAlpha = GetPrivateProfileInt(BG_SECTION,"BGReverseTextTone",BGReverseTextAlpha,file); |
| 1081 |
|
|
|
| 1082 |
|
|
//Src1 ?ス?ス?ス?ス?ス?ス?スo?ス?ス |
| 1083 |
|
|
BGSrc1.type = BGGetType("BGSrc1Type",BGSrc1.type,file); |
| 1084 |
|
|
BGSrc1.pattern = BGGetPattern("BGSrc1Pattern",BGSrc1.pattern,file); |
| 1085 |
|
|
BGSrc1.antiAlias = BGGetOnOff("BGSrc1AntiAlias",BGSrc1.antiAlias,file); |
| 1086 |
|
|
BGSrc1.alpha = GetPrivateProfileInt(BG_SECTION,"BGSrc1Alpha" ,BGSrc1.alpha ,file); |
| 1087 |
|
|
BGSrc1.color = BGGetColor("BGSrc1Color",BGSrc1.color,file); |
| 1088 |
|
|
|
| 1089 |
|
|
GetPrivateProfileString(BG_SECTION,"BGSrc1File",BGSrc1.file,path,MAX_PATH,file); |
| 1090 |
maya |
1.11 |
RandomFile(path,BGSrc1.file,sizeof(BGSrc1.file)); |
| 1091 |
yutakakn |
1.3 |
|
| 1092 |
|
|
//Src2 ?ス?ス?ス?ス?ス?ス?スo?ス?ス |
| 1093 |
|
|
BGSrc2.type = BGGetType("BGSrc2Type",BGSrc2.type,file); |
| 1094 |
|
|
BGSrc2.pattern = BGGetPattern("BGSrc2Pattern",BGSrc2.pattern,file); |
| 1095 |
|
|
BGSrc2.antiAlias = BGGetOnOff("BGSrc2AntiAlias",BGSrc2.antiAlias,file); |
| 1096 |
|
|
BGSrc2.alpha = GetPrivateProfileInt(BG_SECTION,"BGSrc2Alpha" ,BGSrc2.alpha ,file); |
| 1097 |
|
|
BGSrc2.color = BGGetColor("BGSrc2Color",BGSrc2.color,file); |
| 1098 |
|
|
|
| 1099 |
|
|
GetPrivateProfileString(BG_SECTION,"BGSrc2File",BGSrc2.file,path,MAX_PATH,file); |
| 1100 |
maya |
1.11 |
RandomFile(path,BGSrc2.file,sizeof(BGSrc2.file)); |
| 1101 |
yutakakn |
1.3 |
|
| 1102 |
|
|
//Dest ?ス?ス?ス?ス?ス?ス?スo?ス?ス |
| 1103 |
|
|
BGDest.type = BGGetType("BGDestType",BGDest.type,file); |
| 1104 |
|
|
BGDest.pattern = BGGetPattern("BGDestPattern",BGDest.pattern,file); |
| 1105 |
|
|
BGDest.antiAlias = BGGetOnOff("BGDestAntiAlias",BGDest.antiAlias,file); |
| 1106 |
|
|
BGDest.color = BGGetColor("BGDestColor",BGDest.color,file); |
| 1107 |
|
|
|
| 1108 |
|
|
GetPrivateProfileString(BG_SECTION,"BGDestFile",BGDest.file,path,MAX_PATH,file); |
| 1109 |
maya |
1.11 |
RandomFile(path,BGDest.file,sizeof(BGDest.file)); |
| 1110 |
yutakakn |
1.3 |
|
| 1111 |
|
|
//?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スo?ス?ス |
| 1112 |
|
|
BGReverseTextAlpha = GetPrivateProfileInt(BG_SECTION,"BGReverseTextAlpha",BGReverseTextAlpha,file); |
| 1113 |
|
|
BGReadTextColorConfig(file); |
| 1114 |
|
|
} |
| 1115 |
|
|
|
| 1116 |
|
|
void BGDestruct(void) |
| 1117 |
|
|
{ |
| 1118 |
|
|
if(!BGEnable) |
| 1119 |
|
|
return; |
| 1120 |
|
|
|
| 1121 |
|
|
DeleteBitmapDC(&hdcBGBuffer); |
| 1122 |
|
|
DeleteBitmapDC(&hdcBGWork); |
| 1123 |
|
|
DeleteBitmapDC(&hdcBG); |
| 1124 |
|
|
DeleteBitmapDC(&(BGDest.hdc)); |
| 1125 |
|
|
DeleteBitmapDC(&(BGSrc1.hdc)); |
| 1126 |
|
|
DeleteBitmapDC(&(BGSrc2.hdc)); |
| 1127 |
|
|
|
| 1128 |
|
|
//?スe?ス?ス?ス|?ス?ス?ス?ス?ス[?スt?ス@?スC?ス?ス?ス?ス?ス?ス |
| 1129 |
|
|
DeleteFile(BGDest.fileTmp); |
| 1130 |
|
|
DeleteFile(BGSrc1.fileTmp); |
| 1131 |
|
|
DeleteFile(BGSrc2.fileTmp); |
| 1132 |
|
|
} |
| 1133 |
|
|
|
| 1134 |
|
|
void BGInitialize(void) |
| 1135 |
|
|
{ |
| 1136 |
|
|
char path[MAX_PATH],config_file[MAX_PATH],tempPath[MAX_PATH]; |
| 1137 |
|
|
|
| 1138 |
|
|
// VTColor ?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 1139 |
|
|
BGVTColor[0] = ts.VTColor[0]; |
| 1140 |
|
|
BGVTColor[1] = ts.VTColor[1]; |
| 1141 |
|
|
|
| 1142 |
|
|
BGVTBoldColor[0] = ts.VTBoldColor[0]; |
| 1143 |
|
|
BGVTBoldColor[1] = ts.VTBoldColor[1]; |
| 1144 |
|
|
|
| 1145 |
|
|
BGVTBlinkColor[0] = ts.VTBlinkColor[0]; |
| 1146 |
|
|
BGVTBlinkColor[1] = ts.VTBlinkColor[1]; |
| 1147 |
|
|
|
| 1148 |
yutakakn |
1.5 |
#if 0 |
| 1149 |
|
|
/* begin - ishizaki */ |
| 1150 |
|
|
BGURLColor[0] = ts.URLColor[0]; |
| 1151 |
|
|
BGURLColor[1] = ts.URLColor[1]; |
| 1152 |
|
|
/* end - ishizaki */ |
| 1153 |
|
|
#else |
| 1154 |
|
|
// TODO: ?スn?スC?スp?ス[?ス?ス?ス?ス?スN?ス?ス?ス`?ス?ス?ス?ス?ス?ス?スA?ス?ス?ス^?スC?ス?ス?ス?ス?スs?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スA |
| 1155 |
|
|
// ?スF?ス?ス?ス?ス?ス?ス?スX?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スB?ス?ス?ス?ス?スA?ス?ス?ス?ス?ス?ス?ス?ス?スB(2005.4.3 yutaka) |
| 1156 |
|
|
BGURLColor[0] = ts.VTColor[0]; |
| 1157 |
|
|
BGURLColor[1] = ts.VTColor[1]; |
| 1158 |
|
|
#endif |
| 1159 |
|
|
|
| 1160 |
yutakakn |
1.3 |
// ANSI color?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スD?ス?ス?ス?ス?ス?ス?ス?ス (2005.2.3 yutaka) |
| 1161 |
doda |
1.25 |
InitColorTable(); |
| 1162 |
yutakakn |
1.3 |
|
| 1163 |
|
|
//?ス?ス?ス\?ス[?スX?ス?ス?ス?ス |
| 1164 |
|
|
BGDestruct(); |
| 1165 |
|
|
|
| 1166 |
|
|
//BG ?ス?ス?スL?ス?ス?ス?ス?ス`?スF?スb?スN |
| 1167 |
yutakakn |
1.6 |
ts.EtermLookfeel.BGEnable = BGEnable = BGGetOnOff("BGEnable",FALSE,ts.SetupFName); |
| 1168 |
|
|
ts.EtermLookfeel.BGUseAlphaBlendAPI = BGGetOnOff("BGUseAlphaBlendAPI",TRUE ,ts.SetupFName); |
| 1169 |
|
|
ts.EtermLookfeel.BGNoFrame = BGGetOnOff("BGNoFrame" ,FALSE,ts.SetupFName); |
| 1170 |
|
|
ts.EtermLookfeel.BGFastSizeMove = BGGetOnOff("BGFastSizeMove" ,TRUE ,ts.SetupFName); |
| 1171 |
|
|
ts.EtermLookfeel.BGNoCopyBits = BGGetOnOff("BGFlickerlessMove" ,TRUE ,ts.SetupFName); |
| 1172 |
|
|
|
| 1173 |
|
|
GetPrivateProfileString(BG_SECTION,"BGSPIPath","plugin",BGSPIPath,MAX_PATH,ts.SetupFName); |
| 1174 |
maya |
1.11 |
strncpy_s(ts.EtermLookfeel.BGSPIPath, sizeof(ts.EtermLookfeel.BGSPIPath), BGSPIPath, _TRUNCATE); |
| 1175 |
yutakakn |
1.6 |
|
| 1176 |
|
|
//?スR?ス?ス?スt?スB?スO?スt?ス@?スC?ス?ス?ス?ス?ス?ス?ス?ス |
| 1177 |
|
|
GetPrivateProfileString(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName); |
| 1178 |
maya |
1.11 |
strncpy_s(ts.EtermLookfeel.BGThemeFile, sizeof(ts.EtermLookfeel.BGThemeFile), path, _TRUNCATE); |
| 1179 |
yutakakn |
1.3 |
|
| 1180 |
|
|
if(!BGEnable) |
| 1181 |
|
|
return; |
| 1182 |
|
|
|
| 1183 |
|
|
//?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 1184 |
yutakakn |
1.7 |
// add cast (2006.2.18 yutaka) |
| 1185 |
|
|
srand((unsigned int)time(NULL)); |
| 1186 |
yutakakn |
1.3 |
|
| 1187 |
|
|
//BG?スV?スX?スe?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スo?ス?ス |
| 1188 |
yutakakn |
1.6 |
BGUseAlphaBlendAPI = ts.EtermLookfeel.BGUseAlphaBlendAPI; |
| 1189 |
|
|
BGNoFrame = ts.EtermLookfeel.BGNoFrame; |
| 1190 |
|
|
BGFastSizeMove = ts.EtermLookfeel.BGFastSizeMove; |
| 1191 |
|
|
BGNoCopyBits = ts.EtermLookfeel.BGNoCopyBits; |
| 1192 |
yutakakn |
1.3 |
|
| 1193 |
yutakakn |
1.6 |
#if 0 |
| 1194 |
yutakakn |
1.3 |
GetPrivateProfileString(BG_SECTION,"BGSPIPath","plugin",BGSPIPath,MAX_PATH,ts.SetupFName); |
| 1195 |
maya |
1.11 |
strncpy_s(ts.EtermLookfeel.BGSPIPath, sizeof(ts.EtermLookfeel.BGSPIPath), BGSPIPath, _TRUNCATE); |
| 1196 |
yutakakn |
1.6 |
#endif |
| 1197 |
yutakakn |
1.3 |
|
| 1198 |
|
|
//?スe?ス?ス?ス|?ス?ス?ス?ス?ス[?スt?ス@?スC?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 1199 |
|
|
GetTempPath(MAX_PATH,tempPath); |
| 1200 |
|
|
GetTempFileName(tempPath,"ttAK",0,BGDest.fileTmp); |
| 1201 |
|
|
GetTempFileName(tempPath,"ttAK",0,BGSrc1.fileTmp); |
| 1202 |
|
|
GetTempFileName(tempPath,"ttAK",0,BGSrc2.fileTmp); |
| 1203 |
|
|
|
| 1204 |
|
|
//?スf?スt?スH?ス?ス?スg?スl |
| 1205 |
|
|
BGDest.type = BG_PICTURE; |
| 1206 |
|
|
BGDest.pattern = BG_STRETCH; |
| 1207 |
|
|
BGDest.color = RGB(0,0,0); |
| 1208 |
|
|
BGDest.antiAlias = TRUE; |
| 1209 |
maya |
1.11 |
strncpy_s(BGDest.file, sizeof(BGDest.file),"", _TRUNCATE); |
| 1210 |
yutakakn |
1.3 |
|
| 1211 |
|
|
BGSrc1.type = BG_WALLPAPER; |
| 1212 |
|
|
BGSrc1.pattern = BG_STRETCH; |
| 1213 |
|
|
BGSrc1.color = RGB(255,255,255); |
| 1214 |
|
|
BGSrc1.antiAlias = TRUE; |
| 1215 |
|
|
BGSrc1.alpha = 255; |
| 1216 |
maya |
1.11 |
strncpy_s(BGSrc1.file, sizeof(BGSrc1.file),"", _TRUNCATE); |
| 1217 |
yutakakn |
1.3 |
|
| 1218 |
|
|
BGSrc2.type = BG_COLOR; |
| 1219 |
|
|
BGSrc2.pattern = BG_STRETCH; |
| 1220 |
|
|
BGSrc2.color = RGB(0,0,0); |
| 1221 |
|
|
BGSrc2.antiAlias = TRUE; |
| 1222 |
|
|
BGSrc2.alpha = 128; |
| 1223 |
maya |
1.11 |
strncpy_s(BGSrc2.file, sizeof(BGSrc2.file),"", _TRUNCATE); |
| 1224 |
yutakakn |
1.3 |
|
| 1225 |
|
|
BGReverseTextAlpha = 255; |
| 1226 |
|
|
|
| 1227 |
|
|
//?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スo?ス?ス |
| 1228 |
|
|
BGReadIniFile(ts.SetupFName); |
| 1229 |
|
|
|
| 1230 |
|
|
//?スR?ス?ス?スt?スB?スO?スt?ス@?スC?ス?ス?ス?ス?ス?ス?ス?ス |
| 1231 |
|
|
GetPrivateProfileString(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName); |
| 1232 |
maya |
1.11 |
RandomFile(path,config_file,sizeof(config_file)); |
| 1233 |
yutakakn |
1.3 |
|
| 1234 |
|
|
//?ス?ス?ス?ス?ス?ス?スI?ス[?スo?ス[?ス?ス?スC?スh |
| 1235 |
|
|
if(strcmp(config_file,"")) |
| 1236 |
|
|
{ |
| 1237 |
|
|
char dir[MAX_PATH],prevDir[MAX_PATH]; |
| 1238 |
|
|
|
| 1239 |
|
|
//INI?スt?ス@?スC?ス?ス?ス?ス?ス?ス?ス?ス?スf?スB?ス?ス?スN?スg?ス?ス?ス?ス?ス?ス?ス?ス?スI?ス?ス?ス?ス?ス?ス |
| 1240 |
|
|
GetCurrentDirectory(MAX_PATH,prevDir); |
| 1241 |
|
|
|
| 1242 |
|
|
ExtractDirName(config_file,dir); |
| 1243 |
|
|
SetCurrentDirectory(dir); |
| 1244 |
|
|
|
| 1245 |
|
|
BGReadIniFile(config_file); |
| 1246 |
|
|
|
| 1247 |
|
|
SetCurrentDirectory(prevDir); |
| 1248 |
|
|
} |
| 1249 |
|
|
|
| 1250 |
|
|
//SPI ?ス?ス?スp?スX?ス?ス?ス?ス?ス` |
| 1251 |
maya |
1.11 |
AppendSlash(BGSPIPath,sizeof(BGSPIPath)); |
| 1252 |
|
|
strncat_s(BGSPIPath,sizeof(BGSPIPath),"*",_TRUNCATE); |
| 1253 |
yutakakn |
1.3 |
|
| 1254 |
|
|
//?ス?ス?ス?ス or ?スw?スi?ス?ス?スv?ス?ス?ス?ス?ス[?スh |
| 1255 |
|
|
BGPreloadSrc(&BGDest); |
| 1256 |
|
|
BGPreloadSrc(&BGSrc1); |
| 1257 |
|
|
BGPreloadSrc(&BGSrc2); |
| 1258 |
|
|
|
| 1259 |
|
|
// AlphaBlend ?ス?ス?スA?スh?ス?ス?スX?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 1260 |
|
|
if(BGUseAlphaBlendAPI) |
| 1261 |
|
|
(FARPROC)BGAlphaBlend = GetProcAddressWithDllName("msimg32.dll","AlphaBlend"); |
| 1262 |
|
|
else |
| 1263 |
|
|
BGAlphaBlend = NULL; |
| 1264 |
|
|
|
| 1265 |
|
|
if(!BGAlphaBlend) |
| 1266 |
|
|
BGAlphaBlend = AlphaBlendWithoutAPI; |
| 1267 |
|
|
|
| 1268 |
|
|
//EnumDisplayMonitors ?ス?ス?スT?ス?ス |
| 1269 |
|
|
(FARPROC)BGEnumDisplayMonitors = GetProcAddressWithDllName("user32.dll","EnumDisplayMonitors"); |
| 1270 |
|
|
} |
| 1271 |
|
|
|
| 1272 |
|
|
void BGFillRect(HDC hdc,RECT *R,HBRUSH brush) |
| 1273 |
|
|
{ |
| 1274 |
|
|
if(!BGEnable) |
| 1275 |
|
|
FillRect(hdc,R,brush); |
| 1276 |
|
|
else |
| 1277 |
|
|
BitBlt(VTDC,R->left,R->top,R->right - R->left,R->bottom - R->top,hdcBG,R->left,R->top,SRCCOPY); |
| 1278 |
|
|
} |
| 1279 |
|
|
|
| 1280 |
|
|
void BGScrollWindow(HWND hwnd,int xa,int ya,RECT *Rect,RECT *ClipRect) |
| 1281 |
|
|
{ |
| 1282 |
yutakapon |
1.24 |
if (ts.MaximizedBugTweak) { |
| 1283 |
|
|
// Eterm lookfeel?ス?ス?スL?ス?ス?スA?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スE?スB?ス?ス?スh?スE?ス?ス?ス?ス?ス?ス?ス?ス?スX?スN?ス?ス?ス[?ス?ス?ス?ス?スg?ス?ス?ス?ス?ス?ス?スB |
| 1284 |
|
|
// ?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スA?ス?ス?ス?ス?ス?ス?スE?スB?ス?ス?スh?スE?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スP?ス?ス?ス?ス?ス?ス?スB(2008.2.1 doda, yutaka) |
| 1285 |
|
|
if(BGEnable || IsZoomed(hwnd)) |
| 1286 |
|
|
InvalidateRect(HVTWin,ClipRect,FALSE); |
| 1287 |
|
|
else |
| 1288 |
|
|
ScrollWindow(hwnd,xa,ya,Rect,ClipRect); |
| 1289 |
|
|
} else { |
| 1290 |
|
|
if(!BGEnable) |
| 1291 |
|
|
ScrollWindow(hwnd,xa,ya,Rect,ClipRect); |
| 1292 |
|
|
else |
| 1293 |
|
|
InvalidateRect(HVTWin,ClipRect,FALSE); |
| 1294 |
|
|
} |
| 1295 |
yutakakn |
1.3 |
} |
| 1296 |
|
|
|
| 1297 |
|
|
void BGOnEnterSizeMove(void) |
| 1298 |
|
|
{ |
| 1299 |
|
|
int r,g,b; |
| 1300 |
|
|
|
| 1301 |
|
|
if(!BGEnable || !BGFastSizeMove) |
| 1302 |
|
|
return; |
| 1303 |
|
|
|
| 1304 |
|
|
BGInSizeMove = TRUE; |
| 1305 |
|
|
|
| 1306 |
|
|
//?スw?スi?スF?ス?ス?ス?ス |
| 1307 |
|
|
r = GetRValue(BGDest.color); |
| 1308 |
|
|
g = GetGValue(BGDest.color); |
| 1309 |
|
|
b = GetBValue(BGDest.color); |
| 1310 |
|
|
|
| 1311 |
|
|
r = (r * (255 - BGSrc1.alpha) + GetRValue(BGSrc1.color) * BGSrc1.alpha) >> 8; |
| 1312 |
|
|
g = (g * (255 - BGSrc1.alpha) + GetGValue(BGSrc1.color) * BGSrc1.alpha) >> 8; |
| 1313 |
|
|
b = (b * (255 - BGSrc1.alpha) + GetBValue(BGSrc1.color) * BGSrc1.alpha) >> 8; |
| 1314 |
|
|
|
| 1315 |
|
|
r = (r * (255 - BGSrc2.alpha) + GetRValue(BGSrc2.color) * BGSrc2.alpha) >> 8; |
| 1316 |
|
|
g = (g * (255 - BGSrc2.alpha) + GetGValue(BGSrc2.color) * BGSrc2.alpha) >> 8; |
| 1317 |
|
|
b = (b * (255 - BGSrc2.alpha) + GetBValue(BGSrc2.color) * BGSrc2.alpha) >> 8; |
| 1318 |
|
|
|
| 1319 |
|
|
BGBrushInSizeMove = CreateSolidBrush(RGB(r,g,b)); |
| 1320 |
|
|
} |
| 1321 |
|
|
|
| 1322 |
|
|
void BGOnExitSizeMove(void) |
| 1323 |
|
|
{ |
| 1324 |
|
|
if(!BGEnable || !BGFastSizeMove) |
| 1325 |
|
|
return; |
| 1326 |
|
|
|
| 1327 |
|
|
BGInSizeMove = FALSE; |
| 1328 |
|
|
|
| 1329 |
|
|
BGSetupPrimary(TRUE); |
| 1330 |
|
|
InvalidateRect(HVTWin,NULL,FALSE); |
| 1331 |
yutakakn |
1.1 |
|
| 1332 |
yutakakn |
1.3 |
//?スu?ス?ス?スV?ス?ス?ス?ス?ス?ス |
| 1333 |
|
|
if(BGBrushInSizeMove) |
| 1334 |
|
|
{ |
| 1335 |
|
|
DeleteObject(BGBrushInSizeMove); |
| 1336 |
|
|
BGBrushInSizeMove = NULL; |
| 1337 |
|
|
} |
| 1338 |
|
|
} |
| 1339 |
yutakakn |
1.1 |
|
| 1340 |
yutakakn |
1.3 |
void BGOnSettingChange(void) |
| 1341 |
|
|
{ |
| 1342 |
|
|
if(!BGEnable) |
| 1343 |
|
|
return; |
| 1344 |
yutakakn |
1.1 |
|
| 1345 |
yutakakn |
1.3 |
CRTWidth = GetSystemMetrics(SM_CXSCREEN); |
| 1346 |
|
|
CRTHeight = GetSystemMetrics(SM_CYSCREEN); |
| 1347 |
yutakakn |
1.1 |
|
| 1348 |
yutakakn |
1.3 |
//?ス?ス?ス?ス or ?スw?スi?ス?ス?スv?ス?ス?ス?ス?ス[?スh |
| 1349 |
|
|
BGPreloadSrc(&BGDest); |
| 1350 |
|
|
BGPreloadSrc(&BGSrc1); |
| 1351 |
|
|
BGPreloadSrc(&BGSrc2); |
| 1352 |
yutakakn |
1.1 |
|
| 1353 |
yutakakn |
1.3 |
BGSetupPrimary(TRUE); |
| 1354 |
|
|
InvalidateRect(HVTWin,0,FALSE); |
| 1355 |
|
|
} |
| 1356 |
yutakakn |
1.1 |
|
| 1357 |
yutakakn |
1.3 |
//--> |
| 1358 |
|
|
#endif // ALPHABLEND_TYPE2 |
| 1359 |
yutakakn |
1.1 |
|
| 1360 |
doda |
1.25 |
void DispApplyANSIColor() { |
| 1361 |
yutakakn |
1.1 |
int i; |
| 1362 |
|
|
|
| 1363 |
doda |
1.25 |
for (i = IdBack ; i <= IdFore+8 ; i++) |
| 1364 |
|
|
ANSIColor[i] = ts.ANSIColor[i]; |
| 1365 |
|
|
|
| 1366 |
|
|
if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) { |
| 1367 |
|
|
#ifdef ALPHABLEND_TYPE2 |
| 1368 |
|
|
ANSIColor[IdBack ] = BGVTColor[1]; // use background color for "Black" |
| 1369 |
|
|
ANSIColor[IdFore ] = BGVTColor[0]; // use text color for "white" |
| 1370 |
|
|
#else |
| 1371 |
|
|
ANSIColor[IdBack ] = ts.VTColor[1]; // use background color for "Black" |
| 1372 |
|
|
ANSIColor[IdFore ] = ts.VTColor[0]; // use text color for "white" |
| 1373 |
|
|
#endif |
| 1374 |
|
|
} |
| 1375 |
|
|
} |
| 1376 |
yutakakn |
1.1 |
|
| 1377 |
doda |
1.25 |
void InitColorTable() |
| 1378 |
|
|
{ |
| 1379 |
yutakakn |
1.1 |
#ifndef NO_ANSI_COLOR_EXTENSION |
| 1380 |
doda |
1.25 |
DispApplyANSIColor(); |
| 1381 |
yutakakn |
1.1 |
#else /* NO_ANSI_COLOR_EXTENSION */ |
| 1382 |
doda |
1.25 |
ANSIColor[IdBack ] = RGB( 0, 0, 0); |
| 1383 |
yutakakn |
1.1 |
ANSIColor[IdRed ] = RGB(255, 0, 0); |
| 1384 |
|
|
ANSIColor[IdGreen] = RGB( 0,255, 0); |
| 1385 |
|
|
ANSIColor[IdYellow] = RGB(255,255, 0); |
| 1386 |
|
|
ANSIColor[IdBlue] = RGB( 0, 0,255); |
| 1387 |
|
|
ANSIColor[IdMagenta] = RGB(255, 0,255); |
| 1388 |
|
|
ANSIColor[IdCyan] = RGB( 0,255,255); |
| 1389 |
doda |
1.25 |
ANSIColor[IdFore ] = RGB(255,255,255); |
| 1390 |
yutakakn |
1.1 |
ANSIColor[IdBack+8] = RGB(128,128,128); |
| 1391 |
|
|
ANSIColor[IdRed+8] = RGB(128, 0, 0); |
| 1392 |
|
|
ANSIColor[IdGreen+8] = RGB( 0,128, 0); |
| 1393 |
|
|
ANSIColor[IdYellow+8] = RGB(128,128, 0); |
| 1394 |
|
|
ANSIColor[IdBlue+8] = RGB( 0, 0,128); |
| 1395 |
|
|
ANSIColor[IdMagenta+8] = RGB(128, 0,128); |
| 1396 |
|
|
ANSIColor[IdCyan+8] = RGB( 0,128,128); |
| 1397 |
|
|
ANSIColor[IdFore+8] = RGB(192,192,192); |
| 1398 |
|
|
#endif /* NO_ANSI_COLOR_EXTENSION */ |
| 1399 |
doda |
1.25 |
ANSIColor[16] = RGB(0,0,0); |
| 1400 |
|
|
ANSIColor[17] = RGB(0,0,95); |
| 1401 |
|
|
ANSIColor[18] = RGB(0,0,135); |
| 1402 |
|
|
ANSIColor[19] = RGB(0,0,175); |
| 1403 |
|
|
ANSIColor[20] = RGB(0,0,215); |
| 1404 |
|
|
ANSIColor[21] = RGB(0,0,255); |
| 1405 |
|
|
ANSIColor[22] = RGB(0,95,0); |
| 1406 |
|
|
ANSIColor[23] = RGB(0,95,95); |
| 1407 |
|
|
ANSIColor[24] = RGB(0,95,135); |
| 1408 |
|
|
ANSIColor[25] = RGB(0,95,175); |
| 1409 |
|
|
ANSIColor[26] = RGB(0,95,215); |
| 1410 |
|
|
ANSIColor[27] = RGB(0,95,255); |
| 1411 |
|
|
ANSIColor[28] = RGB(0,135,0); |
| 1412 |
|
|
ANSIColor[29] = RGB(0,135,95); |
| 1413 |
|
|
ANSIColor[30] = RGB(0,135,135); |
| 1414 |
|
|
ANSIColor[31] = RGB(0,135,175); |
| 1415 |
|
|
ANSIColor[32] = RGB(0,135,215); |
| 1416 |
|
|
ANSIColor[33] = RGB(0,135,255); |
| 1417 |
|
|
ANSIColor[34] = RGB(0,175,0); |
| 1418 |
|
|
ANSIColor[35] = RGB(0,175,95); |
| 1419 |
|
|
ANSIColor[36] = RGB(0,175,135); |
| 1420 |
|
|
ANSIColor[37] = RGB(0,175,175); |
| 1421 |
|
|
ANSIColor[38] = RGB(0,175,215); |
| 1422 |
|
|
ANSIColor[39] = RGB(0,175,255); |
| 1423 |
|
|
ANSIColor[40] = RGB(0,215,0); |
| 1424 |
|
|
ANSIColor[41] = RGB(0,215,95); |
| 1425 |
|
|
ANSIColor[42] = RGB(0,215,135); |
| 1426 |
|
|
ANSIColor[43] = RGB(0,215,175); |
| 1427 |
|
|
ANSIColor[44] = RGB(0,215,215); |
| 1428 |
|
|
ANSIColor[45] = RGB(0,215,255); |
| 1429 |
|
|
ANSIColor[46] = RGB(0,255,0); |
| 1430 |
|
|
ANSIColor[47] = RGB(0,255,95); |
| 1431 |
|
|
ANSIColor[48] = RGB(0,255,135); |
| 1432 |
|
|
ANSIColor[49] = RGB(0,255,175); |
| 1433 |
|
|
ANSIColor[50] = RGB(0,255,215); |
| 1434 |
|
|
ANSIColor[51] = RGB(0,255,255); |
| 1435 |
|
|
ANSIColor[52] = RGB(95,0,0); |
| 1436 |
|
|
ANSIColor[53] = RGB(95,0,95); |
| 1437 |
|
|
ANSIColor[54] = RGB(95,0,135); |
| 1438 |
|
|
ANSIColor[55] = RGB(95,0,175); |
| 1439 |
|
|
ANSIColor[56] = RGB(95,0,215); |
| 1440 |
|
|
ANSIColor[57] = RGB(95,0,255); |
| 1441 |
|
|
ANSIColor[58] = RGB(95,95,0); |
| 1442 |
|
|
ANSIColor[59] = RGB(95,95,95); |
| 1443 |
|
|
ANSIColor[60] = RGB(95,95,135); |
| 1444 |
|
|
ANSIColor[61] = RGB(95,95,175); |
| 1445 |
|
|
ANSIColor[62] = RGB(95,95,215); |
| 1446 |
|
|
ANSIColor[63] = RGB(95,95,255); |
| 1447 |
|
|
ANSIColor[64] = RGB(95,135,0); |
| 1448 |
|
|
ANSIColor[65] = RGB(95,135,95); |
| 1449 |
|
|
ANSIColor[66] = RGB(95,135,135); |
| 1450 |
|
|
ANSIColor[67] = RGB(95,135,175); |
| 1451 |
|
|
ANSIColor[68] = RGB(95,135,215); |
| 1452 |
|
|
ANSIColor[69] = RGB(95,135,255); |
| 1453 |
|
|
ANSIColor[70] = RGB(95,175,0); |
| 1454 |
|
|
ANSIColor[71] = RGB(95,175,95); |
| 1455 |
|
|
ANSIColor[72] = RGB(95,175,135); |
| 1456 |
|
|
ANSIColor[73] = RGB(95,175,175); |
| 1457 |
|
|
ANSIColor[74] = RGB(95,175,215); |
| 1458 |
|
|
ANSIColor[75] = RGB(95,175,255); |
| 1459 |
|
|
ANSIColor[76] = RGB(95,215,0); |
| 1460 |
|
|
ANSIColor[77] = RGB(95,215,95); |
| 1461 |
|
|
ANSIColor[78] = RGB(95,215,135); |
| 1462 |
|
|
ANSIColor[79] = RGB(95,215,175); |
| 1463 |
|
|
ANSIColor[80] = RGB(95,215,215); |
| 1464 |
|
|
ANSIColor[81] = RGB(95,215,255); |
| 1465 |
|
|
ANSIColor[82] = RGB(95,255,0); |
| 1466 |
|
|
ANSIColor[83] = RGB(95,255,95); |
| 1467 |
|
|
ANSIColor[84] = RGB(95,255,135); |
| 1468 |
|
|
ANSIColor[85] = RGB(95,255,175); |
| 1469 |
|
|
ANSIColor[86] = RGB(95,255,215); |
| 1470 |
|
|
ANSIColor[87] = RGB(95,255,255); |
| 1471 |
|
|
ANSIColor[88] = RGB(135,0,0); |
| 1472 |
|
|
ANSIColor[89] = RGB(135,0,95); |
| 1473 |
|
|
ANSIColor[90] = RGB(135,0,135); |
| 1474 |
|
|
ANSIColor[91] = RGB(135,0,175); |
| 1475 |
|
|
ANSIColor[92] = RGB(135,0,215); |
| 1476 |
|
|
ANSIColor[93] = RGB(135,0,255); |
| 1477 |
|
|
ANSIColor[94] = RGB(135,95,0); |
| 1478 |
|
|
ANSIColor[95] = RGB(135,95,95); |
| 1479 |
|
|
ANSIColor[96] = RGB(135,95,135); |
| 1480 |
|
|
ANSIColor[97] = RGB(135,95,175); |
| 1481 |
|
|
ANSIColor[98] = RGB(135,95,215); |
| 1482 |
|
|
ANSIColor[99] = RGB(135,95,255); |
| 1483 |
|
|
ANSIColor[100] = RGB(135,135,0); |
| 1484 |
|
|
ANSIColor[101] = RGB(135,135,95); |
| 1485 |
|
|
ANSIColor[102] = RGB(135,135,135); |
| 1486 |
|
|
ANSIColor[103] = RGB(135,135,175); |
| 1487 |
|
|
ANSIColor[104] = RGB(135,135,215); |
| 1488 |
|
|
ANSIColor[105] = RGB(135,135,255); |
| 1489 |
|
|
ANSIColor[106] = RGB(135,175,0); |
| 1490 |
|
|
ANSIColor[107] = RGB(135,175,95); |
| 1491 |
|
|
ANSIColor[108] = RGB(135,175,135); |
| 1492 |
|
|
ANSIColor[109] = RGB(135,175,175); |
| 1493 |
|
|
ANSIColor[110] = RGB(135,175,215); |
| 1494 |
|
|
ANSIColor[111] = RGB(135,175,255); |
| 1495 |
|
|
ANSIColor[112] = RGB(135,215,0); |
| 1496 |
|
|
ANSIColor[113] = RGB(135,215,95); |
| 1497 |
|
|
ANSIColor[114] = RGB(135,215,135); |
| 1498 |
|
|
ANSIColor[115] = RGB(135,215,175); |
| 1499 |
|
|
ANSIColor[116] = RGB(135,215,215); |
| 1500 |
|
|
ANSIColor[117] = RGB(135,215,255); |
| 1501 |
|
|
ANSIColor[118] = RGB(135,255,0); |
| 1502 |
|
|
ANSIColor[119] = RGB(135,255,95); |
| 1503 |
|
|
ANSIColor[120] = RGB(135,255,135); |
| 1504 |
|
|
ANSIColor[121] = RGB(135,255,175); |
| 1505 |
|
|
ANSIColor[122] = RGB(135,255,215); |
| 1506 |
|
|
ANSIColor[123] = RGB(135,255,255); |
| 1507 |
|
|
ANSIColor[124] = RGB(175,0,0); |
| 1508 |
|
|
ANSIColor[125] = RGB(175,0,95); |
| 1509 |
|
|
ANSIColor[126] = RGB(175,0,135); |
| 1510 |
|
|
ANSIColor[127] = RGB(175,0,175); |
| 1511 |
|
|
ANSIColor[128] = RGB(175,0,215); |
| 1512 |
|
|
ANSIColor[129] = RGB(175,0,255); |
| 1513 |
|
|
ANSIColor[130] = RGB(175,95,0); |
| 1514 |
|
|
ANSIColor[131] = RGB(175,95,95); |
| 1515 |
|
|
ANSIColor[132] = RGB(175,95,135); |
| 1516 |
|
|
ANSIColor[133] = RGB(175,95,175); |
| 1517 |
|
|
ANSIColor[134] = RGB(175,95,215); |
| 1518 |
|
|
ANSIColor[135] = RGB(175,95,255); |
| 1519 |
|
|
ANSIColor[136] = RGB(175,135,0); |
| 1520 |
|
|
ANSIColor[137] = RGB(175,135,95); |
| 1521 |
|
|
ANSIColor[138] = RGB(175,135,135); |
| 1522 |
|
|
ANSIColor[139] = RGB(175,135,175); |
| 1523 |
|
|
ANSIColor[140] = RGB(175,135,215); |
| 1524 |
|
|
ANSIColor[141] = RGB(175,135,255); |
| 1525 |
|
|
ANSIColor[142] = RGB(175,175,0); |
| 1526 |
|
|
ANSIColor[143] = RGB(175,175,95); |
| 1527 |
|
|
ANSIColor[144] = RGB(175,175,135); |
| 1528 |
|
|
ANSIColor[145] = RGB(175,175,175); |
| 1529 |
|
|
ANSIColor[146] = RGB(175,175,215); |
| 1530 |
|
|
ANSIColor[147] = RGB(175,175,255); |
| 1531 |
|
|
ANSIColor[148] = RGB(175,215,0); |
| 1532 |
|
|
ANSIColor[149] = RGB(175,215,95); |
| 1533 |
|
|
ANSIColor[150] = RGB(175,215,135); |
| 1534 |
|
|
ANSIColor[151] = RGB(175,215,175); |
| 1535 |
|
|
ANSIColor[152] = RGB(175,215,215); |
| 1536 |
|
|
ANSIColor[153] = RGB(175,215,255); |
| 1537 |
|
|
ANSIColor[154] = RGB(175,255,0); |
| 1538 |
|
|
ANSIColor[155] = RGB(175,255,95); |
| 1539 |
|
|
ANSIColor[156] = RGB(175,255,135); |
| 1540 |
|
|
ANSIColor[157] = RGB(175,255,175); |
| 1541 |
|
|
ANSIColor[158] = RGB(175,255,215); |
| 1542 |
|
|
ANSIColor[159] = RGB(175,255,255); |
| 1543 |
|
|
ANSIColor[160] = RGB(215,0,0); |
| 1544 |
|
|
ANSIColor[161] = RGB(215,0,95); |
| 1545 |
|
|
ANSIColor[162] = RGB(215,0,135); |
| 1546 |
|
|
ANSIColor[163] = RGB(215,0,175); |
| 1547 |
|
|
ANSIColor[164] = RGB(215,0,215); |
| 1548 |
|
|
ANSIColor[165] = RGB(215,0,255); |
| 1549 |
|
|
ANSIColor[166] = RGB(215,95,0); |
| 1550 |
|
|
ANSIColor[167] = RGB(215,95,95); |
| 1551 |
|
|
ANSIColor[168] = RGB(215,95,135); |
| 1552 |
|
|
ANSIColor[169] = RGB(215,95,175); |
| 1553 |
|
|
ANSIColor[170] = RGB(215,95,215); |
| 1554 |
|
|
ANSIColor[171] = RGB(215,95,255); |
| 1555 |
|
|
ANSIColor[172] = RGB(215,135,0); |
| 1556 |
|
|
ANSIColor[173] = RGB(215,135,95); |
| 1557 |
|
|
ANSIColor[174] = RGB(215,135,135); |
| 1558 |
|
|
ANSIColor[175] = RGB(215,135,175); |
| 1559 |
|
|
ANSIColor[176] = RGB(215,135,215); |
| 1560 |
|
|
ANSIColor[177] = RGB(215,135,255); |
| 1561 |
|
|
ANSIColor[178] = RGB(215,175,0); |
| 1562 |
|
|
ANSIColor[179] = RGB(215,175,95); |
| 1563 |
|
|
ANSIColor[180] = RGB(215,175,135); |
| 1564 |
|
|
ANSIColor[181] = RGB(215,175,175); |
| 1565 |
|
|
ANSIColor[182] = RGB(215,175,215); |
| 1566 |
|
|
ANSIColor[183] = RGB(215,175,255); |
| 1567 |
|
|
ANSIColor[184] = RGB(215,215,0); |
| 1568 |
|
|
ANSIColor[185] = RGB(215,215,95); |
| 1569 |
|
|
ANSIColor[186] = RGB(215,215,135); |
| 1570 |
|
|
ANSIColor[187] = RGB(215,215,175); |
| 1571 |
|
|
ANSIColor[188] = RGB(215,215,215); |
| 1572 |
|
|
ANSIColor[189] = RGB(215,215,255); |
| 1573 |
|
|
ANSIColor[190] = RGB(215,255,0); |
| 1574 |
|
|
ANSIColor[191] = RGB(215,255,95); |
| 1575 |
|
|
ANSIColor[192] = RGB(215,255,135); |
| 1576 |
|
|
ANSIColor[193] = RGB(215,255,175); |
| 1577 |
|
|
ANSIColor[194] = RGB(215,255,215); |
| 1578 |
|
|
ANSIColor[195] = RGB(215,255,255); |
| 1579 |
|
|
ANSIColor[196] = RGB(255,0,0); |
| 1580 |
|
|
ANSIColor[197] = RGB(255,0,95); |
| 1581 |
|
|
ANSIColor[198] = RGB(255,0,135); |
| 1582 |
|
|
ANSIColor[199] = RGB(255,0,175); |
| 1583 |
|
|
ANSIColor[200] = RGB(255,0,215); |
| 1584 |
|
|
ANSIColor[201] = RGB(255,0,255); |
| 1585 |
|
|
ANSIColor[202] = RGB(255,95,0); |
| 1586 |
|
|
ANSIColor[203] = RGB(255,95,95); |
| 1587 |
|
|
ANSIColor[204] = RGB(255,95,135); |
| 1588 |
|
|
ANSIColor[205] = RGB(255,95,175); |
| 1589 |
|
|
ANSIColor[206] = RGB(255,95,215); |
| 1590 |
|
|
ANSIColor[207] = RGB(255,95,255); |
| 1591 |
|
|
ANSIColor[208] = RGB(255,135,0); |
| 1592 |
|
|
ANSIColor[209] = RGB(255,135,95); |
| 1593 |
|
|
ANSIColor[210] = RGB(255,135,135); |
| 1594 |
|
|
ANSIColor[211] = RGB(255,135,175); |
| 1595 |
|
|
ANSIColor[212] = RGB(255,135,215); |
| 1596 |
|
|
ANSIColor[213] = RGB(255,135,255); |
| 1597 |
|
|
ANSIColor[214] = RGB(255,175,0); |
| 1598 |
|
|
ANSIColor[215] = RGB(255,175,95); |
| 1599 |
|
|
ANSIColor[216] = RGB(255,175,135); |
| 1600 |
|
|
ANSIColor[217] = RGB(255,175,175); |
| 1601 |
|
|
ANSIColor[218] = RGB(255,175,215); |
| 1602 |
|
|
ANSIColor[219] = RGB(255,175,255); |
| 1603 |
|
|
ANSIColor[220] = RGB(255,215,0); |
| 1604 |
|
|
ANSIColor[221] = RGB(255,215,95); |
| 1605 |
|
|
ANSIColor[222] = RGB(255,215,135); |
| 1606 |
|
|
ANSIColor[223] = RGB(255,215,175); |
| 1607 |
|
|
ANSIColor[224] = RGB(255,215,215); |
| 1608 |
|
|
ANSIColor[225] = RGB(255,215,255); |
| 1609 |
|
|
ANSIColor[226] = RGB(255,255,0); |
| 1610 |
|
|
ANSIColor[227] = RGB(255,255,95); |
| 1611 |
|
|
ANSIColor[228] = RGB(255,255,135); |
| 1612 |
|
|
ANSIColor[229] = RGB(255,255,175); |
| 1613 |
|
|
ANSIColor[230] = RGB(255,255,215); |
| 1614 |
|
|
ANSIColor[231] = RGB(255,255,255); |
| 1615 |
|
|
ANSIColor[232] = RGB(8,8,8); |
| 1616 |
|
|
ANSIColor[233] = RGB(18,18,18); |
| 1617 |
|
|
ANSIColor[234] = RGB(28,28,28); |
| 1618 |
|
|
ANSIColor[235] = RGB(38,38,38); |
| 1619 |
|
|
ANSIColor[236] = RGB(48,48,48); |
| 1620 |
|
|
ANSIColor[237] = RGB(58,58,58); |
| 1621 |
|
|
ANSIColor[238] = RGB(68,68,68); |
| 1622 |
|
|
ANSIColor[239] = RGB(78,78,78); |
| 1623 |
|
|
ANSIColor[240] = RGB(88,88,88); |
| 1624 |
|
|
ANSIColor[241] = RGB(98,98,98); |
| 1625 |
|
|
ANSIColor[242] = RGB(108,108,108); |
| 1626 |
|
|
ANSIColor[243] = RGB(118,118,118); |
| 1627 |
|
|
ANSIColor[244] = RGB(128,128,128); |
| 1628 |
|
|
ANSIColor[245] = RGB(138,138,138); |
| 1629 |
|
|
ANSIColor[246] = RGB(148,148,148); |
| 1630 |
|
|
ANSIColor[247] = RGB(158,158,158); |
| 1631 |
|
|
ANSIColor[248] = RGB(168,168,168); |
| 1632 |
|
|
ANSIColor[249] = RGB(178,178,178); |
| 1633 |
|
|
ANSIColor[250] = RGB(188,188,188); |
| 1634 |
|
|
ANSIColor[251] = RGB(198,198,198); |
| 1635 |
|
|
ANSIColor[252] = RGB(208,208,208); |
| 1636 |
|
|
ANSIColor[253] = RGB(218,218,218); |
| 1637 |
|
|
ANSIColor[254] = RGB(228,228,228); |
| 1638 |
|
|
ANSIColor[255] = RGB(238,238,238); |
| 1639 |
|
|
|
| 1640 |
|
|
if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) { |
| 1641 |
|
|
#ifdef ALPHABLEND_TYPE2 |
| 1642 |
|
|
ANSIColor[IdBack ] = BGVTColor[1]; // use background color for "Black" |
| 1643 |
|
|
ANSIColor[IdFore ] = BGVTColor[0]; // use text color for "white" |
| 1644 |
|
|
#else |
| 1645 |
|
|
ANSIColor[IdBack ] = ts.VTColor[1]; // use background color for "Black" |
| 1646 |
|
|
ANSIColor[IdFore ] = ts.VTColor[0]; // use text color for "white" |
| 1647 |
|
|
#endif |
| 1648 |
|
|
} |
| 1649 |
|
|
} |
| 1650 |
|
|
|
| 1651 |
|
|
void DispSetNearestColors(int start, int end, HDC DispCtx) { |
| 1652 |
|
|
HDC TmpDC; |
| 1653 |
|
|
int i; |
| 1654 |
|
|
|
| 1655 |
|
|
if (DispCtx) { |
| 1656 |
|
|
TmpDC = DispCtx; |
| 1657 |
|
|
} |
| 1658 |
|
|
else { |
| 1659 |
|
|
TmpDC = GetDC(NULL); |
| 1660 |
|
|
} |
| 1661 |
|
|
|
| 1662 |
|
|
for (i = start ; i <= end; i++) |
| 1663 |
|
|
ANSIColor[i] = GetNearestColor(TmpDC, ANSIColor[i]); |
| 1664 |
|
|
|
| 1665 |
|
|
if (!DispCtx) { |
| 1666 |
|
|
ReleaseDC(NULL, TmpDC); |
| 1667 |
|
|
} |
| 1668 |
|
|
} |
| 1669 |
|
|
|
| 1670 |
|
|
void InitDisp() |
| 1671 |
|
|
{ |
| 1672 |
|
|
HDC TmpDC; |
| 1673 |
|
|
BOOL bMultiDisplaySupport = FALSE; |
| 1674 |
|
|
|
| 1675 |
|
|
TmpDC = GetDC(NULL); |
| 1676 |
yutakakn |
1.1 |
|
| 1677 |
yutakakn |
1.3 |
#ifdef ALPHABLEND_TYPE2 |
| 1678 |
|
|
CRTWidth = GetSystemMetrics(SM_CXSCREEN); |
| 1679 |
|
|
CRTHeight = GetSystemMetrics(SM_CYSCREEN); |
| 1680 |
|
|
|
| 1681 |
|
|
BGInitialize(); |
| 1682 |
doda |
1.25 |
#else |
| 1683 |
|
|
InitColorTable(); |
| 1684 |
yutakakn |
1.3 |
#endif // ALPHABLEND_TYPE2 |
| 1685 |
|
|
|
| 1686 |
doda |
1.25 |
DispSetNearestColors(IdBack, 255, TmpDC); |
| 1687 |
yutakakn |
1.1 |
|
| 1688 |
|
|
/* background paintbrush */ |
| 1689 |
|
|
Background = CreateSolidBrush(ts.VTColor[1]); |
| 1690 |
|
|
/* CRT width & height */ |
| 1691 |
yutakakn |
1.2 |
{ |
| 1692 |
|
|
OSVERSIONINFO ver; |
| 1693 |
|
|
ZeroMemory( &ver, sizeof(ver) ); |
| 1694 |
|
|
ver.dwOSVersionInfoSize = sizeof(ver); |
| 1695 |
|
|
GetVersionEx( &ver ); |
| 1696 |
|
|
switch( ver.dwPlatformId ) { |
| 1697 |
|
|
// Windows 9x ?ス?ス NT ?ス?ス?ス?ス?ス?ス?ス?ス |
| 1698 |
|
|
case VER_PLATFORM_WIN32_WINDOWS: |
| 1699 |
|
|
if( ver.dwMajorVersion > 4 || |
| 1700 |
|
|
(ver.dwMajorVersion == 4 && ver.dwMinorVersion >= 10) ) // Windows 98 or later |
| 1701 |
|
|
bMultiDisplaySupport = TRUE; |
| 1702 |
|
|
break; |
| 1703 |
|
|
case VER_PLATFORM_WIN32_NT: |
| 1704 |
|
|
if( ver.dwMajorVersion >= 5 ) // Windows 2000 or later |
| 1705 |
|
|
bMultiDisplaySupport = TRUE; |
| 1706 |
|
|
break; |
| 1707 |
|
|
default: |
| 1708 |
|
|
break; |
| 1709 |
|
|
} |
| 1710 |
|
|
} |
| 1711 |
|
|
if( bMultiDisplaySupport ) { |
| 1712 |
|
|
VirtualScreen.left = GetSystemMetrics(SM_XVIRTUALSCREEN); |
| 1713 |
|
|
VirtualScreen.top = GetSystemMetrics(SM_YVIRTUALSCREEN); |
| 1714 |
|
|
VirtualScreen.right = VirtualScreen.left + GetSystemMetrics(SM_CXVIRTUALSCREEN); |
| 1715 |
|
|
VirtualScreen.bottom = VirtualScreen.top + GetSystemMetrics(SM_CYVIRTUALSCREEN); |
| 1716 |
|
|
} else { |
| 1717 |
|
|
VirtualScreen.left = 0; |
| 1718 |
|
|
VirtualScreen.top = 0; |
| 1719 |
|
|
VirtualScreen.right = GetDeviceCaps(TmpDC,HORZRES); |
| 1720 |
|
|
VirtualScreen.bottom = GetDeviceCaps(TmpDC,VERTRES); |
| 1721 |
|
|
} |
| 1722 |
yutakakn |
1.1 |
|
| 1723 |
|
|
ReleaseDC(NULL, TmpDC); |
| 1724 |
|
|
|
| 1725 |
yutakakn |
1.2 |
if ( (ts.VTPos.x > VirtualScreen.right) || (ts.VTPos.y > VirtualScreen.bottom) ) |
| 1726 |
yutakakn |
1.1 |
{ |
| 1727 |
|
|
ts.VTPos.x = CW_USEDEFAULT; |
| 1728 |
|
|
ts.VTPos.y = CW_USEDEFAULT; |
| 1729 |
|
|
} |
| 1730 |
yutakakn |
1.2 |
else if ( (ts.VTPos.x < VirtualScreen.left-20) || (ts.VTPos.y < VirtualScreen.top-20) ) |
| 1731 |
|
|
{ |
| 1732 |
|
|
ts.VTPos.x = CW_USEDEFAULT; |
| 1733 |
|
|
ts.VTPos.y = CW_USEDEFAULT; |
| 1734 |
|
|
} |
| 1735 |
|
|
else { |
| 1736 |
|
|
if ( ts.VTPos.x < VirtualScreen.left ) ts.VTPos.x = VirtualScreen.left; |
| 1737 |
|
|
if ( ts.VTPos.y < VirtualScreen.top ) ts.VTPos.y = VirtualScreen.top; |
| 1738 |
|
|
} |
| 1739 |
yutakakn |
1.1 |
|
| 1740 |
yutakakn |
1.2 |
if ( (ts.TEKPos.x > VirtualScreen.right) || (ts.TEKPos.y > VirtualScreen.bottom) ) |
| 1741 |
yutakakn |
1.1 |
{ |
| 1742 |
|
|
ts.TEKPos.x = CW_USEDEFAULT; |
| 1743 |
|
|
ts.TEKPos.y = CW_USEDEFAULT; |
| 1744 |
|
|
} |
| 1745 |
yutakakn |
1.2 |
else if ( (ts.TEKPos.x < VirtualScreen.left-20) || (ts.TEKPos.y < VirtualScreen.top-20) ) |
| 1746 |
|
|
{ |
| 1747 |
|
|
ts.TEKPos.x = CW_USEDEFAULT; |
| 1748 |
|
|
ts.TEKPos.y = CW_USEDEFAULT; |
| 1749 |
|
|
} |
| 1750 |
|
|
else { |
| 1751 |
|
|
if ( ts.TEKPos.x < VirtualScreen.left ) ts.TEKPos.x = VirtualScreen.left; |
| 1752 |
|
|
if ( ts.TEKPos.y < VirtualScreen.top ) ts.TEKPos.y = VirtualScreen.top; |
| 1753 |
|
|
} |
| 1754 |
yutakakn |
1.1 |
} |
| 1755 |
|
|
|
| 1756 |
|
|
void EndDisp() |
| 1757 |
|
|
{ |
| 1758 |
|
|
int i, j; |
| 1759 |
|
|
|
| 1760 |
|
|
if (VTDC!=NULL) DispReleaseDC(); |
| 1761 |
|
|
|
| 1762 |
|
|
/* Delete fonts */ |
| 1763 |
|
|
for (i = 0 ; i <= AttrFontMask; i++) |
| 1764 |
|
|
{ |
| 1765 |
|
|
for (j = i+1 ; j <= AttrFontMask ; j++) |
| 1766 |
|
|
if (VTFont[j]==VTFont[i]) |
| 1767 |
|
|
VTFont[j] = 0; |
| 1768 |
|
|
if (VTFont[i]!=0) DeleteObject(VTFont[i]); |
| 1769 |
|
|
} |
| 1770 |
|
|
|
| 1771 |
|
|
if (Background!=0) |
| 1772 |
|
|
{ |
| 1773 |
|
|
DeleteObject(Background); |
| 1774 |
|
|
Background = 0; |
| 1775 |
|
|
} |
| 1776 |
yutakakn |
1.3 |
|
| 1777 |
|
|
#ifdef ALPHABLEND_TYPE2 |
| 1778 |
|
|
//<!--by AKASI |
| 1779 |
|
|
BGDestruct(); |
| 1780 |
|
|
//--> |
| 1781 |
|
|
#endif // ALPHABLEND_TYPE2 |
| 1782 |
|
|
|
| 1783 |
yutakakn |
1.1 |
} |
| 1784 |
|
|
|
| 1785 |
|
|
void DispReset() |
| 1786 |
|
|
{ |
| 1787 |
|
|
/* Cursor */ |
| 1788 |
|
|
CursorX = 0; |
| 1789 |
|
|
CursorY = 0; |
| 1790 |
|
|
|
| 1791 |
|
|
/* Scroll status */ |
| 1792 |
|
|
ScrollCount = 0; |
| 1793 |
|
|
dScroll = 0; |
| 1794 |
|
|
|
| 1795 |
|
|
if (IsCaretOn()) CaretOn(); |
| 1796 |
|
|
DispEnableCaret(TRUE); // enable caret |
| 1797 |
|
|
} |
| 1798 |
|
|
|
| 1799 |
|
|
void DispConvWinToScreen |
| 1800 |
|
|
(int Xw, int Yw, int *Xs, int *Ys, PBOOL Right) |
| 1801 |
|
|
// Converts window coordinate to screen cordinate |
| 1802 |
|
|
// Xs: horizontal position in window coordinate (pixels) |
| 1803 |
|
|
// Ys: vertical |
| 1804 |
|
|
// Output |
| 1805 |
|
|
// Xs, Ys: screen coordinate |
| 1806 |
|
|
// Right: TRUE if the (Xs,Ys) is on the right half of |
| 1807 |
|
|
// a character cell. |
| 1808 |
|
|
{ |
| 1809 |
|
|
if (Xs!=NULL) |
| 1810 |
|
|
*Xs = Xw / FontWidth + WinOrgX; |
| 1811 |
|
|
*Ys = Yw / FontHeight + WinOrgY; |
| 1812 |
|
|
if ((Xs!=NULL) && (Right!=NULL)) |
| 1813 |
|
|
*Right = (Xw - (*Xs-WinOrgX)*FontWidth) >= FontWidth/2; |
| 1814 |
|
|
} |
| 1815 |
|
|
|
| 1816 |
|
|
void SetLogFont() |
| 1817 |
|
|
{ |
| 1818 |
|
|
memset(&VTlf, 0, sizeof(LOGFONT)); |
| 1819 |
|
|
VTlf.lfWeight = FW_NORMAL; |
| 1820 |
|
|
VTlf.lfItalic = 0; |
| 1821 |
|
|
VTlf.lfUnderline = 0; |
| 1822 |
|
|
VTlf.lfStrikeOut = 0; |
| 1823 |
|
|
VTlf.lfWidth = ts.VTFontSize.x; |
| 1824 |
|
|
VTlf.lfHeight = ts.VTFontSize.y; |
| 1825 |
|
|
VTlf.lfCharSet = ts.VTFontCharSet; |
| 1826 |
|
|
VTlf.lfOutPrecision = OUT_CHARACTER_PRECIS; |
| 1827 |
|
|
VTlf.lfClipPrecision = CLIP_CHARACTER_PRECIS; |
| 1828 |
|
|
VTlf.lfQuality = DEFAULT_QUALITY; |
| 1829 |
|
|
VTlf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE; |
| 1830 |
maya |
1.11 |
strncpy_s(VTlf.lfFaceName, sizeof(VTlf.lfFaceName),ts.VTFont, _TRUNCATE); |
| 1831 |
yutakakn |
1.1 |
} |
| 1832 |
|
|
|
| 1833 |
|
|
void ChangeFont() |
| 1834 |
|
|
{ |
| 1835 |
|
|
int i, j; |
| 1836 |
|
|
TEXTMETRIC Metrics; |
| 1837 |
|
|
HDC TmpDC; |
| 1838 |
|
|
|
| 1839 |
|
|
/* Delete Old Fonts */ |
| 1840 |
|
|
for (i = 0 ; i <= AttrFontMask ; i++) |
| 1841 |
|
|
{ |
| 1842 |
|
|
for (j = i+1 ; j <= AttrFontMask ; j++) |
| 1843 |
|
|
if (VTFont[j]==VTFont[i]) |
| 1844 |
|
|
VTFont[j] = 0; |
| 1845 |
|
|
if (VTFont[i]!=0) |
| 1846 |
|
|
DeleteObject(VTFont[i]); |
| 1847 |
|
|
} |
| 1848 |
|
|
|
| 1849 |
|
|
/* Normal Font */ |
| 1850 |
|
|
SetLogFont(); |
| 1851 |
|
|
VTFont[0] = CreateFontIndirect(&VTlf); |
| 1852 |
|
|
|
| 1853 |
|
|
/* set IME font */ |
| 1854 |
|
|
SetConversionLogFont(&VTlf); |
| 1855 |
|
|
|
| 1856 |
|
|
TmpDC = GetDC(HVTWin); |
| 1857 |
|
|
|
| 1858 |
|
|
SelectObject(TmpDC, VTFont[0]); |
| 1859 |
|
|
GetTextMetrics(TmpDC, &Metrics); |
| 1860 |
|
|
FontWidth = Metrics.tmAveCharWidth + ts.FontDW; |
| 1861 |
|
|
FontHeight = Metrics.tmHeight + ts.FontDH; |
| 1862 |
|
|
|
| 1863 |
|
|
ReleaseDC(HVTWin,TmpDC); |
| 1864 |
|
|
|
| 1865 |
|
|
/* Underline */ |
| 1866 |
|
|
VTlf.lfUnderline = 1; |
| 1867 |
|
|
VTFont[AttrUnder] = CreateFontIndirect(&VTlf); |
| 1868 |
|
|
|
| 1869 |
|
|
if (ts.EnableBold>0) |
| 1870 |
|
|
{ |
| 1871 |
|
|
/* Bold */ |
| 1872 |
|
|
VTlf.lfUnderline = 0; |
| 1873 |
|
|
VTlf.lfWeight = FW_BOLD; |
| 1874 |
|
|
VTFont[AttrBold] = CreateFontIndirect(&VTlf); |
| 1875 |
|
|
/* Bold + Underline */ |
| 1876 |
|
|
VTlf.lfUnderline = 1; |
| 1877 |
|
|
VTFont[AttrBold | AttrUnder] = CreateFontIndirect(&VTlf); |
| 1878 |
|
|
} |
| 1879 |
|
|
else { |
| 1880 |
|
|
VTFont[AttrBold] = VTFont[AttrDefault]; |
| 1881 |
|
|
VTFont[AttrBold | AttrUnder] = VTFont[AttrUnder]; |
| 1882 |
|
|
} |
| 1883 |
|
|
|
| 1884 |
|
|
/* Special font */ |
| 1885 |
|
|
VTlf.lfWeight = FW_NORMAL; |
| 1886 |
|
|
VTlf.lfUnderline = 0; |
| 1887 |
|
|
VTlf.lfWidth = FontWidth + 1; /* adjust width */ |
| 1888 |
|
|
VTlf.lfHeight = FontHeight; |
| 1889 |
|
|
VTlf.lfCharSet = SYMBOL_CHARSET; |
| 1890 |
|
|
|
| 1891 |
maya |
1.11 |
strncpy_s(VTlf.lfFaceName, sizeof(VTlf.lfFaceName),"Tera Special", _TRUNCATE); |
| 1892 |
yutakakn |
1.1 |
VTFont[AttrSpecial] = CreateFontIndirect(&VTlf); |
| 1893 |
|
|
VTFont[AttrSpecial | AttrBold] = VTFont[AttrSpecial]; |
| 1894 |
|
|
VTFont[AttrSpecial | AttrUnder] = VTFont[AttrSpecial]; |
| 1895 |
|
|
VTFont[AttrSpecial | AttrBold | AttrUnder] = VTFont[AttrSpecial]; |
| 1896 |
|
|
|
| 1897 |
|
|
SetLogFont(); |
| 1898 |
|
|
|
| 1899 |
|
|
for (i = 0 ; i <= 255; i++) |
| 1900 |
|
|
Dx[i] = FontWidth; |
| 1901 |
|
|
} |
| 1902 |
|
|
|
| 1903 |
|
|
void ResetIME() |
| 1904 |
|
|
{ |
| 1905 |
|
|
/* reset language for communication */ |
| 1906 |
|
|
cv.Language = ts.Language; |
| 1907 |
|
|
|
| 1908 |
|
|
/* reset IME */ |
| 1909 |
|
|
if (ts.Language==IdJapanese) |
| 1910 |
|
|
{ |
| 1911 |
|
|
if (ts.UseIME==0) |
| 1912 |
|
|
FreeIME(); |
| 1913 |
|
|
else if (! LoadIME()) |
| 1914 |
|
|
ts.UseIME = 0; |
| 1915 |
|
|
|
| 1916 |
|
|
if (ts.UseIME>0) |
| 1917 |
|
|
{ |
| 1918 |
|
|
if (ts.IMEInline>0) |
| 1919 |
|
|
SetConversionLogFont(&VTlf); |
| 1920 |
|
|
else |
| 1921 |
|
|
SetConversionWindow(HVTWin,-1,0); |
| 1922 |
|
|
} |
| 1923 |
|
|
} |
| 1924 |
|
|
else |
| 1925 |
|
|
FreeIME(); |
| 1926 |
|
|
|
| 1927 |
|
|
if (IsCaretOn()) CaretOn(); |
| 1928 |
|
|
} |
| 1929 |
|
|
|
| 1930 |
|
|
void ChangeCaret() |
| 1931 |
|
|
{ |
| 1932 |
|
|
UINT T; |
| 1933 |
|
|
|
| 1934 |
|
|
if (! Active) return; |
| 1935 |
|
|
if (CaretEnabled) |
| 1936 |
|
|
{ |
| 1937 |
|
|
DestroyCaret(); |
| 1938 |
|
|
switch (ts.CursorShape) { |
| 1939 |
|
|
case IdVCur: |
| 1940 |
|
|
CreateCaret(HVTWin, 0, CurWidth, FontHeight); |
| 1941 |
|
|
break; |
| 1942 |
|
|
case IdHCur: |
| 1943 |
|
|
CreateCaret(HVTWin, 0, FontWidth, CurWidth); |
| 1944 |
|
|
break; |
| 1945 |
|
|
} |
| 1946 |
|
|
CaretStatus = 1; |
| 1947 |
|
|
} |
| 1948 |
|
|
CaretOn(); |
| 1949 |
|
|
if (CaretEnabled && |
| 1950 |
|
|
(ts.NonblinkingCursor!=0)) |
| 1951 |
|
|
{ |
| 1952 |
|
|
T = GetCaretBlinkTime() * 2 / 3; |
| 1953 |
|
|
SetTimer(HVTWin,IdCaretTimer,T,NULL); |
| 1954 |
|
|
} |
| 1955 |
|
|
} |
| 1956 |
|
|
|
| 1957 |
yutakapon |
1.14 |
// WM_KILLFOCUS?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スJ?ス[?ス\?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス`?ス?ス |
| 1958 |
|
|
void CaretKillFocus(BOOL show) |
| 1959 |
|
|
{ |
| 1960 |
|
|
int CaretX, CaretY; |
| 1961 |
|
|
POINT p[5]; |
| 1962 |
|
|
HPEN oldpen; |
| 1963 |
|
|
HDC hdc; |
| 1964 |
|
|
|
| 1965 |
yutakapon |
1.17 |
if (ts.KillFocusCursor == 0) |
| 1966 |
|
|
return; |
| 1967 |
|
|
|
| 1968 |
yutakapon |
1.15 |
// Eterm lookfeel?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 1969 |
doda |
1.22 |
#ifdef ALPHABLEND_TYPE2 |
| 1970 |
yutakapon |
1.15 |
if (BGEnable) |
| 1971 |
|
|
return; |
| 1972 |
doda |
1.22 |
#endif // ALPHABLEND_TYPE2 |
| 1973 |
yutakapon |
1.15 |
|
| 1974 |
yutakapon |
1.14 |
/* Get Device Context */ |
| 1975 |
|
|
DispInitDC(); |
| 1976 |
|
|
hdc = VTDC; |
| 1977 |
|
|
|
| 1978 |
|
|
CaretX = (CursorX-WinOrgX)*FontWidth; |
| 1979 |
|
|
CaretY = (CursorY-WinOrgY)*FontHeight; |
| 1980 |
|
|
|
| 1981 |
|
|
p[0].x = CaretX; |
| 1982 |
|
|
p[0].y = CaretY; |
| 1983 |
|
|
p[1].x = CaretX; |
| 1984 |
|
|
p[1].y = CaretY + FontHeight - 1; |
| 1985 |
yutakapon |
1.18 |
if (CursorOnDBCS) |
| 1986 |
|
|
p[2].x = CaretX + FontWidth*2 - 1; |
| 1987 |
|
|
else |
| 1988 |
|
|
p[2].x = CaretX + FontWidth - 1; |
| 1989 |
yutakapon |
1.14 |
p[2].y = CaretY + FontHeight - 1; |
| 1990 |
yutakapon |
1.18 |
if (CursorOnDBCS) |
| 1991 |
|
|
p[3].x = CaretX + FontWidth*2 - 1; |
| 1992 |
|
|
else |
| 1993 |
|
|
p[3].x = CaretX + FontWidth - 1; |
| 1994 |
yutakapon |
1.14 |
p[3].y = CaretY; |
| 1995 |
|
|
p[4].x = CaretX; |
| 1996 |
|
|
p[4].y = CaretY; |
| 1997 |
|
|
|
| 1998 |
yutakapon |
1.18 |
if (show) { // ?ス|?ス?ス?スS?ス?ス?スJ?ス[?ス\?ス?ス?ス?ス?ス\?ス?ス?スi?ス?ス?スt?スH?ス[?スJ?スX?ス?ス?スj |
| 1999 |
yutakapon |
1.14 |
oldpen = SelectObject(hdc, CreatePen(PS_SOLID, 0, ts.VTColor[0])); |
| 2000 |
|
|
} else { |
| 2001 |
|
|
oldpen = SelectObject(hdc, CreatePen(PS_SOLID, 0, ts.VTColor[1])); |
| 2002 |
|
|
} |
| 2003 |
|
|
Polyline(VTDC, p, 5); |
| 2004 |
|
|
oldpen = SelectObject(hdc, oldpen); |
| 2005 |
|
|
DeleteObject(oldpen); |
| 2006 |
|
|
|
| 2007 |
|
|
/* release device context */ |
| 2008 |
|
|
DispReleaseDC(); |
| 2009 |
|
|
} |
| 2010 |
|
|
|
| 2011 |
yutakapon |
1.18 |
// ?ス|?ス?ス?スS?ス?ス?スJ?ス[?ス\?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スA?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス`?ス?ス?ス?ス?ス?ス?スB |
| 2012 |
|
|
// |
| 2013 |
|
|
// CaretOff()?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スBCaretOff()?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スA?ス?ス?ス?ス?ス?ス?スA?ス?ス?ス?ス?スo?ス?ス?ス?ス?ス?ス?ス?ス?スA |
| 2014 |
|
|
// stack overflow?ス?ス?ス?ス?ス?ス?スB |
| 2015 |
yutakapon |
1.19 |
void UpdateCaretKillFocus(BOOL enforce) |
| 2016 |
yutakapon |
1.18 |
{ |
| 2017 |
|
|
int CaretX, CaretY; |
| 2018 |
|
|
RECT rc; |
| 2019 |
|
|
|
| 2020 |
|
|
CaretX = (CursorX-WinOrgX)*FontWidth; |
| 2021 |
|
|
CaretY = (CursorY-WinOrgY)*FontHeight; |
| 2022 |
|
|
|
| 2023 |
|
|
if (ts.KillFocusCursor == 0) |
| 2024 |
|
|
return; |
| 2025 |
|
|
|
| 2026 |
|
|
// Eterm lookfeel?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 2027 |
doda |
1.22 |
#ifdef ALPHABLEND_TYPE2 |
| 2028 |
yutakapon |
1.18 |
if (BGEnable) |
| 2029 |
|
|
return; |
| 2030 |
doda |
1.22 |
#endif // ALPHABLEND_TYPE2 |
| 2031 |
yutakapon |
1.18 |
|
| 2032 |
yutakapon |
1.19 |
if (enforce == TRUE || !Active) { |
| 2033 |
yutakapon |
1.18 |
rc.left = CaretX; |
| 2034 |
|
|
rc.top = CaretY; |
| 2035 |
|
|
if (CursorOnDBCS) |
| 2036 |
maya |
1.20 |
rc.right = CaretX + FontWidth*2; |
| 2037 |
yutakapon |
1.18 |
else |
| 2038 |
maya |
1.20 |
rc.right = CaretX + FontWidth; |
| 2039 |
|
|
rc.bottom = CaretY + FontHeight; |
| 2040 |
|
|
// ?スw?ス?ス?ス?ス?ス?ス?ス?ス1?スs?スN?スZ?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス`?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス |
| 2041 |
|
|
// rc ?ス?ス right, bottom ?ス?ス1?スs?スN?スZ?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スB |
| 2042 |
yutakapon |
1.18 |
InvalidateRect(HVTWin, &rc, FALSE); |
| 2043 |
|
|
} |
| 2044 |
|
|
} |
| 2045 |
|
|
|
| 2046 |
yutakakn |
1.1 |
void CaretOn() |
| 2047 |
|
|
// Turn on the cursor |
| 2048 |
|
|
{ |
| 2049 |
|
|
int CaretX, CaretY, H; |
| 2050 |
|
|
|
| 2051 |
yutakapon |
1.17 |
if (ts.KillFocusCursor == 0 && !Active) |
| 2052 |
yutakapon |
1.14 |
return; |
| 2053 |
yutakakn |
1.1 |
|
| 2054 |
|
|
CaretX = (CursorX-WinOrgX)*FontWidth; |
| 2055 |
|
|
CaretY = (CursorY-WinOrgY)*FontHeight; |
| 2056 |
|
|
|
| 2057 |
|
|
if ((ts.Language==IdJapanese) && |
| 2058 |
yutakapon |
1.17 |
CanUseIME() && (ts.IMEInline>0)) |
| 2059 |
|
|
/* set IME conversion window pos. & font */ |
| 2060 |
|
|
SetConversionWindow(HVTWin,CaretX,CaretY); |
| 2061 |
yutakakn |
1.1 |
|
| 2062 |
|
|
if (! CaretEnabled) return; |
| 2063 |
|
|
|
| 2064 |
yutakapon |
1.17 |
if (Active) { |
| 2065 |
|
|
if (ts.CursorShape!=IdVCur) |
| 2066 |
|
|
{ |
| 2067 |
|
|
if (ts.CursorShape==IdHCur) |
| 2068 |
|
|
{ |
| 2069 |
|
|
CaretY = CaretY+FontHeight-CurWidth; |
| 2070 |
|
|
H = CurWidth; |
| 2071 |
|
|
} |
| 2072 |
|
|
else H = FontHeight; |
| 2073 |
|
|
|
| 2074 |
|
|
DestroyCaret(); |
| 2075 |
|
|
if (CursorOnDBCS) |
| 2076 |
|
|
CreateCaret(HVTWin, 0, FontWidth*2, H); /* double width caret */ |
| 2077 |
|
|
else |
| 2078 |
|
|
CreateCaret(HVTWin, 0, FontWidth, H); /* single width caret */ |
| 2079 |
|
|
CaretStatus = 1; |
| 2080 |
|
|
} |
| 2081 |
yutakakn |
1.1 |
|
| 2082 |
yutakapon |
1.17 |
SetCaretPos(CaretX,CaretY); |
| 2083 |
yutakakn |
1.1 |
} |
| 2084 |
|
|
|
| 2085 |
|
|
while (CaretStatus > 0) |
| 2086 |
|
|
{ |
| 2087 |
yutakapon |
1.17 |
if (! Active) { |
| 2088 |
|
|
CaretKillFocus(TRUE); |
| 2089 |
|
|
} else { |
| 2090 |
|
|
ShowCaret(HVTWin); |
| 2091 |
|
|
} |
| 2092 |
yutakakn |
1.1 |
CaretStatus--; |
| 2093 |
|
|
} |
| 2094 |
|
|
|
| 2095 |
|
|
} |
| 2096 |
|
|
|
| 2097 |
|
|
void CaretOff() |
| 2098 |
|
|
{ |
| 2099 |
yutakapon |
1.17 |
if (ts.KillFocusCursor == 0 && !Active) |
| 2100 |
|
|
return; |
| 2101 |
yutakapon |
1.14 |
|
| 2102 |
yutakakn |
1.1 |
if (CaretStatus == 0) |
| 2103 |
|
|
{ |
| 2104 |
yutakapon |
1.17 |
if (! Active) { |
| 2105 |
|
|
CaretKillFocus(FALSE); |
| 2106 |
|
|
} else { |
| 2107 |
|
|
HideCaret(HVTWin); |
| 2108 |
|
|
} |
| 2109 |
yutakakn |
1.1 |
CaretStatus++; |
| 2110 |
|
|
} |
| 2111 |
|
|
} |
| 2112 |
|
|
|
| 2113 |
|
|
void DispDestroyCaret() |
| 2114 |
|
|
{ |
| 2115 |
|
|
DestroyCaret(); |
| 2116 |
|
|
if (ts.NonblinkingCursor!=0) |
| 2117 |
|
|
KillTimer(HVTWin,IdCaretTimer); |
| 2118 |
|
|
} |
| 2119 |
|
|
|
| 2120 |
|
|
BOOL IsCaretOn() |
| 2121 |
|
|
// check if caret is on |
| 2122 |
|
|
{ |
| 2123 |
yutakapon |
1.16 |
// ?ス?ス?スA?スN?スe?スB?スu?スi?スt?スH?ス[?スJ?スX?ス?ス?ス?ス?スj?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スA?スJ?ス[?ス\?ス?ス?ス`?ス?ス?ス?ス?スs?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スA |
| 2124 |
|
|
// 2?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?ス?スB(2008.1.24 yutaka) |
| 2125 |
yutakapon |
1.17 |
if (ts.KillFocusCursor == 0) |
| 2126 |
|
|
return (( Active && (CaretStatus==0)) ); |
| 2127 |
|
|
else |
| 2128 |
|
|
return ((Active && (CaretStatus==0)) || (!Active && (CaretStatus==0))); |
| 2129 |
yutakakn |
1.1 |
} |
| 2130 |
|
|
|
| 2131 |
|
|
void DispEnableCaret(BOOL On) |
| 2132 |
|
|
{ |
| 2133 |
|
|
if (! On) CaretOff(); |
| 2134 |
|
|
CaretEnabled = On; |
| 2135 |
|
|
} |
| 2136 |
|
|
|
| 2137 |
|
|
BOOL IsCaretEnabled() |
| 2138 |
|
|
{ |
| 2139 |
|
|
return CaretEnabled; |
| 2140 |
|
|
} |
| 2141 |
|
|
|
| 2142 |
|
|
void DispSetCaretWidth(BOOL DW) |
| 2143 |
|
|
{ |
| 2144 |
|
|
/* TRUE if cursor is on a DBCS character */ |
| 2145 |
|
|
CursorOnDBCS = DW; |
| 2146 |
|
|
} |
| 2147 |
|
|
|
| 2148 |
|
|
void DispChangeWinSize(int Nx, int Ny) |
| 2149 |
|
|
{ |
| 2150 |
|
|
LONG W,H,dW,dH; |
| 2151 |
|
|
RECT R; |
| 2152 |
|
|
|
| 2153 |
|
|
if (SaveWinSize) |
| 2154 |
|
|
{ |
| 2155 |
|
|
WinWidthOld = WinWidth; |
| 2156 |
|
|
WinHeightOld = WinHeight; |
| 2157 |
|
|
SaveWinSize = FALSE; |
| 2158 |
|
|
} |
| 2159 |
|
|
else { |
| 2160 |
|
|
WinWidthOld = NumOfColumns; |
| 2161 |
|
|
WinHeightOld = NumOfLines; |
| 2162 |
|
|
} |
| 2163 |
|
|
|
| 2164 |
|
|
WinWidth = Nx; |
| 2165 |
|
|
WinHeight = Ny; |
| 2166 |
|
|
|
| 2167 |
|
|
ScreenWidth = WinWidth*FontWidth; |
| 2168 |
|
|
ScreenHeight = WinHeight*FontHeight; |
| 2169 |
|
|
|
| 2170 |
|
|
AdjustScrollBar(); |
| 2171 |
|
|
|
| 2172 |
|
|
GetWindowRect(HVTWin,&R); |
| 2173 |
|
|
W = R.right-R.left; |
| 2174 |
|
|
H = R.bottom-R.top; |
| 2175 |
|
|
GetClientRect(HVTWin,&R); |
| 2176 |
|
|
dW = ScreenWidth - R.right + R.left; |
| 2177 |
|
|
dH = ScreenHeight - R.bottom + R.top; |
| 2178 |
|
|
|
| 2179 |
|
|
if ((dW!=0) || (dH!=0)) |
| 2180 |
|
|
{ |
| 2181 |
yutakapon |
1.23 |
AdjustSize = TRUE; |
| 2182 |
|
|
SetWindowPos(HVTWin,HWND_TOP,0,0,W+dW,H+dH,SWP_NOMOVE); |
| 2183 |
yutakakn |
1.1 |
} |
| 2184 |
|
|
else |
| 2185 |
|
|
InvalidateRect(HVTWin,NULL,FALSE); |
| 2186 |
|
|
} |
| 2187 |
|
|
|
| 2188 |
|
|
void ResizeWindow(int x, int y, int w, int h, int cw, int ch) |
| 2189 |
|
|
{ |
| 2190 |
|
|
int dw,dh, NewX, NewY; |
| 2191 |
|
|
POINT Point; |
| 2192 |
|
|
|
| 2193 |
|
|
if (! AdjustSize) return; |
| 2194 |
|
|
dw = ScreenWidth - cw; |
| 2195 |
|
|
dh = ScreenHeight - ch; |
| 2196 |
doda |
1.10 |
if ((dw!=0) || (dh!=0)) { |
| 2197 |
yutakakn |
1.1 |
SetWindowPos(HVTWin,HWND_TOP,x,y,w+dw,h+dh,SWP_NOMOVE); |
| 2198 |
doda |
1.10 |
AdjustSize = FALSE; |
| 2199 |
|
|
} |
| 2200 |
yutakakn |
1.1 |
else { |
| 2201 |
|
|
AdjustSize = FALSE; |
| 2202 |
|
|
|
| 2203 |
|
|
NewX = x; |
| 2204 |
|
|
NewY = y; |
| 2205 |
yutakakn |
1.2 |
if (x+w > VirtualScreen.right) |
| 2206 |
yutakakn |
1.1 |
{ |
| 2207 |
yutakakn |
1.2 |
NewX = VirtualScreen.right-w; |
| 2208 |
yutakakn |
1.1 |
if (NewX < 0) NewX = 0; |
| 2209 |
|
|
} |
| 2210 |
yutakakn |
1.2 |
if (y+h > VirtualScreen.bottom) |
| 2211 |
yutakakn |
1.1 |
{ |
| 2212 |
yutakakn |
1.2 |
NewY = VirtualScreen.bottom-h; |
| 2213 |
yutakakn |
1.1 |
if (NewY < 0) NewY = 0; |
| 2214 |
|
|
} |
| 2215 |
|
|
if ((NewX!=x) || (NewY!=y)) |
| 2216 |
|
|
SetWindowPos(HVTWin,HWND_TOP,NewX,NewY,w,h,SWP_NOSIZE); |
| 2217 |
|
|
|
| 2218 |
|
|
Point.x = 0; |
| 2219 |
|
|
Point.y = ScreenHeight; |
| 2220 |
|
|
ClientToScreen(HVTWin,&Point); |
| 2221 |
yutakakn |
1.2 |
CompletelyVisible = (Point.y <= VirtualScreen.bottom); |
| 2222 |
yutakakn |
1.1 |
if (IsCaretOn()) CaretOn(); |
| 2223 |
|
|
} |
| 2224 |
|
|
} |
| 2225 |
|
|
|
| 2226 |
|
|
void PaintWindow(HDC PaintDC, RECT PaintRect, BOOL fBkGnd, |
| 2227 |
|
|
int* Xs, int* Ys, int* Xe, int* Ye) |
| 2228 |
|
|
// Paint window with background color & |
| 2229 |
|
|
// convert paint region from window coord. to screen coord. |
| 2230 |
|
|
// Called from WM_PAINT handler |
| 2231 |
|
|
// PaintRect: Paint region in window coordinate |
| 2232 |
|
|
// Return: |
| 2233 |
|
|
// *Xs, *Ys: upper left corner of the region |
| 2234 |
|
|
// in screen coord. |
| 2235 |
|
|
// *Xe, *Ye: lower right |
| 2236 |
|
|
{ |
| 2237 |
|
|
if (VTDC!=NULL) |
| 2238 |
|
|
DispReleaseDC(); |
| 2239 |
|
|
VTDC = PaintDC; |
| 2240 |
|
|
DCPrevFont = SelectObject(VTDC, VTFont[0]); |
| 2241 |
|
|
DispInitDC(); |
| 2242 |
yutakakn |
1.3 |
|
| 2243 |
|
|
#ifdef ALPHABLEND_TYPE2 |
| 2244 |
|
|
//<!--by AKASI |
| 2245 |
|
|
//if (fBkGnd) |
| 2246 |
|
|
if(!BGEnable && fBkGnd) |
| 2247 |
|
|
//--> |
| 2248 |
|
|
#else |
| 2249 |
yutakakn |
1.1 |
if (fBkGnd) |
| 2250 |
yutakakn |
1.3 |
#endif // ALPHABLEND_TYPE2 |
| 2251 |
|
|
|
| 2252 |
yutakakn |
1.1 |
FillRect(VTDC, &PaintRect,Background); |
| 2253 |
|
|
|
| 2254 |
|
|
*Xs = PaintRect.left / FontWidth + WinOrgX; |
| 2255 |
|
|
*Ys = PaintRect.top / FontHeight + WinOrgY; |
| 2256 |
|
|
*Xe = (PaintRect.right-1) / FontWidth + WinOrgX; |
| 2257 |
|
|
*Ye = (PaintRect.bottom-1) / FontHeight + WinOrgY; |
| 2258 |
|
|
} |
| 2259 |
|
|
|
| 2260 |
|
|
void DispEndPaint() |
| 2261 |
|
|
{ |
| 2262 |
|
|
if (VTDC==NULL) return; |
| 2263 |
|
|
SelectObject(VTDC,DCPrevFont); |
| 2264 |
|
|
VTDC = NULL; |
| 2265 |
|
|
} |
| 2266 |
|
|
|
| 2267 |
|
|
void DispClearWin() |
| 2268 |
|
|
{ |
| 2269 |
|
|
InvalidateRect(HVTWin,NULL,FALSE); |
| 2270 |
|
|
|
| 2271 |
|
|
ScrollCount = 0; |
| 2272 |
|
|
dScroll = 0; |
| 2273 |
|
|
if (WinHeight > NumOfLines) |
| 2274 |
|
|
DispChangeWinSize(NumOfColumns,NumOfLines); |
| 2275 |
|
|
else { |
| 2276 |
|
|
if ((NumOfLines==WinHeight) && (ts.EnableScrollBuff>0)) |
| 2277 |
|
|
{ |
| 2278 |
|
|
SetScrollRange(HVTWin,SB_VERT,0,1,FALSE); |
| 2279 |
|
|
} |
| 2280 |
|
|
else |
| 2281 |
|
|
SetScrollRange(HVTWin,SB_VERT,0,NumOfLines-WinHeight,FALSE); |
| 2282 |
|
|
|
| 2283 |
|
|
SetScrollPos(HVTWin,SB_HORZ,0,TRUE); |
| 2284 |
|
|
SetScrollPos(HVTWin,SB_VERT,0,TRUE); |
| 2285 |
|
|
} |
| 2286 |
|
|
if (IsCaretOn()) CaretOn(); |
| 2287 |
|
|
} |
| 2288 |
|
|
|
| 2289 |
|
|
void DispChangeBackground() |
| 2290 |
|
|
{ |
| 2291 |
|
|
DispReleaseDC(); |
| 2292 |
|
|
if (Background != NULL) DeleteObject(Background); |
| 2293 |
yutakakn |
1.3 |
#ifdef ALPHABLEND_TYPE2 |
| 2294 |
|
|
Background = CreateSolidBrush(BGVTColor[1]); |
| 2295 |
|
|
#else |
| 2296 |
yutakakn |
1.1 |
Background = CreateSolidBrush(ts.VTColor[1]); |
| 2297 |
yutakakn |
1.3 |
#endif // ALPHABLEND_TYPE2 |
| 2298 |
|
|
|
| 2299 |
yutakakn |
1.1 |
|
| 2300 |
|
|
InvalidateRect(HVTWin,NULL,TRUE); |
| 2301 |
|
|
} |
| 2302 |
|
|
|
| 2303 |
|
|
void DispChangeWin() |
| 2304 |
|
|
{ |
| 2305 |
|
|
/* Change window caption */ |
| 2306 |
|
|
ChangeTitle(); |
| 2307 |
|
|
|
| 2308 |
|
|
/* Menu bar / Popup menu */ |
| 2309 |
|
|
SwitchMenu(); |
| 2310 |
|
|
|
| 2311 |
|
|
SwitchTitleBar(); |
| 2312 |
|
|
|
| 2313 |
|
|
/* Change caret shape */ |
| 2314 |
|
|
ChangeCaret(); |
| 2315 |
|
|
|
| 2316 |
|
|
if ((ts.ColorFlag & CF_USETEXTCOLOR)==0) |
| 2317 |
|
|
{ |
| 2318 |
|
|
#ifndef NO_ANSI_COLOR_EXTENSION |
| 2319 |
|
|
ANSIColor[IdFore ] = ts.ANSIColor[IdFore ]; |
| 2320 |
|
|
ANSIColor[IdBack ] = ts.ANSIColor[IdBack ]; |
| 2321 |
|
|
#else /* NO_ANSI_COLOR_EXTENSION */ |
| 2322 |
|
|
ANSIColor[IdFore ] = RGB(255,255,255); |
| 2323 |
|
|
ANSIColor[IdBack ] = RGB( 0, 0, 0); |
| 2324 |
|
|
#endif /* NO_ANSI_COLOR_EXTENSION */ |
| 2325 |
|
|
} |
| 2326 |
|
|
else { // use text (background) color for "white (black)" |
| 2327 |
|
|
ANSIColor[IdFore ] = ts.VTColor[0]; |
| 2328 |
|
|
ANSIColor[IdBack ] = ts.VTColor[1]; |
| 2329 |
yutakakn |
1.3 |
|
| 2330 |
|
|
#ifdef ALPHABLEND_TYPE2 |
| 2331 |
|
|
ANSIColor[IdFore ] = BGVTColor[0]; |
| 2332 |
|
|
ANSIColor[IdBack ] = BGVTColor[1]; |
| 2333 |
|
|
#endif // ALPHABLEND_TYPE2 |
| 2334 |
|
|
|
| 2335 |
yutakakn |
1.1 |
} |
| 2336 |
|
|
|
| 2337 |
|
|
/* change background color */ |
| 2338 |
|
|
DispChangeBackground(); |
| 2339 |
|
|
} |
| 2340 |
|
|
|
| 2341 |
|
|
void DispInitDC() |
<
|