Fixed: incorrect refresh of screen area after closing a popup menu (texts and polygons sometimes not redrawn)
This commit is contained in:
parent
9edace2f5f
commit
bb5832c863
|
@ -25,15 +25,20 @@
|
|||
int NegableTextLength( const wxString& aText )
|
||||
{
|
||||
int char_count = aText.length();
|
||||
|
||||
/* Fix the character count, removing the ~ found */
|
||||
for (int i = char_count-1; i >= 0; i--) {
|
||||
if (aText[i] == '~') {
|
||||
for( int i = char_count - 1; i >= 0; i-- )
|
||||
{
|
||||
if( aText[i] == '~' )
|
||||
{
|
||||
char_count--;
|
||||
}
|
||||
}
|
||||
|
||||
return char_count;
|
||||
}
|
||||
|
||||
|
||||
/* Helper function for drawing character polygons */
|
||||
static void DrawGraphicTextPline(
|
||||
WinEDA_DrawPanel* aPanel,
|
||||
|
@ -53,7 +58,6 @@ static void DrawGraphicTextPline(
|
|||
coord[ik + 1].x, coord[ik + 1].y );
|
||||
}
|
||||
}
|
||||
|
||||
else if( sketch_mode )
|
||||
{
|
||||
for( int ik = 0; ik < (point_count - 1); ik++ )
|
||||
|
@ -65,11 +69,13 @@ static void DrawGraphicTextPline(
|
|||
aWidth, aColor, aColor );
|
||||
}
|
||||
|
||||
|
||||
static int overbar_position( int size_v, int thickness )
|
||||
{
|
||||
return size_v * 1.1 + thickness;
|
||||
}
|
||||
|
||||
|
||||
/** Function DrawGraphicText
|
||||
* Draw a graphic text (like module texts)
|
||||
* @param aPanel = the current DrawPanel. NULL if draw within a 3D GL Canvas
|
||||
|
@ -115,6 +121,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
|
|||
int ox, oy; // Draw coordinates for the current char
|
||||
int overbar_x, overbar_y; // Start point for the current overbar
|
||||
int overbars; // Number of ~ seen
|
||||
|
||||
#define BUF_SIZE 100
|
||||
wxPoint coord[BUF_SIZE + 1]; // Buffer coordinate used to draw polylines (one char shape)
|
||||
bool sketch_mode = false;
|
||||
|
@ -132,9 +139,12 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
|
|||
if( aSize.x < 0 ) // text is mirrored using size.x < 0 (mirror / Y axis)
|
||||
italic_reverse = true;
|
||||
|
||||
if (aNegable) {
|
||||
if( aNegable )
|
||||
{
|
||||
char_count = NegableTextLength( aText );
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
char_count = aText.Len();
|
||||
}
|
||||
if( char_count == 0 )
|
||||
|
@ -253,7 +263,8 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
|
|||
return;
|
||||
|
||||
if( aPanel && ABS( ( aPanel->GetScreen()->Scale( aSize.x ) ) ) < 3 ) /* shapes are too small: connot be drawn */
|
||||
{ /* insteed the text is drawn as a line */
|
||||
{
|
||||
/* insteed the text is drawn as a line */
|
||||
dx = (pitch * char_count) / 2;
|
||||
dy = size_v / 2; /* line is always centered */
|
||||
|
||||
|
@ -278,17 +289,22 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
|
|||
ptr = 0; /* ptr = text index */
|
||||
while( ptr < char_count )
|
||||
{
|
||||
if (aNegable) {
|
||||
if (aText[ptr+overbars] == '~') {
|
||||
if( aNegable )
|
||||
{
|
||||
if( aText[ptr + overbars] == '~' )
|
||||
{
|
||||
/* Found an overbar, adjust the pointers */
|
||||
overbars++;
|
||||
|
||||
if (overbars % 2) {
|
||||
if( overbars % 2 )
|
||||
{
|
||||
/* Starting the overbar */
|
||||
overbar_x = ox;
|
||||
overbar_y = oy - overbar_position( size_v, thickness );
|
||||
RotatePoint( &overbar_x, &overbar_y, cX, cY, aOrient );
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Ending the overbar */
|
||||
coord[0].x = overbar_x;
|
||||
coord[0].y = overbar_y;
|
||||
|
@ -358,6 +374,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
|
|||
|
||||
k2 = f_cod; /* trace sur axe H */
|
||||
k2 = (k2 * size_h) / 9;
|
||||
|
||||
// To simulate an italic font, add a x offset depending on the y offset
|
||||
if( aItalic )
|
||||
k2 -= italic_reverse ? -k1 / 8 : k1 / 8;
|
||||
|
@ -379,7 +396,9 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
|
|||
|
||||
ptr++; ox += pitch;
|
||||
}
|
||||
if (overbars % 2) {
|
||||
|
||||
if( overbars % 2 )
|
||||
{
|
||||
/* Close the last overbar */
|
||||
coord[0].x = overbar_x;
|
||||
coord[0].y = overbar_y;
|
||||
|
@ -395,7 +414,6 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* functions used to plot texts, using DrawGraphicText() with a call back function */
|
||||
static void (*MovePenFct)( wxPoint pos, int state ); // a pointer to actual plot function (HPGL, PS, ..)
|
||||
static bool s_Plotbegin; // Flag to init plot
|
||||
|
@ -405,8 +423,7 @@ static bool s_Plotbegin; // Flag to init plot
|
|||
* The call back function
|
||||
*/
|
||||
/**********************/
|
||||
static void
|
||||
s_Callback_plot(int x0,
|
||||
static void s_Callback_plot( int x0,
|
||||
int y0,
|
||||
int xf,
|
||||
int yf )
|
||||
|
@ -414,6 +431,7 @@ s_Callback_plot(int x0,
|
|||
{
|
||||
static wxPoint PenLastPos;
|
||||
wxPoint pstart;
|
||||
|
||||
pstart.x = x0;
|
||||
pstart.y = y0;
|
||||
wxPoint pend;
|
||||
|
@ -425,7 +443,6 @@ s_Callback_plot(int x0,
|
|||
MovePenFct( pend, 'D' );
|
||||
s_Plotbegin = false;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if( PenLastPos == pstart ) // this is a next segment in a polyline
|
||||
|
@ -504,4 +521,3 @@ void PlotGraphicText( int aFormat_plot,
|
|||
/* end text : pen UP ,no move */
|
||||
MovePenFct( wxPoint( 0, 0 ), 'Z' );
|
||||
}
|
||||
|
||||
|
|
|
@ -856,7 +856,7 @@ static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, wxPoint Points[] )
|
|||
xcliplo = ClipBox->GetX();
|
||||
ycliplo = ClipBox->GetY();
|
||||
xcliphi = ClipBox->GetRight();
|
||||
ycliphi = ClipBox->GetHeight();
|
||||
ycliphi = ClipBox->GetBottom();
|
||||
|
||||
if( Xmax < xcliplo )
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in New Issue