Ejemplo n.º 1
0
//-----------------------------------------------------------------------------
// send a string to oled
//
// xPos: 0..16 (17 Spalten a 6 Pixel breit)
// yPos: 0.. 9 (10 Zeilen a 8 Pixel breit)
// Str:  max 17 Zeiche a 
//-----------------------------------------------------------------------------
void WriteString(BYTE xPos, BYTE yPos, char *Str) 
{
BYTE c;

  while ((*Str!=0) && (xPos<17)) 
  { 
    c = *Str;
    PaintChar(c,xPos++,yPos);
    Str++;
  }
}
Ejemplo n.º 2
0
/*****************************************************************************

Function: DDV_DrawSequence()

Purpose: draw a sequence within a ParaG 

Return value: -

*****************************************************************************/
static void DDV_DrawSequence(UnDViewerGraphDataPtr GrData,ParaGPtr pgp,
		DDV_ColorGlobal *pColorGlobal,SeqIdPtr sip,RectPtr rc_pgp,
		CharPtr szSeq,Int4 from,Int4 to,Uint1 ScaleStyle,
		Int2 leftDecal,Uint1 strand,Boolean bUseColors,ValNodePtr vnp_bsp,
		Int4 row,Boolean bSelect)
{
DDV_ColorCell *dclrp,*highlighClr;
Int4            dp;
Uint4           old_colour,new_colour,hlClr;
Int2            decal=1,i,x,y,pos=0;
Boolean         isAlpha,bSelected,bGoTo;
RecT            rcSel;
	
	if (!szSeq) return;	
	
	/*scale or not... to be or not to be ?*/
	if (ScaleStyle==SCALE_POS_TOP) decal++;
	
	/*compute the first letter's coordinate*/
	x=rc_pgp->left+leftDecal-GrData->udv_font.cxChar/2;
	y=rc_pgp->top+decal*GrData->udv_font.LineHeight;

	i=from;/*if from!=0, means we don't draw the entire ParaG*/
	to++;

	/*get the selection(s)*/
	
	if (pColorGlobal){/*use color*/
		old_colour=new_colour=GetColorRGB(0,0,0);
	    highlighClr =
    	    DDV_SearchColorCellbyName(pColorGlobal->pvnSpecialColors, "Highlight");
		if (highlighClr)
			hlClr = GetColorRGB (highlighClr->rgb[0], highlighClr->rgb[1],highlighClr->rgb[2]);
		else 
			hlClr = GetColorRGB (255,255,0);
		while(szSeq[i] && i<to){
			/*if a letter, get the color*/
			if (szSeq[i]!=' '){
				if (isalpha(szSeq[i])){
					isAlpha=TRUE;
					dp=DDV_GetBspCoordGivenDispCoord(pgp,pgp->StartLetter+i);
					bSelected=DDV_IsLetterSelected(vnp_bsp,dp);
					if (dp==(Int4)-1)
						dclrp=NULL;
					else
						dclrp=DDV_GetColor(pColorGlobal,NULL, row+1, dp);

					if(bUseColors){
						if (dclrp) 
							new_colour=GetColorRGB(dclrp->rgb[0],dclrp->rgb[1],dclrp->rgb[2]);
						else
							new_colour=GetColorRGB(0,0,0);
					}
				}
				else {
					bSelected=FALSE;
					isAlpha=FALSE;
					new_colour=GetColorRGB(0,0,0);
				}
				if (GrData->GotoLetter==pgp->StartLetter+i){
					bGoTo=TRUE;bSelected=TRUE;
				}
				else{
					bGoTo=FALSE;
				}
				if (bSelected){
					if (bGoTo==FALSE){
						if (bSelect) 
#ifdef WIN_MSWIN
                            Nlm_SetColorEx(hlClr);
#else
                            Nlm_SetColor(hlClr);
#endif
						else White();
					}
					else{
						Red();
					}
					rcSel.left=x-2;
					rcSel.top=y-GrData->udv_font.LineHeight;
					rcSel.bottom=y;
					rcSel.right=rcSel.left+GrData->udv_font.ColWidth;
					PaintRect(&rcSel);
					/*FrameRect(&rcSel);*/
				}
				if ((bUseColors && new_colour!=old_colour) || bSelected) {
#ifdef WIN_MSWIN
                    Nlm_SetColorEx(new_colour);
#else
                    Nlm_SetColor(new_colour);
#endif
					old_colour=new_colour;
				}
				MoveTo(x,y);
				if (isAlpha && dclrp)
					PaintChar((dclrp->LowerCase ? TO_LOWER(szSeq[i]) : szSeq[i]));
				else
					PaintChar(szSeq[i]);
			}
			i++;
			x+=GrData->udv_font.ColWidth;
		}