Commit de471744 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Fix some minor bugs in plot functions

parent 7f07b48e
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
 * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
 * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
 * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
+3 −2
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
/* Plot sheet references
 * margin is in mils (1/1000 inch)
 */
void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen, int aLineWidth )
{
#define WSTEXTSIZE      50   // Text size in mils

@@ -46,10 +46,11 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
#endif

    bool     italic    = false;
    bool     thickness = 0;      //@todo : use current pen
    int      thickness = aLineWidth;

    color = BLACK;
    plotter->SetColor( color );
    plotter->SetCurrentLineWidth( thickness );

    // Plot edge.
    ref.x = pageInfo.GetLeftMarginMils() * iusPerMil;
+39 −7
Original line number Diff line number Diff line
@@ -2,6 +2,33 @@
 * Functions to draw and plot text on screen
 * @file drawtxt.cpp
 */

/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
 * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
 * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

#include <fctsys.h>
#include <gr_basic.h>
#include <common.h>
@@ -526,15 +553,17 @@ void PLOTTER::Text( const wxPoint& aPos,
                    bool                        aItalic,
                    bool                        aBold )
{
    if( aWidth == 0 && aBold )      // Use default values if aWidth == 0
        aWidth = GetPenSizeForBold( MIN( aSize.x, aSize.y ) );
    int textPensize = aWidth;

    if( aWidth >= 0 )
        aWidth = Clamp_Text_PenSize( aWidth, aSize, aBold );
    if( textPensize == 0 && aBold )      // Use default values if aWidth == 0
        textPensize = GetPenSizeForBold( MIN( aSize.x, aSize.y ) );

    if( textPensize >= 0 )
        textPensize = Clamp_Text_PenSize( aWidth, aSize, aBold );
    else
        aWidth = -Clamp_Text_PenSize( -aWidth, aSize, aBold );
        textPensize = -Clamp_Text_PenSize( -aWidth, aSize, aBold );

    SetCurrentLineWidth( aWidth );
    SetCurrentLineWidth( textPensize );


    if( aColor >= 0 )
@@ -543,8 +572,11 @@ void PLOTTER::Text( const wxPoint& aPos,
    DrawGraphicText( NULL, NULL, aPos, aColor, aText,
                     aOrient, aSize,
                     aH_justify, aV_justify,
                     aWidth, aItalic,
                     textPensize, aItalic,
                     aBold,
                     NULL,
                     this );

    if( aWidth != textPensize )
        SetCurrentLineWidth( aWidth );
}
+1 −1
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
    if( m_plot_Sheet_Ref )
    {
        plotter->SetColor( BLACK );
        m_Parent->PlotWorkSheet( plotter, screen );
        m_Parent->PlotWorkSheet( plotter, screen, g_DrawDefaultLineThickness );
    }

    screen->Plot( plotter );
+1 −1
Original line number Diff line number Diff line
@@ -395,7 +395,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
    plotter->SetColor( BLACK );

    if( s_plot_Sheet_Ref )
        m_Parent->PlotWorkSheet( plotter, screen );
        m_Parent->PlotWorkSheet( plotter, screen, g_DrawDefaultLineThickness );

    screen->Plot( plotter );

Loading