From: Jeffrey D. <ha...@us...> - 2003-09-13 23:59:03
|
Log Message: ----------- GKusnick's changes - add right and center justified text, and 3d border in certain cases Modified Files: -------------- /cvsroot/decaldev/source/DecalControls: PushButton.cpp PushButton.h TextColumn.cpp TextColumn.h Revision Data ------------- Index: PushButton.cpp =================================================================== RCS file: /cvsroot/decaldev/source/DecalControls/PushButton.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- PushButton.cpp 24 Jul 2002 03:56:34 -0000 1.3 +++ PushButton.cpp 13 Sep 2003 23:59:01 -0000 1.4 @@ -10,7 +10,8 @@ : m_bPressed( VARIANT_FALSE ), m_bMouseIn( VARIANT_FALSE ), m_nFaceColor( RGB( 140, 80, 30 ) ), -m_nTextColor( RGB( 240, 240, 120 ) ) +m_nTextColor( RGB( 240, 240, 120 ) ), +m_UseFaceColor(false) // GKusnick: Render 3D outline. { } @@ -109,6 +110,7 @@ _ASSERTE( ( newVal & 0xFF000000L ) == 0 ); m_nFaceColor = newVal; + m_UseFaceColor = true; // GKusnick: Render 3D outline. m_pSite->Invalidate(); return S_OK; @@ -153,6 +155,7 @@ try { m_nFaceColor = static_cast< long >( vFaceColor ); + m_UseFaceColor = true; // GKusnick: Render 3D outline. } catch( ... ) { @@ -314,7 +317,8 @@ // Nerfgolem 2001.10.11 // Do not render the 3D outline if there's a background image. - if( m_pBackground.p == NULL ) + // GKusnick: Do render it if there's an explicit face color. + if( m_pBackground.p == NULL || m_UseFaceColor ) { // Last, draw the '3D' border - colors are generated relative to the face color // and the design is taken from the windows button Index: PushButton.h =================================================================== RCS file: /cvsroot/decaldev/source/DecalControls/PushButton.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- PushButton.h 29 Sep 2001 06:24:22 -0000 1.2 +++ PushButton.h 13 Sep 2003 23:59:01 -0000 1.3 @@ -35,6 +35,7 @@ long m_nFaceColor, m_nTextColor; + BOOL m_UseFaceColor; // GKusnick: Render 3D outline. void onCreate(); Index: TextColumn.cpp =================================================================== RCS file: /cvsroot/decaldev/source/DecalControls/TextColumn.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- TextColumn.cpp 24 Jul 2002 03:56:34 -0000 1.6 +++ TextColumn.cpp 13 Sep 2003 23:59:01 -0000 1.7 @@ -51,6 +51,34 @@ m_pSite->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, m_nFontSize, 0, &pFont ); POINT pt = { m_nTextX, m_nTextY }; + + // GKusnick: Apply justification. + switch (m_eJustify) + { + case eFontRight: + { + SIZE Size; + pFont->MeasureText(vText.bstrVal, &Size); + pt.x = m_nFixedWidth - m_nTextX - Size.cx; + } + break; + + case eFontCenter: + { + SIZE Size; + pFont->MeasureText(vText.bstrVal, &Size); + pt.x = (m_nFixedWidth - Size.cx)/2; + } + break; + + case eFontLeft: + default: + { + // No-Op + } + break; + } + pFont->DrawText( &pt, vText.bstrVal, nColor, pCanvas ); return S_OK; @@ -82,6 +110,7 @@ _variant_t vFontSize = pElement->getAttribute( _T( "fontsize" ) ); _variant_t vTextX = pElement->getAttribute( _T( "textx" ) ); _variant_t vTextY = pElement->getAttribute( _T( "texty" ) ); + _variant_t vJustify = pElement->getAttribute( _T( "justify" ) ); /// GKusnick: Justification option. if( vFixedWidth.vt != VT_NULL ) { @@ -156,6 +185,24 @@ } else m_nTextY = 2; + + // GKusnick: Set justification style from schema. + m_eJustify = eFontLeft; + if (vJustify.vt != VT_NULL) + { + if (::_wcsicmp(L"left", vJustify.bstrVal) == 0) + { + m_eJustify = eFontLeft; + } + else if (::_wcsicmp(L"right", vJustify.bstrVal) == 0) + { + m_eJustify = eFontRight; + } + else if (::_wcsicmp(L"center", vJustify.bstrVal) == 0) + { + m_eJustify = eFontCenter; + } + } return S_OK; } Index: TextColumn.h =================================================================== RCS file: /cvsroot/decaldev/source/DecalControls/TextColumn.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TextColumn.h 5 Oct 2001 10:03:56 -0000 1.3 +++ TextColumn.h 13 Sep 2003 23:59:01 -0000 1.4 @@ -26,6 +26,7 @@ long m_nFontSize; long m_nTextX; long m_nTextY; + eFontJustify m_eJustify; // GKusnick: Justification option. DECLARE_REGISTRY_RESOURCEID(IDR_TEXTCOLUMN) |