Commit a04588db authored by charras's avatar charras

Changes in minimum pen size parameters used to draw or plot or print items.

Now uses only an unique default pen size for plot/print and draw items (see changelog)
parent bc77f8ac
......@@ -4,6 +4,21 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
email address.
2009-may-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++Eeschema:
Changes about thickness of lines in draw/plot functions.
Now there is only one thickness parameter for plot and print.
This is now the default thickness value,
used for items that have a line thickness = 0,
and NOT the minimum thickness.
reasons:
- Obviously, differents parameters to draw and plot and bad.
(what you plot is NOT what you see)
- small texts are not readable with an minimum thickness value
that could be good for others items.
2009-may-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++All:
......
......@@ -8,7 +8,7 @@
#include "appl_wxstruct.h"
#define BUILD_VERSION wxT("(20090525-unstable)")
#define BUILD_VERSION wxT("(20090602-unstable)")
wxString g_BuildVersion
......
......@@ -236,8 +236,10 @@ void WinEDA_DrawFrame::PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
gypas = ( yg - ref.y) / ipas;
for( ii = ref.y + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
{
msg.Empty();
msg.Append('A' + jj);
if( jj < 26 )
msg.Printf( wxT( "%c" ), jj + 'A' );
else // I hope 52 identifiers are enought...
msg.Printf( wxT( "%c" ), 'a' + jj - 26 );
if( ii < yg - PAS_REF / 2 )
{
pos.x = ref.x * conv_unit; pos.y = ii * conv_unit;
......
......@@ -260,6 +260,11 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
aWidth = -aWidth;
sketch_mode = true;
}
#ifdef CLIP_PEN // made by draw and plot functions
aWidth = Clamp_Text_PenSize( aWidth, aSize, aBold );
#endif
if( size_h < 0 ) // text is mirrored using size.x < 0 (mirror / Y axis)
italic_reverse = true;
......@@ -555,6 +560,13 @@ void PlotGraphicText( int aFormat_plot,
if( aWidth == 0 && aBold ) // Use default values if aWidth == 0
aWidth = GetPenSizeForBold( MIN( aSize.x, aSize.y ) );
#ifdef CLIP_PEN // made by draw and plot functions
if ( aWidth >= 0 )
aWidth = Clamp_Text_PenSize( aWidth, aSize, aBold );
else
aWidth = - Clamp_Text_PenSize( -aWidth, aSize, aBold );
#endif
// Initialise the actual function used to plot lines:
switch( aFormat_plot )
{
......
......@@ -1070,10 +1070,9 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w
gypas = ( yg - refy) / ipas;
for( ii = refy + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
{
Line.Empty();
if( jj < 26 )
Line.Printf( wxT( "%c" ), jj + 'A' );
else
else // I hope 52 identifiers are enought...
Line.Printf( wxT( "%c" ), 'a' + jj - 26 );
if( ii < yg - PAS_REF / 2 )
{
......
......@@ -305,7 +305,7 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxString Text;
int color;
wxPoint pos = m_Pos + aOffset;
int LineWidth = g_DrawMinimunLineWidth;
int LineWidth = g_DrawDefaultLineThickness;
if( aColor >= 0 )
color = aColor;
......
......@@ -69,7 +69,7 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
static std::vector <wxPoint> Poly;
int LineWidth = g_DrawMinimunLineWidth;
int LineWidth = g_DrawDefaultLineThickness;
if( Color >= 0 )
txtcolor = (EDA_Colors) Color;
......
......@@ -207,7 +207,9 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint text_pos;
int color = aColor;
int linewidth = MAX( m_Width, g_DrawMinimunLineWidth );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
if( aColor < 0 ) // Used normal color or selected color
{
......
......@@ -284,7 +284,7 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
{
int MapX1, MapY1, x1, y1;
int color;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
int posX = aPinPos.x, posY = aPinPos.y, len = m_PinLen;
BASE_SCREEN* screen = aPanel->GetScreen();
......@@ -460,7 +460,10 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
wxSize PinNameSize( m_PinNameSize, m_PinNameSize );
wxSize PinNumSize( m_PinNumSize, m_PinNumSize );
int LineWidth = g_DrawMinimunLineWidth;
int nameLineWidth = g_DrawDefaultLineThickness;
nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_PinNameSize, false );
int numLineWidth = g_DrawDefaultLineThickness;
numLineWidth = Clamp_Text_PenSize( numLineWidth, m_PinNumSize, false );
GRSetDrawMode( DC, DrawMode );
......@@ -508,7 +511,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER, LineWidth,
GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
false, false );
}
else // Orient == PIN_LEFT
......@@ -519,7 +522,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER, LineWidth,
GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
false, false );
}
}
......@@ -532,7 +535,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, LineWidth, false, false, false );
GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
false, false );
}
}
else /* Its a vertical line. */
......@@ -547,7 +551,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
m_PinName,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER, LineWidth,
GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
false, false );
if( DrawPinNum )
DrawGraphicText( panel, DC,
......@@ -556,7 +560,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, LineWidth, false, false, false );
GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
false, false);
}
else /* PIN_UP */
{
......@@ -567,7 +572,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
m_PinName,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER, LineWidth,
GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
false, false );
if( DrawPinNum )
DrawGraphicText( panel, DC,
......@@ -576,8 +581,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, LineWidth,
false, false, false);
GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
false, false);
}
}
}
......@@ -594,7 +599,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
NameColor, m_PinName,
TEXT_ORIENT_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, LineWidth,
GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth,
false, false );
}
if( DrawPinNum )
......@@ -605,8 +610,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP,
LineWidth, false, false, false );
GR_TEXT_VJUSTIFY_TOP, numLineWidth,
false, false);
}
}
else /* Its a vertical line. */
......@@ -619,7 +624,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
NameColor, m_PinName,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, LineWidth, false, false );
GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth,
false, false );
}
if( DrawPinNum )
......@@ -630,7 +636,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP, LineWidth, false, false, false );
GR_TEXT_VJUSTIFY_TOP, numLineWidth,
false, false );
}
}
}
......
......@@ -59,7 +59,10 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) m_Parent;
GRTextHorizJustifyType hjustify;
GRTextVertJustifyType vjustify;
int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth );
int LineWidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
// Clip pen size for small texts:
LineWidth = Clamp_Text_PenSize( LineWidth, m_Size, m_Bold );
if( ( m_Attributs & TEXT_NO_VISIBLE ) || IsVoid() )
return;
......@@ -236,7 +239,6 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
{
EDA_Rect BoundaryBox;
int hjustify, vjustify;
int textlen;
int orient;
int dx, dy, x1, y1, x2, y2;
......@@ -318,6 +320,10 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
BoundaryBox.SetWidth( dx );
BoundaryBox.SetHeight( dy );
// Take thickness in account:
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
BoundaryBox.Inflate( linewidth,linewidth );
return BoundaryBox;
}
......
......@@ -40,7 +40,6 @@ DrawBusEntryStruct::DrawBusEntryStruct( const wxPoint& pos, int shape, int id )
if( id == BUS_TO_BUS )
{
m_Layer = LAYER_BUS;
m_Width = 1;
}
if( shape == '/' )
......@@ -106,7 +105,7 @@ EDA_Rect DrawBusEntryStruct::GetBoundingBox()
EDA_Rect box( wxPoint( m_Pos.x, m_Pos.y ), wxSize( dx, dy ) );
box.Normalize();
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
box.Inflate( width / 2, width / 2 );
return box;
......@@ -117,7 +116,7 @@ void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int DrawMode, int Color )
{
int color;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( Color >= 0 )
color = Color;
......@@ -125,8 +124,11 @@ void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode );
if( m_Layer == LAYER_BUS )
width *= 3;
if( m_Layer == LAYER_BUS ) // TODO: find a better way to handle bus thickness
{
width = wxRound(width * 1.3);
width = MAX(width, 3);
}
GRLine( &panel->m_ClipBox, DC, m_Pos.x + offset.x, m_Pos.y + offset.y,
m_End().x + offset.x, m_End().y + offset.y, width, color );
......@@ -272,7 +274,7 @@ EDA_Rect DrawNoConnectStruct::GetBoundingBox()
*/
bool DrawNoConnectStruct::HitTest( const wxPoint& aPosRef )
{
int width = g_DrawMinimunLineWidth;
int width = g_DrawDefaultLineThickness;
int delta = ( DRAWNOCONNECT_SIZE + width) / 2;
wxPoint dist = aPosRef - m_Pos;
......@@ -306,7 +308,7 @@ void DrawNoConnectStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
{
const int DELTA = (DRAWNOCONNECT_SIZE / 2);
int pX, pY, color;
int width = g_DrawMinimunLineWidth;
int width = g_DrawDefaultLineThickness;
pX = m_Pos.x + offset.x; pY = m_Pos.y + offset.y;
......@@ -462,23 +464,21 @@ EDA_DrawLineStruct::EDA_DrawLineStruct( const wxPoint& pos, int layer ) :
{
m_Start = pos;
m_End = pos;
m_Width = 0; // Default thickness used
m_StartIsDangling = m_EndIsDangling = FALSE;
switch( layer )
{
default:
m_Layer = LAYER_NOTES; /* Mettre ds Notes */
m_Width = GR_NORM_WIDTH;
break;
case LAYER_WIRE:
m_Layer = LAYER_WIRE;
m_Width = GR_NORM_WIDTH;
break;
case LAYER_BUS:
m_Layer = LAYER_BUS;
m_Width = GR_THICK_WIDTH;
break;
}
}
......@@ -563,8 +563,6 @@ bool EDA_DrawLineStruct::Save( FILE* aFile ) const
layer = "Wire";
if( GetLayer() == LAYER_BUS )
layer = "Bus";
if( m_Width != GR_NORM_WIDTH )
layer = "Bus";
if( fprintf( aFile, "Wire %s %s\n", layer, width ) == EOF )
{
success = false;
......@@ -583,7 +581,7 @@ void EDA_DrawLineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int DrawMode, int Color )
{
int color;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( Color >= 0 )
color = Color;
......@@ -593,8 +591,11 @@ void EDA_DrawLineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
GRSetDrawMode( DC, DrawMode );
// FIXME: Not compatable with new zoom.
if( (m_Layer == LAYER_BUS) && panel->GetScreen()->Scale( width ) <= 1 )
width *= 3;
if( m_Layer == LAYER_BUS)
{
width = wxRound(width * 1.4);
width = MAX(width, 3);
}
if( m_Layer == LAYER_NOTES )
GRDashedLine( &panel->m_ClipBox, DC, m_Start.x + offset.x,
......@@ -620,7 +621,7 @@ void EDA_DrawLineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
DrawPolylineStruct::DrawPolylineStruct( int layer ) :
SCH_ITEM( NULL, DRAW_POLYLINE_STRUCT_TYPE )
{
m_Width = GR_NORM_WIDTH;
m_Width = 0;
switch( layer )
{
......@@ -630,12 +631,8 @@ DrawPolylineStruct::DrawPolylineStruct( int layer ) :
case LAYER_WIRE:
case LAYER_NOTES:
m_Layer = layer;
break;
case LAYER_BUS:
m_Layer = layer;
m_Width = GR_THICK_WIDTH;
break;
}
}
......@@ -671,8 +668,6 @@ bool DrawPolylineStruct::Save( FILE* aFile ) const
layer = "Wire";
if( GetLayer() == LAYER_BUS )
layer = "Bus";
if( m_Width != GR_NORM_WIDTH )
width = "Bus";
if( fprintf( aFile, "Poly %s %s %d\n",
width, layer, GetCornerCount() ) == EOF )
{
......@@ -696,7 +691,7 @@ void DrawPolylineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int DrawMode, int Color )
{
int color;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( Color >= 0 )
color = Color;
......
......@@ -195,7 +195,7 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset()
{
wxPoint text_offset;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int width = MAX( m_Width, g_DrawDefaultLineThickness );
int ii = m_Size.x + TXTMARGE + width;
......@@ -230,7 +230,9 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset()
wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset()
{
wxPoint text_offset;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
width = Clamp_Text_PenSize( width, m_Size, m_Bold );
int HalfSize = m_Size.x / 2;
int offset = width;
......@@ -473,7 +475,9 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset,
*/
{
EDA_Colors color;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
if( Color >= 0 )
color = (EDA_Colors) Color;
......@@ -483,9 +487,9 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset,
wxPoint text_offset = aOffset + GetSchematicTextOffset();
EXCHG( width, m_Width ); // Set the minimum width
EXCHG( linewidth, m_Width ); // Set the minimum width
EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
EXCHG( width, m_Width ); // set initial value
EXCHG( linewidth, m_Width ); // set initial value
if( m_IsDangling )
DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color );
}
......@@ -714,7 +718,8 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
{
static std::vector <wxPoint> Poly;
EDA_Colors color;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
if( Color >= 0 )
color = (EDA_Colors) Color;
......@@ -723,13 +728,13 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
GRSetDrawMode( DC, DrawMode );
EXCHG( width, m_Width ); // Set the minimum width
wxPoint text_offset = offset + GetSchematicTextOffset();
EXCHG( linewidth, m_Width ); // Set the minimum width
wxPoint text_offset = offset + GetSchematicTextOffset();
EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
EXCHG( width, m_Width ); // set initial value
EXCHG( linewidth, m_Width ); // set initial value
CreateGraphicShape( Poly, m_Pos + offset );
GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, width, color, color );
GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, linewidth, color, color );
if( m_IsDangling )
DrawDanglingSymbol( panel, DC, m_Pos + offset, color );
......@@ -773,7 +778,7 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
y = m_Pos.y;
dx = dy = 0;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
height = m_Size.y + width + 2 * TXTMARGE;
length = LenSize( m_Text )
+ height // add height for triangular shapes
......@@ -836,13 +841,14 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aO
GRSetDrawMode( DC, DrawMode );
int width = MAX( m_Width, g_DrawMinimunLineWidth );
EXCHG( width, m_Width ); // Set the minimum width
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
EXCHG( linewidth, m_Width ); // Set the minimum width
EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
EXCHG( width, m_Width ); // set initial value
EXCHG( linewidth, m_Width ); // set initial value
CreateGraphicShape( Poly, m_Pos + aOffset );
GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, width, color, color );
GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, linewidth, color, color );
if( m_IsDangling )
DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color );
......@@ -856,22 +862,24 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aO
*/
void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos )
{
int HalfSize = m_Size.y / 2;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int HalfSize = m_Size.y / 2;
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
aCorner_list.clear();
int symb_len = LenSize( m_Text ) + (TXTMARGE * 2);
// Create outline shape : 6 points
int x = symb_len + width + 3;
int y = wxRound( (double)HalfSize * 1.5 + (double)width + 3.0 ); // 50% more for negation bar
aCorner_list.push_back( wxPoint( 0, 0 ) ); // Starting point (anchor)
aCorner_list.push_back( wxPoint( 0, -y ) ); // Up
aCorner_list.push_back( wxPoint( -x, -y ) ); // left Up
aCorner_list.push_back( wxPoint( -x, 0 ) ); // left
aCorner_list.push_back( wxPoint( -x, y ) ); // left down
aCorner_list.push_back( wxPoint( 0, y ) ); // down
int x = symb_len + linewidth + 3;
int y = wxRound( (double) HalfSize * 1.5 + (double) linewidth + 3.0 ); // 50% more for negation bar
aCorner_list.push_back( wxPoint( 0, 0 ) ); // Starting point (anchor)
aCorner_list.push_back( wxPoint( 0, -y ) ); // Up
aCorner_list.push_back( wxPoint( -x, -y ) ); // left Up
aCorner_list.push_back( wxPoint( -x, 0 ) ); // left
aCorner_list.push_back( wxPoint( -x, y ) ); // left down
aCorner_list.push_back( wxPoint( 0, y ) ); // down
int x_offset = 0;
......@@ -941,10 +949,10 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
y = m_Pos.y;
dx = dy = 0;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
height = ( (m_Size.y * 15) / 10 ) + width + 2 * TXTMARGE;
length =
LenSize( m_Text ) // text X size
LenSize( m_Text ) // text X size
+ height // add height for triangular shapes (bidirectional)
+ DANGLING_SYMBOL_SIZE;
......@@ -993,7 +1001,7 @@ EDA_Rect SCH_TEXT::GetBoundingBox()
x = m_Pos.x;
y = m_Pos.y;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
length = LenSize( m_Text );
height = m_Size.y + width;
dx = dy = 0;
......
......@@ -197,7 +197,7 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1, pos2, posc;
int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = MAX( m_Width, g_DrawMinimunLineWidth );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( aColor < 0 ) // Used normal color or selected color
{
......@@ -398,7 +398,7 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1;
int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = MAX( m_Width, g_DrawMinimunLineWidth );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( aColor < 0 ) // Used normal color or selected color
{
......@@ -550,7 +550,9 @@ void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1, pos2;
int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = MAX( m_Width, g_DrawMinimunLineWidth );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
// Clip pen size for small texts:
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
if( aColor < 0 ) // Used normal color or selected color
{
......@@ -649,7 +651,7 @@ void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1, pos2;
int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = MAX( m_Width, g_DrawMinimunLineWidth );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( aColor < 0 ) // Used normal color or selected color
{
......@@ -744,7 +746,7 @@ void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1, pos2;
int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = MAX( m_Width, g_DrawMinimunLineWidth );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( aColor < 0 ) // Used normal color or selected color
{
......@@ -894,7 +896,7 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1;
int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = MAX( m_Width, g_DrawMinimunLineWidth );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
// Buffer used to store current corners coordinates for drawings
static wxPoint* Buf_Poly_Drawings = NULL;
......
......@@ -94,7 +94,7 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event )
AddUnitSymbol(* m_TextPenWidth, g_UnitMetric );
m_DialogPenWidth->SetValue(
ReturnStringFromValue(g_UnitMetric, g_PlotLine_Width, m_Parent->m_InternalUnits ) );
ReturnStringFromValue(g_UnitMetric, g_DrawDefaultLineThickness, m_Parent->m_InternalUnits ) );
m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref );
if (GetSizer())
{
......@@ -107,20 +107,20 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event )
void DIALOG_SVG_PRINT::SetPenWidth()
/********************************************/
{
g_PlotLine_Width = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
if( g_PlotLine_Width > WIDTH_MAX_VALUE )
if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE )
{
g_PlotLine_Width = WIDTH_MAX_VALUE;
g_DrawDefaultLineThickness = WIDTH_MAX_VALUE;
}
if( g_PlotLine_Width < WIDTH_MIN_VALUE )
if( g_DrawDefaultLineThickness < WIDTH_MIN_VALUE )
{
g_PlotLine_Width = WIDTH_MIN_VALUE;
g_DrawDefaultLineThickness = WIDTH_MIN_VALUE;
}
m_DialogPenWidth->SetValue(
ReturnStringFromValue(g_UnitMetric, g_PlotLine_Width, m_Parent->m_InternalUnits ) );
ReturnStringFromValue(g_UnitMetric, g_DrawDefaultLineThickness, m_Parent->m_InternalUnits ) );
}
......@@ -235,8 +235,8 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre
EDA_Rect tmp = panel->m_ClipBox;
GRResetPenAndBrush( &dc );
g_PlotLine_Width = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
SetPenMinWidth( g_PlotLine_Width );
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
SetPenMinWidth( g_DrawDefaultLineThickness );
GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : true );
......
......@@ -22,19 +22,19 @@ DIALOG_SVG_PRINT_base::DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id, c
wxStaticBoxSizer* sbOptionsSizer;
sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Print SVG options:") ), wxVERTICAL );
m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Pen width mini"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Default Pen Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextPenWidth->Wrap( -1 );
sbOptionsSizer->Add( m_TextPenWidth, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_DialogPenWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_DialogPenWidth->SetToolTip( _("Selection of the minimum pen thickness used to draw items.") );
m_DialogPenWidth->SetToolTip( _("Selection of the default pen thickness used to draw items, when their thickness is set to 0.") );
sbOptionsSizer->Add( m_DialogPenWidth, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxString m_ModeColorOptionChoices[] = { _("Color"), _("Black and White") };
int m_ModeColorOptionNChoices = sizeof( m_ModeColorOptionChoices ) / sizeof( wxString );
m_ModeColorOption = new wxRadioBox( this, wxID_ANY, _("Print mode"), wxDefaultPosition, wxDefaultSize, m_ModeColorOptionNChoices, m_ModeColorOptionChoices, 1, wxRA_SPECIFY_COLS );
m_ModeColorOption->SetSelection( 0 );
m_ModeColorOption->SetSelection( 1 );
m_ModeColorOption->SetToolTip( _("Choose if you wand to draw the sheet like it appears on screen,\nor in black and white mode, better to print it when using black and white printers") );
sbOptionsSizer->Add( m_ModeColorOption, 0, wxALL|wxEXPAND, 5 );
......
......@@ -108,7 +108,7 @@
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pen width mini</property>
<property name="label">Default Pen Size</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_TextPenWidth</property>
......@@ -168,7 +168,7 @@
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip">Selection of the minimum pen thickness used to draw items.</property>
<property name="tooltip">Selection of the default pen thickness used to draw items, when their thickness is set to 0.</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
......@@ -222,7 +222,7 @@
<property name="name">m_ModeColorOption</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">0</property>
<property name="selection">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
......
......@@ -308,7 +308,7 @@ void WinEDA_SetOptionsFrame::CreateControls()
m_DefaultDrawLineWidthCtrl = new WinEDA_ValueCtrl( this, _(
"Default Line Width" ),
g_DrawMinimunLineWidth,
g_DrawDefaultLineThickness,
g_UnitMetric, m_DrawOptionsSizer,
EESCHEMA_INTERNAL_UNIT );
......@@ -393,11 +393,11 @@ void WinEDA_SetOptionsFrame::Accept( wxCommandEvent& event )
wxRealPoint grid;
wxString msg;
g_DrawMinimunLineWidth = m_DefaultDrawLineWidthCtrl->GetValue();
if( g_DrawMinimunLineWidth < 0 )
g_DrawMinimunLineWidth = 0;
if( g_DrawMinimunLineWidth > 100 )
g_DrawMinimunLineWidth = 100;
g_DrawDefaultLineThickness = m_DefaultDrawLineWidthCtrl->GetValue();
if( g_DrawDefaultLineThickness < 0 )
g_DrawDefaultLineThickness = 0;
if( g_DrawDefaultLineThickness > 100 )
g_DrawDefaultLineThickness = 100;
g_DefaultTextLabelSize = m_DefaultLabelSizeCtrl->GetValue();
if( g_DefaultTextLabelSize < 0 )
......
......@@ -137,9 +137,9 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
m_Config->Read( PRINTMODECOLOR_KEY, &s_Print_Black_and_White );
}
AddUnitSymbol(* m_TextPenWidth, g_UnitMetric );
AddUnitSymbol(* m_TextPenWidth, g_DrawDefaultLineThickness );
m_DialogPenWidth->SetValue(
ReturnStringFromValue(g_UnitMetric, g_PlotLine_Width, m_Parent->m_InternalUnits ) );
ReturnStringFromValue(g_UnitMetric, g_DrawDefaultLineThickness, m_Parent->m_InternalUnits ) );
m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref );
m_ModeColorOption->SetSelection( s_Print_Black_and_White ? 1 : 0);
......@@ -177,20 +177,20 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
* NOTE: g_PlotLine_Width is in internal units
*/
{
g_PlotLine_Width = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
if( g_PlotLine_Width > WIDTH_MAX_VALUE )
if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE )
{
g_PlotLine_Width = WIDTH_MAX_VALUE;
g_DrawDefaultLineThickness = WIDTH_MAX_VALUE;
}
if( g_PlotLine_Width < WIDTH_MIN_VALUE )
if( g_DrawDefaultLineThickness < WIDTH_MIN_VALUE )
{
g_PlotLine_Width = WIDTH_MIN_VALUE;
g_DrawDefaultLineThickness = WIDTH_MIN_VALUE;
}
m_DialogPenWidth->SetValue(
ReturnStringFromValue(g_UnitMetric, g_PlotLine_Width, m_Parent->m_InternalUnits ) );
ReturnStringFromValue(g_UnitMetric, g_DrawDefaultLineThickness, m_Parent->m_InternalUnits ) );
}
......@@ -442,18 +442,8 @@ void EDA_Printout::DrawPage()
GRForceBlackPen( true );
/* set Pen min width */
double ftmp, xdcscale, ydcscale;
// g_PlotLine_Width is in internal units ( 1/1000 inch), and must be converted in pixels
ftmp = (float) g_PlotLine_Width * 25.4 / EESCHEMA_INTERNAL_UNIT; // ftmp est en mm
ftmp *= (float) PlotAreaSize.x / PageSize_in_mm.x; /* ftmp is in pixels */
/* because the pen size will be scaled by the dc scale, we modify the size
* in order to keep the requested value */
dc->GetUserScale( &xdcscale, &ydcscale );
ftmp /= xdcscale;
SetPenMinWidth( wxRound( ftmp ) );
/* set Pen min width (not used now) */
SetPenMinWidth( 1 );
WinEDA_DrawPanel* panel = m_Parent->DrawPanel;
BASE_SCREEN* screen = panel->GetScreen();
......
......@@ -22,12 +22,12 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
wxStaticBoxSizer* sbOptionsSizer;
sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL );
m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Pen Width Mini"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Default Pen Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextPenWidth->Wrap( -1 );
sbOptionsSizer->Add( m_TextPenWidth, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_DialogPenWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_DialogPenWidth->SetToolTip( _("Selection of the minimum pen thickness used to draw items.") );
m_DialogPenWidth->SetToolTip( _("Selection of the default pen thickness used to draw items, when their thickness is set to 0.") );
m_DialogPenWidth->SetMinSize( wxSize( 200,-1 ) );
sbOptionsSizer->Add( m_DialogPenWidth, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
......
......@@ -108,7 +108,7 @@
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pen Width Mini</property>
<property name="label">Default Pen Size</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_TextPenWidth</property>
......@@ -168,7 +168,7 @@
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip">Selection of the minimum pen thickness used to draw items.</property>
<property name="tooltip">Selection of the default pen thickness used to draw items, when their thickness is set to 0.</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
......
......@@ -298,8 +298,7 @@ void WinEDA_SchematicFrame::SaveProjectFile( wxWindow* displayframe )
}
static const wxString MinDrawLineWidthEntry( wxT( "MinimunDrawLineWidth" ) );
static const wxString PlotLineWidthEntry( wxT( "PlotLineWidth" ) );
static const wxString DefaultDrawLineWidthEntry( wxT( "DefaultDrawLineWidth" ) );
static const wxString ShowHiddenPinsEntry( wxT( "ShowHiddenPins" ) );
static const wxString HorzVertLinesOnlyEntry( wxT( "HorizVertLinesOnly" ) );
......@@ -424,8 +423,7 @@ void WinEDA_SchematicFrame::LoadSettings()
wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
g_DrawMinimunLineWidth = cfg->Read( MinDrawLineWidthEntry, (long) 0 );
g_PlotLine_Width = cfg->Read( PlotLineWidthEntry, (long) 4 );
g_DrawDefaultLineThickness = cfg->Read( DefaultDrawLineWidthEntry, (long) 6 );
cfg->Read( ShowHiddenPinsEntry, &m_ShowAllPins, false );
cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true );
}
......@@ -444,8 +442,7 @@ void WinEDA_SchematicFrame::SaveSettings()
wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
cfg->Write( MinDrawLineWidthEntry, (long) g_DrawMinimunLineWidth );
cfg->Write( PlotLineWidthEntry, (long) g_PlotLine_Width );
cfg->Write( DefaultDrawLineWidthEntry, (long) g_DrawDefaultLineThickness );
cfg->Write( ShowHiddenPinsEntry, m_ShowAllPins );
cfg->Write( HorzVertLinesOnlyEntry, g_HVLines );
}
......@@ -75,7 +75,7 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
RedrawStructList( DrawPanel, DC, GetScreen()->EEDrawList,
GR_DEFAULT_DRAWMODE );
TraceWorkSheet( DC, GetScreen(), g_DrawMinimunLineWidth );
TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness );
DrawPanel->CursorOn( DC ); // reaffichage curseur
if( DrawPanel->ManageCurseur )
......@@ -121,7 +121,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref,
RedrawStructList( this, DC, ActiveScreen->EEDrawList, GR_COPY );
if( Print_Sheet_Ref )
m_Parent->TraceWorkSheet( DC, ActiveScreen, g_DrawMinimunLineWidth );
m_Parent->TraceWorkSheet( DC, ActiveScreen, g_DrawDefaultLineThickness );
wxEndBusyCursor();
}
......@@ -188,7 +188,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_ITEM* DrawStruct, int dx, int dy )
{
int DrawMode = g_XorMode;
int width = g_DrawMinimunLineWidth;
int width = g_DrawDefaultLineThickness;
GRSetDrawMode( DC, DrawMode );
......
......@@ -67,8 +67,8 @@ bool g_FlDrawSpecificConvert = TRUE;
int g_PlotFormat; /* flag = TYPE_HPGL, TYPE_PS... */
int g_PlotMargin; /* Marge pour traces du cartouche */
float g_PlotScaleX;
float g_PlotScaleY; /* coeff d'echelle de trace en unites table tracante */
double g_PlotScaleX;
double g_PlotScaleY; /* coeff d'echelle de trace en unites table tracante */
HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
......@@ -88,12 +88,18 @@ wxString g_NetListerCommandLine; // ligne de commande pour l'appel au simulat
LayerStruct g_LayerDescr; /* couleurs des couches */
/* bool: TRUE si edition des pins pin a pin au lieu */
bool g_EditPinByPinIsOn = FALSE;
bool g_EditPinByPinIsOn = false; /* true to do not synchronize pins edition
* when they are at the same location */
int g_LibSymbolDefaultLineWidth = 0; /* default line width (in EESCHEMA units)
* used when creating a new graphic item in libedit.
* 0 = use default line thicknes
*/
int g_DrawDefaultLineThickness = 6; /* Default line (in EESCHEMA units) thickness
* used to draw/plot items having a default thickness line value (i.e. = 0 ).
* 0 = single pixel line width
*/
int g_LibSymbolDefaultLineWidth; /* default line width (in EESCHEMA units) used when creating a new graphic item in libedit : 0 = default */
int g_DrawMinimunLineWidth; /* Minimum line (in EESCHEMA units) thickness used to draw items on screen; 0 = single pixel line width */
int g_PlotLine_Width; /* Minimum line (in EESCHEMA units) thickness used to Plot/Print items */
// Color to draw selected items
int g_ItemSelectetColor = BROWN;
// Color to draw items flagged invisible, in libedit (they are insisible in eeschema
......
......@@ -97,19 +97,19 @@ typedef enum {
extern LibraryStruct* g_LibraryList; // All part libs are saved here.
extern int g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que
* les numeros (netlist PSPICE seulement) */
* les numeros (netlist PSPICE seulement) */
extern SCH_ITEM* g_ItemToRepeat; /* pointeur sur la derniere structure
* dessinee pouvant etre dupliquee par la commande
* Repeat ( NULL si aucune struct existe ) */
* dessinee pouvant etre dupliquee par la commande
* Repeat ( NULL si aucune struct existe ) */
extern wxSize g_RepeatStep;
extern int g_RepeatDeltaLabel;
extern SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item
* before it is modified (used for undo managing to restore old values ) */
* before it is modified (used for undo managing to restore old values ) */
extern bool g_LastSearchIsMarker; // True if last seach is a marker serach
// False for a schematic item search
// Used for hotkey next search
// False for a schematic item search
// Used for hotkey next search
/* Block operation (copy, paste) */
extern SCH_ITEM* g_BlockSaveDataList; // List of items to paste (Created by Block Save)
......@@ -117,7 +117,7 @@ extern SCH_ITEM* g_BlockSaveDataList; // List of items to paste (Created by Bloc
// Gestion d'options
extern bool g_HVLines;
extern int g_PlotPSColorOpt; // True = plot postcript color (see plotps.cpp)
extern int g_PlotPSColorOpt; // True = plot postcript color (see plotps.cpp)
// Gestion de diverses variables, options... devant etre memorisees mais
......@@ -140,11 +140,11 @@ extern int g_ViewUnit; /* part a afficher (A, B ..)
extern int g_DefaultTextLabelSize;
/* Variables globales pour LibEdit */
extern int g_LastTextSize;
extern int g_LastTextOrient;
extern int g_LastTextSize;
extern int g_LastTextOrient;
extern bool g_FlDrawSpecificUnit;
extern bool g_FlDrawSpecificConvert;
extern bool g_FlDrawSpecificUnit;
extern bool g_FlDrawSpecificConvert;
/********************************************************/
/* Description des structures des parametres principaux */
......@@ -152,9 +152,9 @@ extern bool g_FlDrawSpecificConvert;
/* Gestion des trace sur table tracante */
extern int g_PlotFormat; /* flag = TYPE_HPGL, TYPE_PS... */
extern int g_PlotMargin; /* Marge pour traces du cartouche */
extern float g_PlotScaleX, g_PlotScaleY; /* coeff d'echelle de trace en unites table tracante */
extern int g_PlotFormat; /* flag = TYPE_HPGL, TYPE_PS... */
extern int g_PlotMargin; /* Marge pour traces du cartouche */
extern double g_PlotScaleX, g_PlotScaleY; /* coeff d'echelle de trace en unites table tracante */
/* For HPGL plotting: Pen caract : */
......@@ -166,9 +166,7 @@ struct HPGL_Pen_Descr_Struct
};
extern HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
/* Ecrans usuels */
//extern SCH_SCREEN * ScreenSch;
/* First and main (root) screen */
extern DrawSheetStruct* g_RootSheet;
extern SCH_SCREEN* g_ScreenLib;
......@@ -177,31 +175,37 @@ extern SCH_SCREEN* g_ScreenLib;
/*************************************/
/* valeur de flag indicant si le pointeur de reference pour une localisation
* est le curseur sur grille ou le curseur a deplacement fin hors grille */
* est le curseur sur grille ou le curseur a deplacement fin hors grille */
#define CURSEUR_ON_GRILLE 0
#define CURSEUR_OFF_GRILLE 1
/* Gestion des librairies schematiques */
extern wxString g_NetCmpExtBuffer;
extern wxString g_SymbolExtBuffer;
extern wxString g_NetCmpExtBuffer;
extern wxString g_SymbolExtBuffer;
extern const wxString CompLibFileExtension;
extern const wxString CompLibFileWildcard;
extern wxString g_SimulatorCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
extern wxString g_NetListerCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
extern wxString g_SimulatorCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
extern wxString g_NetListerCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
extern LayerStruct g_LayerDescr; /* couleurs des couches */
extern LayerStruct g_LayerDescr; /* couleurs des couches */
/* bool: TRUE si edition des pins pin a pin au lieu */
extern bool g_EditPinByPinIsOn;
extern bool g_EditPinByPinIsOn; /* true to do not synchronize pins edition
* when they are at the same location */
extern int g_LibSymbolDefaultLineWidth; /* default line width (in EESCHEMA units) used when creating a new graphic item in libedit : 0 = default */
extern int g_DrawMinimunLineWidth; /* Minimum line (in EESCHEMA units) thickness used to draw items on screen; 0 = single pixel line width */
extern int g_PlotLine_Width; /* Minimum line (in EESCHEMA units) thickness used to Plot/Print items */
extern int g_LibSymbolDefaultLineWidth; /* default line width (in EESCHEMA units)
* used when creating a new graphic item in libedit.
* 0 = use default line thicknes
*/
extern int g_DrawDefaultLineThickness; /* Default line (in EESCHEMA units) thickness
* used to draw/plot items having a default thickness line value (i.e. = 0 ).
* 0 = single pixel line width
*/
// Color to draw selected items
extern int g_ItemSelectetColor;
// Color to draw items flagged invisible, in libedit (they are insisible in eeschema
extern int g_InvisibleItemColor;
......
......@@ -192,7 +192,8 @@ void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field )
color = DARKGRAY;
Field->m_Pos.x = GetScreen()->m_Curseur.x;
Field->m_Pos.y = -GetScreen()->m_Curseur.y;
int LineWidth = MAX( Field->m_Width, g_DrawMinimunLineWidth );
int linewidth = (Field->m_Width == 0) ? g_DrawDefaultLineThickness : Field->m_Width;
linewidth = Clamp_Text_PenSize( linewidth, Field->m_Size, Field->m_Bold );
DrawPanel->CursorOff( DC );
GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE );
......@@ -200,8 +201,8 @@ void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field )
color, ReturnFieldFullText( Field ),
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth,
Field->m_Italic, Field->m_Bold, false);
Field->m_HJustify, Field->m_VJustify, linewidth,
Field->m_Italic, Field->m_Bold);
DrawPanel->CursorOn( DC );
......@@ -219,7 +220,8 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
wxString Text;
wxString title;
EDA_Colors color;
int LineWidth = MAX( Field->m_Width, g_DrawMinimunLineWidth );
int linewidth = (Field->m_Width == 0) ? g_DrawDefaultLineThickness : Field->m_Width;
linewidth = Clamp_Text_PenSize( linewidth, Field->m_Size, Field->m_Bold );
if( Field == NULL )
return;
......@@ -273,8 +275,8 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
color, ReturnFieldFullText( Field ),
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth,
Field->m_Italic, Field->m_Bold, false);
Field->m_HJustify, Field->m_VJustify, linewidth,
Field->m_Italic, Field->m_Bold);
if( !Text.IsEmpty() )
{
......@@ -291,8 +293,8 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
color, ReturnFieldFullText( Field ),
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth,
Field->m_Italic, Field->m_Bold, false);
Field->m_HJustify, Field->m_VJustify, linewidth,
Field->m_Italic, Field->m_Bold);
GetScreen()->SetModify();
......@@ -338,13 +340,14 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field )
DrawPanel->CursorOff( DC );
GRSetDrawMode( DC, g_XorMode );
int LineWidth = MAX( Field->m_Width, g_DrawMinimunLineWidth );
int linewidth = (Field->m_Width == 0) ? g_DrawDefaultLineThickness : Field->m_Width;
linewidth = Clamp_Text_PenSize( linewidth, Field->m_Size, Field->m_Bold );
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
color, ReturnFieldFullText( Field ),
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth,
Field->m_Italic, Field->m_Bold, false);
Field->m_HJustify, Field->m_VJustify, linewidth,
Field->m_Italic, Field->m_Bold);
if( Field->m_Orient )
Field->m_Orient = 0;
......@@ -358,8 +361,8 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field )
color, ReturnFieldFullText( Field ),
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth,
Field->m_Italic, Field->m_Bold, false);
Field->m_HJustify, Field->m_VJustify, linewidth,
Field->m_Italic, Field->m_Bold);
DrawPanel->CursorOn( DC );
}
......
......@@ -272,9 +272,9 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
t1 = (TransMat[0][0] != 0) ^ (Text->m_Orient != 0);
pos = TransformCoordinate( TransMat, Text->m_Pos ) + DrawLibItem->m_Pos;
SetCurrentLineWidth( -1 );
int thickness = Text->m_Width;
if( thickness == 0 ) //
thickness = MAX( g_PlotLine_Width, g_DrawMinimunLineWidth );
int thickness = (Text->m_Width == 0) ? g_DrawDefaultLineThickness : Text->m_Width;
thickness = Clamp_Text_PenSize( thickness, Text->m_Size, Text->m_Bold );
PlotGraphicText( g_PlotFormat, pos, CharColor,
Text->m_Text,
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
......@@ -315,7 +315,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
/* Dessin de la pin et du symbole special associe */
PlotPinSymbol( pos, Pin->m_PinLen, orient, Pin->m_PinShape );
int thickness = MAX( g_PlotLine_Width, g_DrawMinimunLineWidth );;
int thickness = g_DrawDefaultLineThickness;
Pin->PlotPinTexts( pos, orient,
Entry->m_TextInside,
Entry->m_DrawPinNum, Entry->m_DrawPinName,
......@@ -496,9 +496,8 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
}
int thickness = field->m_Width;
if( thickness == 0 )
thickness = MAX( g_PlotLine_Width, g_DrawMinimunLineWidth );
int thickness = (field->m_Width == 0) ? g_DrawDefaultLineThickness : field->m_Width;
thickness = Clamp_Text_PenSize( thickness, field->m_Size, field->m_Bold );
SetCurrentLineWidth( thickness );
if( !IsMulti || (FieldNumber != REFERENCE) )
......@@ -666,9 +665,8 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
color = ReturnLayerColor( schText->m_Layer );
wxPoint textpos = schText->m_Pos + schText->GetSchematicTextOffset();
int thickness = schText->m_Width;
if( thickness == 0 )
thickness = MAX( g_PlotLine_Width, g_DrawMinimunLineWidth );
int thickness = (schText->m_Width == 0) ? g_DrawDefaultLineThickness : schText->m_Width;
thickness = Clamp_Text_PenSize( thickness, schText->m_Size, schText->m_Bold );
SetCurrentLineWidth( thickness );
......@@ -743,9 +741,9 @@ static void Plot_Hierarchical_PIN_Sheet( Hierarchical_PIN_Sheet_Struct* aHierarc
tposx = posx + size + (size / 8);
side = GR_TEXT_HJUSTIFY_LEFT;
}
int thickness = aHierarchical_PIN->m_Width;
if( thickness == 0 )
thickness = MAX( g_PlotLine_Width, g_DrawMinimunLineWidth );
int thickness = (aHierarchical_PIN->m_Width == 0) ? g_DrawDefaultLineThickness : aHierarchical_PIN->m_Width;
thickness = Clamp_Text_PenSize( thickness, aHierarchical_PIN->m_Size, aHierarchical_PIN->m_Bold );
SetCurrentLineWidth( thickness );
PlotGraphicText( g_PlotFormat, wxPoint( tposx, posy ), txtcolor,
......@@ -774,7 +772,7 @@ void PlotSheetStruct( DrawSheetStruct* Struct )
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS( ReturnLayerColor( Struct->m_Layer ) );
int thickness = MAX( g_PlotLine_Width, g_DrawMinimunLineWidth );
int thickness = g_DrawDefaultLineThickness;
SetCurrentLineWidth( thickness );
Move_Plume( Struct->m_Pos, 'U' );
......@@ -795,6 +793,8 @@ void PlotSheetStruct( DrawSheetStruct* Struct )
Text = Struct->m_SheetName;
size = wxSize( Struct->m_SheetNameSize, Struct->m_SheetNameSize );
pos = Struct->m_Pos; pos.y -= 4;
thickness = g_DrawDefaultLineThickness;
thickness = Clamp_Text_PenSize( thickness, size, false );
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS( ReturnLayerColor( LAYER_SHEETNAME ) );
......@@ -808,6 +808,8 @@ void PlotSheetStruct( DrawSheetStruct* Struct )
/*Draw texts : FileName */
Text = Struct->GetFileName();
size = wxSize( Struct->m_FileNameSize, Struct->m_FileNameSize );
thickness = g_DrawDefaultLineThickness;
thickness = Clamp_Text_PenSize( thickness, size, false );
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS( ReturnLayerColor( LAYER_SHEETFILENAME ) );
......
......@@ -230,7 +230,7 @@ void WinEDA_PlotPSFrame::CreateControls()
SetFocus(); // make the ESC work
m_DefaultLineSizeCtrl = new WinEDA_ValueCtrl( this, _(
"Default Line Width" ),
g_PlotLine_Width,
g_DrawDefaultLineThickness,
g_UnitMetric, m_DefaultLineSizeCtrlSizer,
EESCHEMA_INTERNAL_UNIT );
}
......@@ -320,9 +320,9 @@ void WinEDA_PlotPSFrame::InitOptVars()
Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue();
g_PlotPSColorOpt = m_PlotPSColorOption->GetSelection();
PS_SizeSelect = m_SizeOption->GetSelection();
g_PlotLine_Width = m_DefaultLineSizeCtrl->GetValue();
if( g_PlotLine_Width < 1 )
g_PlotLine_Width = 1;
g_DrawDefaultLineThickness = m_DefaultLineSizeCtrl->GetValue();
if( g_DrawDefaultLineThickness < 1 )
g_DrawDefaultLineThickness = 1;
}
......@@ -436,7 +436,7 @@ void WinEDA_PlotPSFrame::PlotOneSheetPS( const wxString& FileName,
m_MsgBox->AppendText( Line );
InitPlotParametresPS( plot_offset, sheet, g_PlotScaleX, g_PlotScaleY );
SetDefaultLineWidthPS( g_PlotLine_Width );
SetDefaultLineWidthPS( g_DrawDefaultLineThickness );
/* Init : */
PrintHeaderPS( PlotOutput, wxT( "EESchema-PS" ), FileName, 1, BBox, wxLANDSCAPE );
......@@ -478,7 +478,7 @@ void WinEDA_PlotPSFrame::PlotOneSheetPS( const wxString& FileName,
switch( layer )
{
case LAYER_NOTES: /* Trace en pointilles */
SetCurrentLineWidth( -1 );
SetCurrentLineWidth( g_DrawDefaultLineThickness );
fprintf( PlotOutput, "[50 50] 0 setdash\n" );
Move_Plume( StartPos, 'U' );
Move_Plume( EndPos, 'D' );
......@@ -488,16 +488,20 @@ void WinEDA_PlotPSFrame::PlotOneSheetPS( const wxString& FileName,
case LAYER_BUS: /* Trait large */
{
fprintf( PlotOutput, "%d setlinewidth\n", g_PlotLine_Width * 3 );
int thickness = wxRound( g_DrawDefaultLineThickness * 1.4 );
if ( thickness < 3 ) thickness = 3;
SetCurrentLineWidth( thickness );
fprintf( PlotOutput, "%d setlinewidth\n", thickness );
Move_Plume( StartPos, 'U' );
Move_Plume( EndPos, 'D' );
Plume( 'Z' );
fprintf( PlotOutput, "%d setlinewidth\n", g_PlotLine_Width );
SetCurrentLineWidth( g_DrawDefaultLineThickness );
fprintf( PlotOutput, "%d setlinewidth\n", g_DrawDefaultLineThickness );
}
break;
default:
SetCurrentLineWidth( -1 );
SetCurrentLineWidth( g_DrawDefaultLineThickness );
Move_Plume( StartPos, 'U' );
Move_Plume( EndPos, 'D' );
Plume( 'Z' );
......
......@@ -38,11 +38,6 @@ typedef enum { /* Line styles for Get/SetLineStyle. */
GR_DASHED_LINE = 3
} GRLineStypeType;
typedef enum { /* Line widths for Get/SetLineStyle. */
GR_NORM_WIDTH = 1,
GR_THICK_WIDTH = 3
} GRLineWidthType;
/*******************************************************/
/* Prototypage des fonctions definies dans gr_basic.cc */
......
No preview for this file type
This diff is collapsed.
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