|
From: Jeffrey D. <ha...@us...> - 2003-09-26 22:58:06
|
Log Message:
-----------
enable antialiased text on all controls, add options for turning off AA on checkbox/edit
Modified Files:
--------------
/cvsroot/decaldev/source/DecalControls:
Checkbox.cpp
Checkbox.h
Choice.cpp
ChoicePopup.cpp
Edit.cpp
Edit.h
Revision Data
-------------
Index: Checkbox.cpp
===================================================================
RCS file: /cvsroot/decaldev/source/DecalControls/Checkbox.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Checkbox.cpp 24 Jul 2002 03:56:33 -0000 1.3
+++ Checkbox.cpp 26 Sep 2003 22:57:54 -0000 1.4
@@ -129,7 +129,8 @@
_variant_t vText = pElement->getAttribute( _T( "text" ) ),
vTextColor = pElement->getAttribute( _T( "textcolor" ) ),
vRightToLeft = pElement->getAttribute( _T( "righttoleft" ) ),
- vChecked = pElement->getAttribute( _T( "checked" ) );
+ vChecked = pElement->getAttribute( _T( "checked" ) ),
+ vAntialias = pElement->getAttribute( _T( "aa" ) );
// Text must exist
_ASSERTE( vText.vt == VT_BSTR );
@@ -174,7 +175,21 @@
}
}
- return S_OK;
+ m_bAA = true;
+ if( vAntialias.vt != VT_NULL )
+ {
+ try
+ {
+ m_bAA = static_cast< bool >( vAntialias );
+ }
+ catch( ... )
+ {
+ // Type conversion error
+ _ASSERTE( FALSE );
+ }
+ }
+
+ return S_OK;
}
#define CHECK_SIZE 13
@@ -236,7 +251,7 @@
pPlugin->GetIconCache( &szIcon, &pIcon );
pIcon->DrawIcon( &m_ptCheck, ( bChecked ) ? 0x0600128B : 0x0600128D, 0, pCanvas );
- m_pFont->DrawText( &m_ptText, m_strText, m_nTextColor, pCanvas );
+ m_pFont->DrawTextEx( &m_ptText, m_strText, m_nTextColor, 0, m_bAA ? eAA : 0, pCanvas );
return S_OK;
}
Index: Checkbox.h
===================================================================
RCS file: /cvsroot/decaldev/source/DecalControls/Checkbox.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Checkbox.h 29 Sep 2001 06:24:22 -0000 1.2
+++ Checkbox.h 26 Sep 2003 22:57:54 -0000 1.3
@@ -32,6 +32,7 @@
m_bRightToLeft;
long m_nTextColor;
+ bool m_bAA;
POINT m_ptText,
m_ptCheck;
Index: Choice.cpp
===================================================================
RCS file: /cvsroot/decaldev/source/DecalControls/Choice.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Choice.cpp 25 Jul 2003 00:12:42 -0000 1.4
+++ Choice.cpp 26 Sep 2003 22:57:54 -0000 1.5
@@ -131,7 +131,7 @@
{
// Draw the selected text
static POINT ptText = { 12, 2 };
- m_pFont->DrawText( &ptText, m_options[ m_nSelected ].m_strText, RGB( 0, 0, 0 ), pCanvas );
+ m_pFont->DrawTextEx( &ptText, m_options[ m_nSelected ].m_strText, 0, 0, eAA, pCanvas );
}
// Draw the up/down icon
Index: ChoicePopup.cpp
===================================================================
RCS file: /cvsroot/decaldev/source/DecalControls/ChoicePopup.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- ChoicePopup.cpp 18 Aug 2001 19:34:47 -0000 1.1.1.1
+++ ChoicePopup.cpp 26 Sep 2003 22:57:54 -0000 1.2
@@ -69,7 +69,7 @@
// Draw the text
POINT ptText = { 12, nRow * ROW_HEIGHT + 2 };
- m_pChoice->m_pFont->DrawText( &ptText, i->m_strText, RGB( 0, 0, 0 ), pCanvas );
+ m_pChoice->m_pFont->DrawTextEx( &ptText, i->m_strText, 0, 0, eAA, pCanvas );
}
return S_OK;
Index: Edit.cpp
===================================================================
RCS file: /cvsroot/decaldev/source/DecalControls/Edit.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Edit.cpp 23 Dec 2002 06:07:39 -0000 1.5
+++ Edit.cpp 26 Sep 2003 22:57:54 -0000 1.6
@@ -233,9 +233,9 @@
POINT ptText = { -m_nOffset, 0 };
if( m_strText.length() > 0 )
if (m_bPassword) {
- m_pFont->DrawText( &ptText, _bstr_t( m_strPass.c_str() ), m_nTextColor, pCanvas );
+ m_pFont->DrawTextEx( &ptText, _bstr_t( m_strPass.c_str() ), m_nTextColor, 0, m_bAA ? eAA : 0, pCanvas );
} else {
- m_pFont->DrawText( &ptText, _bstr_t( m_strText.c_str() ), m_nTextColor, pCanvas );
+ m_pFont->DrawTextEx( &ptText, _bstr_t( m_strText.c_str() ), m_nTextColor, 0, m_bAA ? eAA : 0, pCanvas );
}
if( m_bCapture && m_bDrawCaret )
@@ -757,7 +757,8 @@
vTextColor = pElement->getAttribute( _T( "textcolor" ) ),
vMarginX = pElement->getAttribute( _T( "marginx" ) ),
vMarginY = pElement->getAttribute( _T( "marginy" ) ),
- vPassword = pElement->getAttribute( _T( "password" ) );
+ vPassword = pElement->getAttribute( _T( "password" ) ),
+ vAntialias = pElement->getAttribute( _T( "aa" ) );
if( vText.vt != VT_NULL )
{
@@ -828,6 +829,20 @@
m_strPass.append("*");
}
+
+ m_bAA = true;
+ if( vAntialias.vt != VT_NULL )
+ {
+ try
+ {
+ m_bAA = static_cast< bool >( vAntialias );
+ }
+ catch( ... )
+ {
+ // Type conversion error
+ _ASSERTE( FALSE );
+ }
+ }
return S_OK;
}
Index: Edit.h
===================================================================
RCS file: /cvsroot/decaldev/source/DecalControls/Edit.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Edit.h 23 Dec 2002 06:07:39 -0000 1.5
+++ Edit.h 26 Sep 2003 22:57:54 -0000 1.6
@@ -36,11 +36,13 @@
bool m_bDrawCaret;
bool m_bPassword;
bool m_bSelecting;
+ bool m_bAA;
long m_nCaretChar, m_nCaret, m_nOffset,
m_nCaretHeight,
m_nSelStart, m_nSelStartChar,
m_nTextColor;
+
std::string m_strText;
std::string m_strPass;
|