Commit f1c3b0c8 authored by CHARRAS's avatar CHARRAS

labels and texts display changed when rotated 180 degres

parent e9b3322f
......@@ -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:
......
......@@ -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;
......@@ -38,16 +38,18 @@ DrawTextStruct* DrawTextStruct::GenCopy()
/*********************************************/
{
DrawTextStruct* newitem;
switch( Type() )
{
default:
case DRAW_TEXT_STRUCT_TYPE:
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;
......@@ -93,13 +95,13 @@ void DrawTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
{
/* restore old values and save new ones */
SwapData( (DrawTextStruct*) g_ItemToUndoCopy );
/* save in undo list */
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED );
/* restore new values */
SwapData( (DrawTextStruct*) g_ItemToUndoCopy );
delete g_ItemToUndoCopy;
g_ItemToUndoCopy = NULL;
}
......@@ -131,8 +133,9 @@ DrawGlobalLabelStruct::DrawGlobalLabelStruct( const wxPoint& pos, const wxString
/*******************************************************************************************/
void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color )
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;
}
......@@ -184,7 +193,7 @@ void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& off
/*********************************************************************************************/
void DrawLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color )
int DrawMode, int Color )
/*********************************************************************************************/
{
DrawTextStruct::Draw( panel, DC, offset, DrawMode, Color );
......@@ -193,7 +202,7 @@ void DrawLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& of
/*******************************************************************************************/
void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color )
int DrawMode, int Color )
/******************************************************************************************/
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment