Develop and Download Open Source Software

Browse CVS Repository

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

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

revision 1.24 by yutakapon, Thu Jan 31 15:35:23 2008 UTC revision 1.25 by doda, Sun Feb 24 13:16:34 2008 UTC
# Line 43  static LOGFONT VTlf; Line 43  static LOGFONT VTlf;
43  static BOOL SaveWinSize = FALSE;  static BOOL SaveWinSize = FALSE;
44  static int WinWidthOld, WinHeightOld;  static int WinWidthOld, WinHeightOld;
45  static HBRUSH Background;  static HBRUSH Background;
46  static COLORREF ANSIColor[16];  static COLORREF ANSIColor[256];
47  static int Dx[256];  static int Dx[256];
48    
49  // caret variables  // caret variables
# Line 52  static BOOL CaretEnabled = TRUE; Line 52  static BOOL CaretEnabled = TRUE;
52    
53  // ---- device context and status flags  // ---- device context and status flags
54  static HDC VTDC = NULL; /* Device context for VT window */  static HDC VTDC = NULL; /* Device context for VT window */
55  static BYTE DCAttr, DCAttr2;  static TCharAttr DCAttr;
56  static BOOL DCReverse;  static BOOL DCReverse;
57  static HFONT DCPrevFont;  static HFONT DCPrevFont;
58    
59    TCharAttr DefCharAttr = {
60      AttrDefault,
61      AttrDefault,
62      AttrDefaultFG,
63      AttrDefaultBG
64    };
65    
66  // scrolling  // scrolling
67  static int ScrollCount = 0;  static int ScrollCount = 0;
68  static int dScroll = 0;  static int dScroll = 0;
# Line 1127  void BGDestruct(void) Line 1134  void BGDestruct(void)
1134  void BGInitialize(void)  void BGInitialize(void)
1135  {  {
1136    char path[MAX_PATH],config_file[MAX_PATH],tempPath[MAX_PATH];    char path[MAX_PATH],config_file[MAX_PATH],tempPath[MAX_PATH];
   int i;  
1137    
1138    // VTColor を読み込み    // VTColor を読み込み
1139    BGVTColor[0] = ts.VTColor[0];    BGVTColor[0] = ts.VTColor[0];
# Line 1152  void BGInitialize(void) Line 1158  void BGInitialize(void)
1158  #endif  #endif
1159    
1160    // ANSI color設定のほうを優先させる (2005.2.3 yutaka)    // ANSI color設定のほうを優先させる (2005.2.3 yutaka)
1161  #ifndef NO_ANSI_COLOR_EXTENSION    InitColorTable();
   for (i = IdBack ; i <= IdFore+8 ; i++)  
     ANSIColor[i] = ts.ANSIColor[i];  
   if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) // use background color for "Black"  
     ANSIColor[IdBack ]   = ts.VTColor[1];  
   if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) // use text color for "white"  
     ANSIColor[IdFore ]   = ts.VTColor[0];  
 #else /* NO_ANSI_COLOR_EXTENSION */  
   ANSIColor[IdBack ]     = RGB(  0,  0,  0);  
   ANSIColor[IdRed  ]     = RGB(255,  0,  0);  
   ANSIColor[IdGreen]     = RGB(  0,255,  0);  
   ANSIColor[IdYellow]    = RGB(255,255,  0);  
   ANSIColor[IdBlue]      = RGB(  0,  0,255);  
   ANSIColor[IdMagenta]   = RGB(255,  0,255);  
   ANSIColor[IdCyan]      = RGB(  0,255,255);  
   ANSIColor[IdFore ]     = RGB(255,255,255);  
   ANSIColor[IdBack+8]    = RGB(128,128,128);  
   ANSIColor[IdRed+8]     = RGB(128,  0,  0);  
   ANSIColor[IdGreen+8]   = RGB(  0,128,  0);  
   ANSIColor[IdYellow+8]  = RGB(128,128,  0);  
   ANSIColor[IdBlue+8]    = RGB(  0,  0,128);  
   ANSIColor[IdMagenta+8] = RGB(128,  0,128);  
   ANSIColor[IdCyan+8]    = RGB(  0,128,128);  
   ANSIColor[IdFore+8]    = RGB(192,192,192);  
 #endif  
