/******************************************************************************* Function : DDV_DrawSequenceName() Purpose : draw the name of the sequence (left column of the DDV panel) Parameters : GrData; graphical data (font size, etc) ScaleStyle;style of the ParaG scale top, left; coord to start the draw Return value : none *******************************************************************************/ static void DDV_DrawSequenceName(UnDViewerGraphDataPtr GrData,ParaGPtr pgp, Int2 top,Int2 left,Int4 cur_row,Int4 CurEditRow,Int4 CurMasterRow) { SeqIdPtr sip = NULL; RecT rc; Int2 x,y,decal=1,size;/*text position/size*/ Char szAccess[21]; BioseqPtr bsp; /*get a name*/ bsp = BioseqLockById(pgp->sip); if(bsp) { sip = SeqIdFindBestAccession(bsp->id); BioseqUnlock(bsp); } if (!sip) sip = SeqIdFindBest(pgp->sip, 0); SeqIdWrite(sip, szAccess,PRINTID_TEXTID_ACCESSION, 20); /*compute position*/ if (pgp->ScaleStyle==SCALE_POS_TOP) decal++; /*draw name*/ size=StringWidth(szAccess); x=left/*-GrData->udv_scale.cxLeftScale*/-size; y=top+decal*GrData->udv_font.LineHeight; MoveTo(x,y); if (cur_row==CurEditRow){ Magenta(); } PaintString (szAccess); if (cur_row==CurMasterRow){ Blue(); MoveTo(x,y); LineTo(x+size,y); } /*draw a little box (for selection a full sequence)*/ left+=GrData->udv_font.cxChar; top+=GrData->udv_font.cxChar/2; LoadRect(&rc,left,top,left+GrData->udv_font.cxChar, top+GrData->udv_font.cxChar); Blue(); PaintOval(&rc); Black(); }
void CSmartFieldListBoxItem::PaintItem(int nField, COwnerDrawListBox* pList, CDC* pDC, LPDRAWITEMSTRUCT pDrawItemStruct, const CRect& crBounds, COLORREF clForeground, COLORREF clBackground) { switch (nField) { case PROPERTY_NameField: { INHERITED::PaintItem(nField, pList, pDC, pDrawItemStruct, crBounds, clForeground, clBackground); break; } case PROPERTY_ValueField: { CString csField; PaintString(GetFieldText(nField, csField), pList, pDC, pDrawItemStruct, crBounds, clForeground, clBackground); if (IsMacroValid()) { CStdMacroServer* pMacroServer = MacroServer(); if (pMacroServer != NULL) { if (m_pMacro != NULL) { if (m_pMacro->MacroValueType() == CMacro::VALUE_TYPE_Field) { if ((m_pMacro->MacroType() == CMacro::MACRO_TYPE_Receiver) && (pMacroServer->ReceiverIsBound())) { PaintIndicator("R", pList, pDC, pDrawItemStruct, crBounds, GetSysColor(COLOR_WINDOWTEXT), GetSysColor(COLOR_WINDOW)); } if ((m_pMacro->MacroType() == CMacro::MACRO_TYPE_Sender) && (pMacroServer->SenderIsBound())) { PaintIndicator("S", pList, pDC, pDrawItemStruct, crBounds, GetSysColor(COLOR_WINDOWTEXT), GetSysColor(COLOR_WINDOW)); } } } } } break; } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CHudMenu::Paint() { if ( !m_bMenuDisplayed ) return; // center it int x = 20; Color menuColor = m_MenuColor; Color itemColor = m_ItemColor; int c = m_Processed.Count(); int border = 20; int wide = m_nMaxPixels + border; int tall = m_nHeight + border; int y = ( ScreenHeight() - tall ) * 0.5f; DrawBox( x - border/2, y - border/2, wide, tall, m_BoxColor, m_flSelectionAlphaOverride / 255.0f ); //DrawTexturedBox( x - border/2, y - border/2, wide, tall, m_BoxColor, m_flSelectionAlphaOverride / 255.0f ); menuColor[3] = menuColor[3] * ( m_flSelectionAlphaOverride / 255.0f ); itemColor[3] = itemColor[3] * ( m_flSelectionAlphaOverride / 255.0f ); for ( int i = 0; i < c; i++ ) { ProcessedLine *line = &m_Processed[ i ]; Assert( line ); Color clr = line->menuitem != 0 ? itemColor : menuColor; bool canblur = false; if ( line->menuitem != 0 && m_nSelectedItem >= 0 && ( line->menuitem == m_nSelectedItem ) ) { canblur = true; } vgui::surface()->DrawSetTextColor( clr ); int drawLen = line->length; if ( line->menuitem != 0 ) { drawLen *= m_flTextScan; } vgui::surface()->DrawSetTextFont( line->menuitem != 0 ? m_hItemFont : m_hTextFont ); PaintString( &g_szMenuString[ line->startchar ], drawLen, line->menuitem != 0 ? m_hItemFont : m_hTextFont, x, y ); if ( canblur ) { // draw the overbright blur for (float fl = m_flBlur; fl > 0.0f; fl -= 1.0f) { if (fl >= 1.0f) { PaintString( &g_szMenuString[ line->startchar ], drawLen, m_hItemFontPulsing, x, y ); } else { // draw a percentage of the last one Color col = clr; col[3] *= fl; vgui::surface()->DrawSetTextColor(col); PaintString( &g_szMenuString[ line->startchar ], drawLen, m_hItemFontPulsing, x, y ); } } } y += line->height; } }