kicad/pcbnew/cursors.cpp

75 lines
2.1 KiB
C++
Raw Normal View History

2007-10-03 19:45:32 +00:00
/****************************************************************/
/* Routines generales d'affichage des curseurs et des marqueurs */
/****************************************************************/
2007-05-06 16:03:28 +00:00
2007-10-03 19:45:32 +00:00
/* fichier curseurs.cpp */
2007-05-06 16:03:28 +00:00
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
2007-05-06 16:03:28 +00:00
/* Routines Locales : */
2007-10-03 19:45:32 +00:00
/* Forme (bit_map) du marqueur */
static char Default_MarkerBitmap[] =
{
12, 12, /* Dimensions x et y du dessin de marqueurs*/
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, /* bitmap: 1 = color, 0 = notrace */
1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0,
1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,
1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0,
1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0
};
2007-05-06 16:03:28 +00:00
/**********************************************************************/
2007-10-03 19:45:32 +00:00
void MARQUEUR::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode )
2007-05-06 16:03:28 +00:00
/**********************************************************************/
2007-10-03 19:45:32 +00:00
2007-05-06 16:03:28 +00:00
/*
2007-10-03 19:45:32 +00:00
* Trace un repere sur l'ecran au point de coordonnees PCB pos
* Le marqueur est defini par un tableau de 2 + (lig*col) elements:
* 1er element: dim nbre ligne
* 2er element: dim nbre col
* suite: lig * col elements a 0 ou 1 : si 1 mise a color du pixel
*/
2007-05-06 16:03:28 +00:00
{
2007-10-03 19:45:32 +00:00
int px, py;
int ii, ii_max, jj, jj_max;
char* pt_bitmap = m_Bitmap;
2007-05-06 16:03:28 +00:00
2007-10-03 19:45:32 +00:00
if( pt_bitmap == NULL )
pt_bitmap = Default_MarkerBitmap;
2007-05-06 16:03:28 +00:00
2007-10-03 19:45:32 +00:00
GRSetDrawMode( DC, DrawMode );
2007-05-06 16:03:28 +00:00
2007-10-03 19:45:32 +00:00
px = GRMapX( m_Pos.x );
py = GRMapY( m_Pos.y );
2007-05-06 16:03:28 +00:00
2007-10-03 19:45:32 +00:00
/* Lecture des dimensions */
ii_max = *(pt_bitmap++);
jj_max = *(pt_bitmap++);
2007-05-06 16:03:28 +00:00
2007-10-03 19:45:32 +00:00
/* Trace du bitmap */
for( ii = 0; ii < ii_max; ii++ )
{
for( jj = 0; jj < jj_max; jj++, pt_bitmap++ )
{
if( *pt_bitmap )
GRSPutPixel( &panel->m_ClipBox, DC,
px + ii, py + jj, m_Color );
}
}
}