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 ...@@ -4,6 +4,12 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. 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> 2008-Jan-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+pcbnew: +pcbnew:
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
/**************************************************************************/ /**************************************************************************/
DrawTextStruct::DrawTextStruct( const wxPoint& pos, const wxString& text, KICAD_T aType ) : DrawTextStruct::DrawTextStruct( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
EDA_BaseStruct( aType ), EDA_BaseStruct( aType )
EDA_TextStruct( text ) , EDA_TextStruct( text )
/**************************************************************************/ /**************************************************************************/
{ {
m_Layer = LAYER_NOTES; m_Layer = LAYER_NOTES;
...@@ -38,16 +38,18 @@ DrawTextStruct* DrawTextStruct::GenCopy() ...@@ -38,16 +38,18 @@ DrawTextStruct* DrawTextStruct::GenCopy()
/*********************************************/ /*********************************************/
{ {
DrawTextStruct* newitem; DrawTextStruct* newitem;
switch( Type() ) switch( Type() )
{ {
default: default:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
newitem = new DrawTextStruct( m_Pos, m_Text ); newitem = new DrawTextStruct( m_Pos, m_Text );
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
newitem = new DrawGlobalLabelStruct( m_Pos, m_Text ); newitem = new DrawGlobalLabelStruct( m_Pos, m_Text );
break; break;
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
newitem = new DrawLabelStruct( m_Pos, m_Text ); newitem = new DrawLabelStruct( m_Pos, m_Text );
break; break;
...@@ -93,13 +95,13 @@ void DrawTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) ...@@ -93,13 +95,13 @@ void DrawTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
{ {
/* restore old values and save new ones */ /* restore old values and save new ones */
SwapData( (DrawTextStruct*) g_ItemToUndoCopy ); SwapData( (DrawTextStruct*) g_ItemToUndoCopy );
/* save in undo list */ /* save in undo list */
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED ); ( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED );
/* restore new values */ /* restore new values */
SwapData( (DrawTextStruct*) g_ItemToUndoCopy ); SwapData( (DrawTextStruct*) g_ItemToUndoCopy );
delete g_ItemToUndoCopy; delete g_ItemToUndoCopy;
g_ItemToUndoCopy = NULL; g_ItemToUndoCopy = NULL;
} }
...@@ -131,8 +133,9 @@ DrawGlobalLabelStruct::DrawGlobalLabelStruct( const wxPoint& pos, const wxString ...@@ -131,8 +133,9 @@ DrawGlobalLabelStruct::DrawGlobalLabelStruct( const wxPoint& pos, const wxString
/*******************************************************************************************/ /*******************************************************************************************/
void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, 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 /* 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 ...@@ -147,33 +150,39 @@ void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& off
switch( m_Orient ) switch( m_Orient )
{ {
case 0: /* Orientation horiz normale */ case 0: /* Horiz Normal Orientation (left justified) */
DrawGraphicText( panel, DC, DrawGraphicText( panel, DC,
wxPoint( m_Pos.x + offset.x, m_Pos.y - TXTMARGE + offset.y ), wxPoint( m_Pos.x + offset.x, m_Pos.y - TXTMARGE + offset.y ),
color, color, m_Text, TEXT_ORIENT_HORIZ, m_Size,
m_Text, m_Orient * 900, m_Size, GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, width ); GR_TEXT_VJUSTIFY_BOTTOM, width );
break; break;
case 1: /* Orientation vert UP */ case 1: /* Vert Orientation UP */
DrawGraphicText( panel, DC, DrawGraphicText( panel, DC,
wxPoint( m_Pos.x - TXTMARGE + offset.x, m_Pos.y + offset.y ), color, wxPoint( m_Pos.x - TXTMARGE + offset.x,
m_Text, m_Orient * 900, m_Size, m_Pos.y + offset.y ),
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, width ); color, m_Text, TEXT_ORIENT_VERT, m_Size,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_BOTTOM, width );
break; break;
case 2: /* Orientation horiz inverse */ case 2: /* Horiz Orientation - Right justified */
DrawGraphicText( panel, DC, DrawGraphicText( panel, DC,
wxPoint( m_Pos.x + offset.x, m_Pos.y + TXTMARGE + offset.y ), color, wxPoint( m_Pos.x + offset.x, m_Pos.y -
m_Text, m_Orient * 900, m_Size, TXTMARGE + offset.y ),
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP, width ); color, m_Text, TEXT_ORIENT_HORIZ, m_Size,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_BOTTOM, width );
break; break;
case 3: /* Orientation vert BOTTOM */ case 3: /* Vert Orientation BOTTOM */
DrawGraphicText( panel, DC, DrawGraphicText( panel, DC,
wxPoint( m_Pos.x + TXTMARGE + offset.y, m_Pos.y + offset.y ), color, wxPoint( m_Pos.x - TXTMARGE + offset.x,
m_Text, m_Orient * 900, m_Size, m_Pos.y + offset.y ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, width ); color, m_Text, TEXT_ORIENT_VERT, m_Size,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_TOP, width );
break; break;
} }
...@@ -184,7 +193,7 @@ void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& off ...@@ -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, 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 ); DrawTextStruct::Draw( panel, DC, offset, DrawMode, Color );
...@@ -193,7 +202,7 @@ void DrawLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& of ...@@ -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, 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 /* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
......
...@@ -530,7 +530,7 @@ int HalfSize; ...@@ -530,7 +530,7 @@ int HalfSize;
pY = ((DrawTextStruct*)Struct)->m_Pos.y; pY = ((DrawTextStruct*)Struct)->m_Pos.y;
offset = TXTMARGE; offset = TXTMARGE;
if ( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE) 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 ) if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
color = ReturnLayerColor(((DrawTextStruct*)Struct)->m_Layer); color = ReturnLayerColor(((DrawTextStruct*)Struct)->m_Layer);
break; break;
...@@ -566,26 +566,26 @@ int HalfSize; ...@@ -566,26 +566,26 @@ int HalfSize;
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM); GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM);
break; break;
case 2: /* Orientation horiz inverse */ case 2: /* Horiz Orientation - Right justified */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE) if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE)
PlotGraphicText(g_PlotFormat, wxPoint(pX + offset, pY), PlotGraphicText(g_PlotFormat, wxPoint(pX + offset, pY),
color, Text, TEXT_ORIENT_HORIZ, Size, color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
else else
PlotGraphicText(g_PlotFormat, wxPoint(pX, pY + offset), PlotGraphicText(g_PlotFormat, wxPoint(pX, pY + offset),
color, Text, 1800, Size, color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP); GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM);
break; break;
case 3: /* Orientation vert BOTTOM */ case 3: /* Orientation vert BOTTOM */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE) if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE)
PlotGraphicText(g_PlotFormat, wxPoint(pX, pY - offset), 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); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM);
else else
PlotGraphicText(g_PlotFormat, wxPoint(pX + offset, pY), PlotGraphicText(g_PlotFormat, wxPoint(pX + offset, pY),
color, Text, 2700, Size, color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP); GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP);
break; 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