1162    
1163    //リソース解放    //リソース解放
1164    BGDestruct();    BGDestruct();
# Line 1375  void BGOnSettingChange(void) Line 1357  void BGOnSettingChange(void)
1357  //-->  //-->
1358  #endif  // ALPHABLEND_TYPE2  #endif  // ALPHABLEND_TYPE2
1359    
1360  void InitDisp()  void DispApplyANSIColor() {
 {  
   HDC TmpDC;  
1361    int i;    int i;
   BOOL bMultiDisplaySupport = FALSE;  
1362    
   TmpDC = GetDC(NULL);  
   
 #ifndef NO_ANSI_COLOR_EXTENSION  
1363    for (i = IdBack ; i <= IdFore+8 ; i++)    for (i = IdBack ; i <= IdFore+8 ; i++)
1364      ANSIColor[i] = ts.ANSIColor[i];      ANSIColor[i] = ts.ANSIColor[i];
1365    if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) // use background color for "Black"  
1366      ANSIColor[IdBack ]   = ts.VTColor[1];    if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) {
1367    if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) // use text color for "white"  #ifdef ALPHABLEND_TYPE2
1368      ANSIColor[IdFore ]   = ts.VTColor[0];      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    
1377    void InitColorTable()
1378    {
1379    #ifndef NO_ANSI_COLOR_EXTENSION
1380      DispApplyANSIColor();
1381  #else /* NO_ANSI_COLOR_EXTENSION */  #else /* NO_ANSI_COLOR_EXTENSION */
1382    if ((ts.ColorFlag & CF_USETEXTCOLOR)==0)    ANSIColor[IdBack ]     = RGB(  0,  0,  0);
     ANSIColor[IdBack ]   = RGB(  0,  0,  0);  
   else // use background color for "Black"  
     ANSIColor[IdBack ]   = ts.VTColor[1];  
1383    ANSIColor[IdRed  ]     = RGB(255,  0,  0);    ANSIColor[IdRed  ]     = RGB(255,  0,  0);
1384    ANSIColor[IdGreen]     = RGB(  0,255,  0);    ANSIColor[IdGreen]     = RGB(  0,255,  0);
1385    ANSIColor[IdYellow]    = RGB(255,255,  0);    ANSIColor[IdYellow]    = RGB(255,255,  0);
1386    ANSIColor[IdBlue]      = RGB(  0,  0,255);    ANSIColor[IdBlue]      = RGB(  0,  0,255);
1387    ANSIColor[IdMagenta]   = RGB(255,  0,255);    ANSIColor[IdMagenta]   = RGB(255,  0,255);
1388    ANSIColor[IdCyan]      = RGB(  0,255,255);    ANSIColor[IdCyan]      = RGB(  0,255,255);
1389    if ((ts.ColorFlag & CF_USETEXTCOLOR)==0)    ANSIColor[IdFore ]     = RGB(255,255,255);
     ANSIColor[IdFore ]   = RGB(255,255,255);  
   else // use text color for "white"  
     ANSIColor[IdFore ]   = ts.VTColor[0];  
   
1390    ANSIColor[IdBack+8]    = RGB(128,128,128);    ANSIColor[IdBack+8]    = RGB(128,128,128);
1391    ANSIColor[IdRed+8]     = RGB(128,  0,  0);    ANSIColor[IdRed+8]     = RGB(128,  0,  0);
1392    ANSIColor[IdGreen+8]   = RGB(  0,128,  0);    ANSIColor[IdGreen+8]   = RGB(  0,128,  0);
# Line 1415  void InitDisp() Line 1396  void InitDisp()
1396    ANSIColor[IdCyan+8]    = RGB(  0,128,128);    ANSIColor[IdCyan+8]    = RGB(  0,128,128);
1397    ANSIColor[IdFore+8]    = RGB(192,192,192);    ANSIColor[IdFore+8]    = RGB(192,192,192);
1398  #endif /* NO_ANSI_COLOR_EXTENSION */  #endif /* NO_ANSI_COLOR_EXTENSION */
1399      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    
1677  #ifdef ALPHABLEND_TYPE2  #ifdef ALPHABLEND_TYPE2
1678    CRTWidth  = GetSystemMetrics(SM_CXSCREEN);    CRTWidth  = GetSystemMetrics(SM_CXSCREEN);
1679    CRTHeight = GetSystemMetrics(SM_CYSCREEN);    CRTHeight = GetSystemMetrics(SM_CYSCREEN);
1680    
1681    BGInitialize();    BGInitialize();
1682    #else
1683    if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0)    InitColorTable();
   {  
     ANSIColor[IdBack ]   = BGVTColor[1];  
     ANSIColor[IdFore ]   = BGVTColor[0];  
   }  
