Example #1
0
void WinEDA_DrawPanel::m_Draw_Auxiliary_Axe(wxDC * DC, int drawmode)
/********************************************************************/
{
	if ( m_Parent->m_Auxiliary_Axe_Position.x == 0 &&
		 m_Parent->m_Auxiliary_Axe_Position.y == 0 )
		return;

int Color = DARKRED;
BASE_SCREEN * screen = GetScreen();

	GRSetDrawMode(DC, drawmode);

	/* Trace de l'axe vertical */
	GRDashedLine(&m_ClipBox, DC,
			m_Parent->m_Auxiliary_Axe_Position.x, -screen->ReturnPageSize().y,
			m_Parent->m_Auxiliary_Axe_Position.x, screen->ReturnPageSize().y,
			Color );

	/* Trace de l'axe horizontal */
	GRDashedLine(&m_ClipBox, DC,
			-screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axe_Position.y,
			screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axe_Position.y,
			Color );
}
Example #2
0
void WinEDA_DrawPanel::DrawBackGround(wxDC * DC)
/***********************************************/
/* Trace les axes X et Y et la grille
	La grille n'est affichee que si elle peut etre facilement visible
	La grille passe toujours par le centre de l'ecran
*/
{
int Color = BLUE;
BASE_SCREEN * screen = GetScreen();
int ii,jj ,xg , yg , color;
wxSize pas_grille_affichee;
bool drawgrid = FALSE;
int zoom = GetZoom();
wxSize size;
wxPoint org;
double pasx, pasy;

	color = screen->m_GridColor;
	GRSetDrawMode(DC, GR_COPY);

	/* le pas d'affichage doit etre assez grand pour avoir une grille visible */
	drawgrid = m_Parent->m_Draw_Grid;
	pas_grille_affichee = screen->GetGrid();

	ii = pas_grille_affichee.x / zoom;
	if (ii  < 5 ) { pas_grille_affichee.x *= 2 ; ii *= 2; }
	if( ii < 5 ) drawgrid = FALSE;	// grille trop petite
	ii = pas_grille_affichee.y / zoom;
	if (ii  < 5 ) { pas_grille_affichee.y *= 2 ; ii *= 2; }
	if( ii < 5 ) drawgrid = FALSE;	// grille trop petite

	GetViewStart(&org.x, &org.y);
	GetScrollPixelsPerUnit(&ii, &jj);
	org.x *= ii; org.y *= jj;
	screen->m_StartVisu = org;

	org.x *= zoom; org.y *= zoom;
	org.x += screen->m_DrawOrg.x; org.y += screen->m_DrawOrg.y;

	size = GetClientSize();
	size.x *= zoom; size.y *= zoom;
	pasx = screen->m_UserGrid.x * m_Parent->m_InternalUnits;
	pasy = screen->m_UserGrid.y * m_Parent->m_InternalUnits;
	if ( screen->m_UserGridUnit != INCHES )
	{
		pasx /= 25.4; pasy /= 25.4;
	}

	if( drawgrid)
	{
		m_Parent->PutOnGrid(&org) ;

		GRSetColorPen(DC, color );
		for ( ii = 0 ; ; ii++ )
		{
			xg = screen->m_UserGridIsON ? (int)( (ii * pasx) + 0.5)
				:ii * pas_grille_affichee.x;
			int xpos = org.x + xg;
			for ( jj = 0 ; ; jj++ )
			{
				yg = screen->m_UserGridIsON ? (int)( (jj * pasy) + 0.5)
					: jj * pas_grille_affichee.y;
				GRPutPixel(&m_ClipBox, DC, xpos, org.y + yg, color);
				if ( yg > size.y ) break;
			}
			if ( xg > size.x ) break;
		}
	}

	/* trace des axes principaux */
	if (  m_Parent->m_Draw_Axes )
	{
		/* Trace de l'axe vertical */
		GRDashedLine(&m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
				0, screen->ReturnPageSize().y, Color );

		/* Trace de l'axe horizontal */
		GRDashedLine(&m_ClipBox, DC, -screen->ReturnPageSize().x, 0,
				screen->ReturnPageSize().x, 0, Color );
	}

	/* trace des axes auxiliaires */
	if ( m_Parent->m_Draw_Auxiliary_Axe)
	{
		m_Draw_Auxiliary_Axe(DC, FALSE);
	}
}