Commit f1c3b0c8 authored by CHARRAS's avatar CHARRAS
Browse files

labels and texts display changed when rotated 180 degres

parent e9b3322f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -4,6 +4,12 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.

2008-Jan-20 UPDATE  Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema:
	labels and texts display changed when rotated 180 degres:
	horizontal text are now right justified insteed of 180 degree rotated, and are readable.

2008-Jan-20 UPDATE  Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
+35 −26
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@

/**************************************************************************/
DrawTextStruct::DrawTextStruct( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
    EDA_BaseStruct( aType ), 
    EDA_TextStruct( text )
    EDA_BaseStruct( aType )
    , EDA_TextStruct( text )
/**************************************************************************/
{
    m_Layer      = LAYER_NOTES;
@@ -45,9 +45,11 @@ DrawTextStruct* DrawTextStruct::GenCopy()
    case DRAW_TEXT_STRUCT_TYPE:
        newitem = new DrawTextStruct( m_Pos, m_Text );
        break;

    case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
        newitem = new DrawGlobalLabelStruct( m_Pos, m_Text );
        break;

    case DRAW_LABEL_STRUCT_TYPE:
        newitem = new DrawLabelStruct( m_Pos, m_Text );
        break;
@@ -133,6 +135,7 @@ DrawGlobalLabelStruct::DrawGlobalLabelStruct( const wxPoint& pos, const wxString
void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
                           int DrawMode, int Color )
/*******************************************************************************************/

/* Texts type Comment (text on layer "NOTE") have 4 directions, and the Text origin is the first letter
 */
{
@@ -147,33 +150,39 @@ void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& off

    switch( m_Orient )
    {
    case 0:         /* Orientation horiz normale */
    case 0: /* Horiz Normal Orientation (left justified) */
        DrawGraphicText( panel, DC,
                         wxPoint( m_Pos.x + offset.x, m_Pos.y - TXTMARGE + offset.y ),
                         color,
                         m_Text, m_Orient * 900, m_Size,
                         GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, width );
                         color, m_Text, TEXT_ORIENT_HORIZ, m_Size,
                         GR_TEXT_HJUSTIFY_LEFT,
                         GR_TEXT_VJUSTIFY_BOTTOM, width );
        break;

    case 1:         /* Orientation vert UP */
    case 1: /* Vert Orientation UP */
        DrawGraphicText( panel, DC,
                         wxPoint( m_Pos.x - TXTMARGE + offset.x, m_Pos.y + offset.y ), color,
                         m_Text, m_Orient * 900, m_Size,
                         GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, width );
                         wxPoint( m_Pos.x - TXTMARGE + offset.x,
                                  m_Pos.y + offset.y ),
                         color, m_Text, TEXT_ORIENT_VERT, m_Size,
                         GR_TEXT_HJUSTIFY_RIGHT,
                         GR_TEXT_VJUSTIFY_BOTTOM, width );
        break;

    case 2:         /* Orientation horiz inverse */
    case 2: /* Horiz Orientation - Right justified */
        DrawGraphicText( panel, DC,
                         wxPoint( m_Pos.x + offset.x, m_Pos.y + TXTMARGE + offset.y ), color,
                         m_Text, m_Orient * 900, m_Size,
                         GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP, width );
                         wxPoint( m_Pos.x + offset.x, m_Pos.y -
                                  TXTMARGE + offset.y ),
                         color, m_Text, TEXT_ORIENT_HORIZ, m_Size,
                         GR_TEXT_HJUSTIFY_RIGHT,
                         GR_TEXT_VJUSTIFY_BOTTOM, width );
        break;

    case 3:         /* Orientation vert BOTTOM */
    case 3: /*  Vert Orientation BOTTOM */
        DrawGraphicText( panel, DC,
                         wxPoint( m_Pos.x + TXTMARGE + offset.y, m_Pos.y + offset.y ), color,
                         m_Text, m_Orient * 900, m_Size,
                         GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, width );
                         wxPoint( m_Pos.x - TXTMARGE + offset.x,
                                  m_Pos.y + offset.y ),
                         color, m_Text, TEXT_ORIENT_VERT, m_Size,
                         GR_TEXT_HJUSTIFY_RIGHT,
                         GR_TEXT_VJUSTIFY_TOP, width );
        break;
    }

+7 −7
Original line number Diff line number Diff line
@@ -530,7 +530,7 @@ int HalfSize;
			pY = ((DrawTextStruct*)Struct)->m_Pos.y;
			offset = TXTMARGE;
			if ( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE)
				offset += Size.x;	// We must draw the Glabel graphoc symbol
				offset += Size.x;	// We must also draw the Glabel graphic symbol
			if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
				color = ReturnLayerColor(((DrawTextStruct*)Struct)->m_Layer);
			break;
@@ -566,26 +566,26 @@ int HalfSize;
						GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM);
			break;

		case 2:		/* Orientation horiz inverse */
		case 2:		/* Horiz Orientation - Right justified */
			if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE)
				PlotGraphicText(g_PlotFormat, wxPoint(pX + offset, pY),
						color, Text, TEXT_ORIENT_HORIZ, Size,
						GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
			else
				PlotGraphicText(g_PlotFormat, wxPoint(pX, pY + offset),
						color, Text, 1800, Size,
						GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP);
						color, Text, TEXT_ORIENT_HORIZ, Size,
						GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM);
			break;

		case 3:		/* Orientation vert BOTTOM */
			if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE)
				PlotGraphicText(g_PlotFormat, wxPoint(pX, pY - offset),
						color, Text, 2700, Size,
						color, Text, TEXT_ORIENT_VERT, Size,
						GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM);
			else
				PlotGraphicText(g_PlotFormat, wxPoint(pX + offset, pY),
						color, Text, 2700, Size,
						GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP);
						color, Text, TEXT_ORIENT_VERT, Size,
						GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP);
			break;
		}