1684  #endif  // ALPHABLEND_TYPE2  #endif  // ALPHABLEND_TYPE2
1685    
1686    for (i = IdBack ; i <= IdFore+8 ; i++)    DispSetNearestColors(IdBack, 255, TmpDC);
     ANSIColor[i] = GetNearestColor(TmpDC, ANSIColor[i]);  
1687    
1688    /* background paintbrush */    /* background paintbrush */
1689    Background = CreateSolidBrush(ts.VTColor[1]);    Background = CreateSolidBrush(ts.VTColor[1]);
# Line 2087  void DispChangeWin() Line 2340  void DispChangeWin()
2340    
2341  void DispInitDC()  void DispInitDC()
2342  {  {
2343    
2344    if (VTDC==NULL)    if (VTDC==NULL)
2345    {    {
2346      VTDC = GetDC(HVTWin);      VTDC = GetDC(HVTWin);
# Line 2104  void DispInitDC() Line 2358  void DispInitDC()
2358  #endif  // ALPHABLEND_TYPE2  #endif  // ALPHABLEND_TYPE2
2359    
2360    SetBkMode(VTDC,OPAQUE);    SetBkMode(VTDC,OPAQUE);
2361    DCAttr = AttrDefault;    DCAttr = DefCharAttr;
   DCAttr2 = AttrDefault2;  
2362    DCReverse = FALSE;    DCReverse = FALSE;
2363    
2364  #ifdef ALPHABLEND_TYPE2  #ifdef ALPHABLEND_TYPE2
# Line 2123  void DispReleaseDC() Line 2376  void DispReleaseDC()
2376    VTDC = NULL;    VTDC = NULL;
2377  }  }
2378    
2379  void DispSetupDC(BYTE Attr, BYTE Attr2, BOOL Reverse)  void DispSetupDC(TCharAttr Attr, BOOL Reverse)
2380  // Setup device context  // Setup device context
2381  //   Attr, Attr2: character attribute 1 & 2  //   Attr: character attributes
2382  //   Reverse: true if text is selected (reversed) by mouse  //   Reverse: true if text is selected (reversed) by mouse
2383  {  {
2384    COLORREF TextColor, BackColor;    COLORREF TextColor, BackColor;
   int i, j;  
2385    
2386    if (VTDC==NULL)  DispInitDC();    if (VTDC==NULL)  DispInitDC();
2387    
2388    if ((DCAttr==Attr) && (DCAttr2==Attr2) &&    if (TCharAttrCmp(DCAttr, Attr) == 0 && DCReverse == Reverse) {
2389        (DCReverse==Reverse)) return;      return;
2390      }
2391    DCAttr = Attr;    DCAttr = Attr;
   DCAttr2 = Attr2;  
2392    DCReverse = Reverse;    DCReverse = Reverse;
2393            
2394    SelectObject(VTDC, VTFont[Attr & AttrFontMask]);    SelectObject(VTDC, VTFont[Attr.Attr & AttrFontMask]);
2395    
2396    if ((ts.ColorFlag & CF_FULLCOLOR) == 0)    if ((ts.ColorFlag & CF_FULLCOLOR) == 0) {
2397    {          if ((Attr.Attr & AttrBlink) != 0) {
2398          if ((Attr & AttrBlink) != 0)  #ifdef ALPHABLEND_TYPE2 // AKASI
         {  
   
 #ifdef ALPHABLEND_TYPE2  
 //<!--by AKASI  
 //  TextColor = ts.VTBlinkColor[0];  
 //  BackColor = ts.VTBlinkColor[1];  
2399            TextColor = BGVTBlinkColor[0];            TextColor = BGVTBlinkColor[0];
2400            BackColor = BGVTBlinkColor[1];            BackColor = BGVTBlinkColor[1];
 //-->  
2401  #else  #else
2402    TextColor = ts.VTBlinkColor[0];            TextColor = ts.VTBlinkColor[0];
2403    BackColor = ts.VTBlinkColor[1];            BackColor = ts.VTBlinkColor[1];
2404  #endif  #endif
2405          }          }
2406          else if ((Attr & AttrBold) != 0)          else if ((Attr.Attr & AttrBold) != 0) {
2407          {  #ifdef ALPHABLEND_TYPE2 // AKASI
 #ifdef ALPHABLEND_TYPE2  
 //<!--by AKASI  
 //  TextColor = ts.VTBoldColor[0];  
 //  BackColor = ts.VTBoldColor[1];  
2408            TextColor = BGVTBoldColor[0];            TextColor = BGVTBoldColor[0];
2409            BackColor = BGVTBoldColor[1];            BackColor = BGVTBoldColor[1];
 //-->  
2410  #else  #else
2411    TextColor = ts.VTBoldColor[0];            TextColor = ts.VTBoldColor[0];
2412    BackColor = ts.VTBoldColor[1];            BackColor = ts.VTBoldColor[1];
2413  #endif  #endif
2414          }          }
2415      /* begin - ishizaki */      /* begin - ishizaki */
2416          else if ((Attr & AttrURL) != 0)          else if ((Attr.Attr & AttrURL) != 0) {
2417          {  #ifdef ALPHABLEND_TYPE2 // AKASI
 #ifdef ALPHABLEND_TYPE2  
 //<!--by AKASI  
 //  TextColor = ts.VTBoldColor[0];  
 //  BackColor = ts.VTBoldColor[1];  
2418            TextColor = BGURLColor[0];            TextColor = BGURLColor[0];
2419            BackColor = BGURLColor[1];            BackColor = BGURLColor[1];
2420  //-->  //-->
2421  #else  #else
2422    TextColor = ts.URLColor[0];            TextColor = ts.URLColor[0];
2423    BackColor = ts.URLColor[1];            BackColor = ts.URLColor[1];
2424  #endif  #endif
2425          }          }
2426      /* end - ishizaki */      /* end - ishizaki */
2427          else {          else {
2428            if ((Attr2 & Attr2Fore) != 0)            if ((Attr.Attr2 & Attr2Fore) != 0) {
2429            {                  TextColor = ANSIColor[Attr.Fore];
                 j = Attr2 & Attr2ForeMask;  
                 TextColor = ANSIColor[j];  
2430            }            }
2431            else            else
2432  #ifdef ALPHABLEND_TYPE2  #ifdef ALPHABLEND_TYPE2 // AKASI
2433  //<!--by AKASI                  TextColor = BGVTColor[0];
 //  TextColor = ts.VTColor[0];  
     TextColor = BGVTColor[0];  
 //-->  
2434  #else  #else
2435    TextColor = ts.VTColor[0];                  TextColor = ts.VTColor[0];
2436  #endif  #endif
2437    
2438            if ((Attr2 & Attr2Back) != 0)            if ((Attr.Attr2 & Attr2Back) != 0) {
2439            {                  BackColor = ANSIColor[Attr.Back];
                 j = (Attr2 & Attr2BackMask) >> SftAttrBack;  
                 BackColor = ANSIColor[j];  
2440            }            }
2441            else            else
2442  #ifdef ALPHABLEND_TYPE2  #ifdef ALPHABLEND_TYPE2 // AKASI
2443  //<!--by AKASI                  BackColor = BGVTColor[1];
 //  BackColor = ts.VTColor[1];  
     BackColor = BGVTColor[1];  
 //-->  
2444  #else  #else
2445    BackColor = ts.VTColor[1];                  BackColor = ts.VTColor[1];
2446  #endif  #endif
2447          }          }
2448    }    }
2449    else { // full color    else { // full color
2450          if ((Attr2 & Attr2Fore) != 0)          if ((Attr.Attr2 & Attr2Fore) != 0) {
2451          {            if ((Attr.Fore<16) && ((Attr.Attr&AttrBold)!=0) == ((Attr.Fore&7)==0))
2452            if ((Attr & AttrBold) != 0)              TextColor = ANSIColor[Attr.Fore ^ 8];
                 i = 0;  
           else  
                 i = 8;  
           j = Attr2 & Attr2ForeMask;  
           if (j==0)  
                 j = 8 - i + j;  
2453            else            else
2454                  j = i + j;              TextColor = ANSIColor[Attr.Fore];
           TextColor = ANSIColor[j];  
2455          }          }
2456          else if ((Attr & AttrBlink) != 0)          else if ((Attr.Attr & AttrBlink) != 0)
2457  #ifdef ALPHABLEND_TYPE2  #ifdef ALPHABLEND_TYPE2 // AKASI
2458  //<!--by AKASI            TextColor = BGVTBlinkColor[0];
2459  //  TextColor = ts.VTBlinkColor[0];          else if ((Attr.Attr & AttrBold) != 0)
2460      TextColor = BGVTBlinkColor[0];            TextColor = BGVTBoldColor[0];
 //-->  
         else if ((Attr & AttrBold) != 0)  
 //<!--by AKASI  
 //  TextColor = ts.VTBoldColor[0];  
     TextColor = BGVTBoldColor[0];  
 //-->  
2461      /* begin - ishizaki */      /* begin - ishizaki */
2462          else if ((Attr & AttrURL) != 0)          else if ((Attr.Attr & AttrURL) != 0)
2463      TextColor = BGURLColor[0];            TextColor = BGURLColor[0];
2464      /* end - ishizaki */      /* end - ishizaki */
2465    else          else
2466  //<!--by AKASI            TextColor = BGVTColor[0];
 //  TextColor = ts.VTColor[0];  
     TextColor = BGVTColor[0];  
 //-->  
2467  #else  #else
2468    TextColor = ts.VTBlinkColor[0];            TextColor = ts.VTBlinkColor[0];
2469          else if ((Attr & AttrBold) != 0)          else if ((Attr.Attr & AttrBold) != 0)
2470    TextColor = ts.VTBoldColor[0];            TextColor = ts.VTBoldColor[0];
2471      /* begin - ishizaki */      /* begin - ishizaki */
2472          else if ((Attr & AttrURL) != 0)          else if ((Attr.Attr & AttrURL) != 0)
2473    TextColor = ts.URLColor[0];            TextColor = ts.URLColor[0];
2474      /* end - ishizaki */      /* end - ishizaki */
2475    else          else
2476    TextColor = ts.VTColor[0];            TextColor = ts.VTColor[0];
2477  #endif  #endif
2478    
2479          if ((Attr2 & Attr2Back) != 0)          if ((Attr.Attr2 & Attr2Back) != 0) {
2480          {            if ((Attr.Back<16) && ((Attr.Attr&AttrBlink)!=0) == ((Attr.Back&7)==0))
2481            if ((Attr & AttrBlink) != 0)              BackColor = ANSIColor[Attr.Back ^ 8];
                 i = 0;  
           else  
                 i = 8;  
           j = (Attr2 & Attr2BackMask) >> SftAttrBack;  
           if (j==0)  
                 j = 8 - i + j;  
2482            else            else
2483                  j = i + j;              BackColor = ANSIColor[Attr.Back];
           BackColor = ANSIColor[j];  
2484          }          }
2485          else if ((Attr & AttrBlink) != 0)          else if ((Attr.Attr & AttrBlink) != 0)
2486  #ifdef ALPHABLEND_TYPE2  #ifdef ALPHABLEND_TYPE2 // AKASI
2487  //<!--by AKASI            BackColor = BGVTBlinkColor[1];
2488  //  BackColor = ts.VTBlinkColor[1];          else if ((Attr.Attr & AttrBold) != 0)
2489      BackColor = BGVTBlinkColor[1];            BackColor = BGVTBoldColor[1];
 //-->  
         else if ((Attr & AttrBold) != 0)  
 //<!--by AKASI  
 //  BackColor = ts.VTBoldColor[1];  
     BackColor = BGVTBoldColor[1];  
 //-->  
2490      /* begin - ishizaki */      /* begin - ishizaki */
2491          else if ((Attr & AttrURL) != 0)          else if ((Attr.Attr & AttrURL) != 0)
2492      BackColor = BGURLColor[1];            BackColor = BGURLColor[1];
2493      /* end - ishizaki */      /* end - ishizaki */
2494    else          else
2495    BackColor = ts.VTColor[1]; // BGVTColor[1] dewa naika?            BackColor = ts.VTColor[1]; // BGVTColor[1] dewa naika?
2496  #else  #else
2497    BackColor = ts.VTBlinkColor[1];            BackColor = ts.VTBlinkColor[1];
2498          else if ((Attr & AttrBold) != 0)          else if ((Attr.Attr & AttrBold) != 0)
2499    BackColor = ts.VTBoldColor[1];            BackColor = ts.VTBoldColor[1];
2500      /* begin - ishizaki */      /* begin - ishizaki */
2501          else if ((Attr & AttrURL) != 0)          else if ((Attr.Attr & AttrURL) != 0)
2502    BackColor = ts.URLColor[1];            BackColor = ts.URLColor[1];
2503      /* end - ishizaki */      /* end - ishizaki */
2504    else          else
2505    BackColor = ts.VTColor[1];            BackColor = ts.VTColor[1];
2506  #endif  #endif
2507    }    }
2508  #ifdef USE_NORMAL_BGCOLOR_REJECT  #ifdef USE_NORMAL_BGCOLOR_REJECT
# Line 2318  void DispSetupDC(BYTE Attr, BYTE Attr2, Line 2515  void DispSetupDC(BYTE Attr, BYTE Attr2,
2515    }    }
2516  #endif  #endif
2517    
2518    if (Reverse != ((Attr & AttrReverse) != 0))    if (Reverse != ((Attr.Attr & AttrReverse) != 0))
2519    {    {
2520  #ifdef ALPHABLEND_TYPE2  #ifdef ALPHABLEND_TYPE2
2521  //<!--by AKASI  //<!--by AKASI
# Line 3016  void DispSetActive(BOOL ActiveFlag) Line 3213  void DispSetActive(BOOL ActiveFlag)
3213        SetConversionWindow(HVTWin,-1,0);        SetConversionWindow(HVTWin,-1,0);
3214    }    }
3215  }  }
3216    
3217    int TCharAttrCmp(TCharAttr a, TCharAttr b)
3218    {
3219      if (a.Attr == b.Attr &&
3220          a.Attr2 == b.Attr2 &&
3221          a.Fore == b.Fore &&
3222          a.Back == b.Back)
3223      {
3224        return 0;
3225      }
3226      else {
3227        return 1;
3228      }
3229    }
3230    
3231    void DispSetANSIColor(int num, COLORREF color)
3232    {
3233      if (num < 0 || num > 255)
3234            return;
3235    
3236      ANSIColor[num] = color;
3237      DispSetNearestColors(num, num, NULL);
3238      InvalidateRect(HVTWin,NULL,FALSE);
3239    //  ChangeWin();
3240    }
3241    
3242    COLORREF DispGetANSIColor(int num)
3243    {
3244      if (num < 0 || num > 255)
3245            return ANSIColor[0];
3246    
3247      return ANSIColor[num];
3248    }

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

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