code cleaning and a minor problem fixed in Gerbview printing option

This commit is contained in:
charras 2010-01-04 19:09:33 +00:00
parent ef29dabf9b
commit 1b6ad8c7f7
17 changed files with 38 additions and 240 deletions

View File

@ -37,14 +37,12 @@ macro(create_svn_version_header)
endif(Subversion_FOUND)
# Check to make sure 'svn info' command did not fail. Otherwise fallback
# to vesion strings defined in "<kicad-src-dir>/include/build_version.h".
# to version strings defined in "<kicad-src-dir>/include/build_version.h".
if(Kicad_WC_LAST_CHANGED_DATE)
string(REGEX REPLACE "^([0-9]+)\\-([0-9]+)\\-([0-9]+).*" "\\1\\2\\3"
_kicad_svn_date ${Kicad_WC_LAST_CHANGED_DATE})
set(KICAD_SVN_VERSION
set(KICAD_BUILD_VERSION
"(${_kicad_svn_date} SVN-R${Kicad_WC_LAST_CHANGED_REV})")
set(KICAD_ABOUT_VERSION
"SVN-R${Kicad_WC_LAST_CHANGED_REV} (${_kicad_svn_date})")
# Definition to conditionally use date and revision returned from the
# Subversion info command instead of hand coded date and revision in
@ -58,7 +56,6 @@ macro(create_svn_version_header)
configure_file(${CMAKE_SOURCE_DIR}/CMakeModules/version.h.cmake
${CMAKE_BINARY_DIR}/version.h)
message(STATUS "Kicad SVN version: ${KICAD_SVN_VERSION}")
message(STATUS "Kicad about version: ${KICAD_ABOUT_VERSION}")
message(STATUS "Kicad SVN build version: ${KICAD_BUILD_VERSION}")
endif(Kicad_WC_LAST_CHANGED_DATE)
endmacro(create_svn_version_header)

View File

@ -8,7 +8,6 @@
#ifndef __KICAD_SVN_VERSION_H__
#define __KICAD_SVN_VERSION_H__
#cmakedefine KICAD_SVN_VERSION "@KICAD_SVN_VERSION@"
#cmakedefine KICAD_ABOUT_VERSION "@KICAD_ABOUT_VERSION@"
#cmakedefine KICAD_BUILD_VERSION "@KICAD_BUILD_VERSION@"
#endif /* __KICAD_SVN_VERSION_H__ */

View File

@ -8,29 +8,28 @@
#include "appl_wxstruct.h"
#define BUILD_VERSION "(2009-12-05-unstable)"
#if defined(HAVE_SVN_VERSION) || defined(HAVE_SVN_REVISION)
# include "version.h"
#ifndef KICAD_ABOUT_VERSION
#define KICAD_ABOUT_VERSION BUILD_VERSION
#endif
wxString g_BuildAboutVersion( wxT( KICAD_ABOUT_VERSION ) );
#else
wxString g_BuildAboutVersion( wxT( BUILD_VERSION ) );
#ifdef HAVE_SVN_VERSION
#include "version.h" // define the KICAD_BUILD_VERSION
#endif
#ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2010-01-04)"
#endif
/** Function GetAboutBuildVersion()
* Return custom build date for about dialog
#define VERSION_STABILITY "unstable"
/** Function GetBuildVersion()
* Return the build date and version
*/
wxString GetAboutBuildVersion()
wxString GetBuildVersion()
{
return g_BuildAboutVersion;
wxString msg;
msg.Printf( wxT("%s-%s"),
wxT( KICAD_BUILD_VERSION ), wxT(VERSION_STABILITY));
return msg;
}
/**********************************/
wxString SetMsg( const wxString& msg )
/**********************************/
@ -62,7 +61,7 @@ void InitKiCadAbout( wxAboutDialogInfo& info )
wxString description;
/* KiCad build version */
description << ( _T( "Build: " ) ) << GetAboutBuildVersion();
description << ( _T( "Build: " ) ) << GetBuildVersion();
/* Print for wxversion */
description << ( wxT( "\n\nwxWidgets " ) )

View File

@ -118,26 +118,6 @@ StructColors ColorRefs[NBCOLOR] =
};
#define BUILD_VERSION "(2009-12-05-unstable)"
#ifdef HAVE_SVN_VERSION
#include "version.h"
wxString g_BuildVersion( wxT( KICAD_SVN_VERSION ) );
#else
wxString g_BuildVersion( wxT( BUILD_VERSION ) );
#endif
/** Function GetBuildVersion()
* Return the build date
*/
wxString GetBuildVersion()
{
return g_BuildVersion;
}
/** function SetLocaleTo_C_standard
* because kicad is internationalized, switch internalization to "C" standard
* i.e. uses the . (dot) as separator in print/read float numbers

View File

@ -285,8 +285,13 @@ void GRResetPenAndBrush( wxDC* DC )
void SetPenMinWidth( int minwidth )
{
PenMinWidth = minwidth;
if( PenMinWidth < 1 )
PenMinWidth = 1;
if( PenMinWidth < 0 )
PenMinWidth = 0;
}
int GetPenMinWidth( )
{
return PenMinWidth;
}
@ -1037,16 +1042,6 @@ static void GRSClosedPoly( EDA_Rect* ClipBox,
}
/* not used
* static void GRSClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, wxPoint
* Points[],
* bool Fill, int Color, int BgColor )
* {
* GRSClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor );
* }
*/
/*
* Draw a new polyline and fill it if Fill, in drawing space.
*/

View File

@ -118,28 +118,6 @@ int g_GridRoutingSize = 250;
bool g_Zone_45_Only = FALSE;
/* HPGL plot settings. */
int g_HPGL_Pen_Num = 1; /* pen number */
int g_HPGL_Pen_Speed = 40; /* speed in cm/s */
int g_HPGL_Pen_Diam; /* diameter in mils */
int g_HPGL_Pen_Recouvrement; /* recovery in mils ( for filling ) */
float Scale_X;
float Scale_Y; /* scale factor in X and Y axis */
int PlotMarge;
int g_PlotLine_Width;
int g_PlotFormat = PLOT_FORMAT_GERBER;
int g_PlotOrient;
wxPoint g_PlotOffset;
FILE* dest = NULL;
/* id for plot format (see enum PlotFormat in plot_common.h) */
int g_PlotScaleOpt;
int g_DrillShapeOpt;
// Default setting used when creating a new zone
ZONE_SETTING g_Zone_Default_Setting;

View File

@ -48,7 +48,6 @@ private:
WinEDA_GerberFrame* m_Parent;
wxConfig* m_Config;
wxCheckBox* m_BoxSelectLayer[32];
static bool m_ExcludeEdgeLayer;
public:
DIALOG_PRINT_USING_PRINTER( WinEDA_GerberFrame* parent );
@ -63,7 +62,6 @@ private:
void OnButtonCancelClick( wxCommandEvent& event ) { Close(); }
void SetPrintParameters( );
void SetPenWidth();
void InitValues( );
public:
@ -72,8 +70,6 @@ public:
int SetLayerMaskFromListSelection();
};
bool DIALOG_PRINT_USING_PRINTER::m_ExcludeEdgeLayer;
/*******************************************************/
@ -128,7 +124,6 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
wxString msg;
layer_max = 32;
m_ExcludeEdgeLayer = true; // no meaning in gerbview
/* Create layer list */
int mask = 1, ii;
@ -154,7 +149,6 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
if( m_Config )
{
m_Config->Read( OPTKEY_PLOT_LINEWIDTH_VALUE, &s_Parameters.m_PenMinSize );
m_Config->Read( OPTKEY_PRINT_X_FINESCALE_ADJ, &s_Parameters.m_XScaleAdjust );
m_Config->Read( OPTKEY_PRINT_Y_FINESCALE_ADJ, &s_Parameters.m_YScaleAdjust );
m_Config->Read( OPTKEY_PRINT_SCALE, &scale_idx );
@ -206,10 +200,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
else
m_ModeColorOption->SetSelection( 0 );
AddUnitSymbol( *m_TextPenWidth, g_UnitMetric );
m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenMinSize, m_Parent->m_InternalUnits ) );
s_Parameters.m_PenMinSize = 0;
// Create scale adjust option
msg.Printf( wxT( "%f" ), s_Parameters.m_XScaleAdjust );
@ -249,7 +240,6 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
if( m_Config )
{
m_Config->Write( OPTKEY_PLOT_LINEWIDTH_VALUE, s_Parameters.m_PenMinSize );
m_Config->Write( OPTKEY_PRINT_X_FINESCALE_ADJ, s_Parameters.m_XScaleAdjust );
m_Config->Write( OPTKEY_PRINT_Y_FINESCALE_ADJ, s_Parameters.m_YScaleAdjust );
m_Config->Write( OPTKEY_PRINT_SCALE, m_ScaleOption->GetSelection() );
@ -301,35 +291,8 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
}
g_pcb_plot_options.ScaleAdjX = s_Parameters.m_XScaleAdjust;
g_pcb_plot_options.ScaleAdjX = s_Parameters.m_YScaleAdjust;
SetPenWidth();
}
/**********************************************/
void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
/***********************************************/
/* Get the new pen width value, and verify min et max value
* NOTE: s_Parameters.m_PenMinSize is in internal units
*/
{
s_Parameters.m_PenMinSize = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
if( s_Parameters.m_PenMinSize > WIDTH_MAX_VALUE )
{
s_Parameters.m_PenMinSize = WIDTH_MAX_VALUE;
}
if( s_Parameters.m_PenMinSize < WIDTH_MIN_VALUE )
{
s_Parameters.m_PenMinSize = WIDTH_MIN_VALUE;
}
m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenMinSize, m_Parent->m_InternalUnits ) );
}
/**********************************************************/
void DIALOG_PRINT_USING_PRINTER::OnPrintSetup( wxCommandEvent& event )
/**********************************************************/

View File

@ -69,15 +69,6 @@ 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->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.") );
sbOptionsSizer->Add( m_DialogPenWidth, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_Print_Mirror = new wxCheckBox( this, wxID_ANY, _("Mirror"), wxDefaultPosition, wxDefaultSize, 0 );
sbOptionsSizer->Add( m_Print_Mirror, 0, wxALL, 5 );

View File

@ -426,112 +426,6 @@
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pen Width Mini</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_TextPenWidth</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size">-1,-1</property>
<property name="name">m_DialogPenWidth</property>
<property name="permission">protected</property>
<property name="pos"></property>
<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="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>

View File

@ -49,8 +49,6 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog
wxTextCtrl* m_FineAdjustXscaleOpt;
wxStaticText* m_FineAdjustYscaleTitle;
wxTextCtrl* m_FineAdjustYscaleOpt;
wxStaticText* m_TextPenWidth;
wxTextCtrl* m_DialogPenWidth;
wxCheckBox* m_Print_Mirror;
wxRadioBox* m_ModeColorOption;
wxRadioBox* m_PagesOption;

View File

@ -6,7 +6,6 @@
#define PCBPLOT_H
/* Shared Config keys for plot and print */
#define OPTKEY_PLOT_LINEWIDTH_VALUE wxT( "PlotLineWidth" )
#define OPTKEY_LAYERBASE wxT( "PlotLayer_%d" )
#define OPTKEY_PRINT_X_FINESCALE_ADJ wxT( "PrintXFineScaleAdj" )
#define OPTKEY_PRINT_Y_FINESCALE_ADJ wxT( "PrintYFineScaleAdj" )

View File

@ -117,6 +117,8 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
// minimize reallocations of the vector's internal array by starting with a good sized one.
points.reserve(10000);
int tmp = GetPenMinWidth( );
SetPenMinWidth(0 );
for( TRACK* track = GetBoard()->m_Zone; track; track = track->Next() )
{
if( !(track->ReturnMaskLayer() & printmasklayer) )
@ -176,6 +178,8 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
// Draw tracks and flashes down here. This will probably not be a final solution to drawing order issues
Draw_Track_Buffer( DrawPanel, DC, GetBoard(), draw_mode, printmasklayer );
SetPenMinWidth( tmp );
if( DisplayOpt.DisplayPadNum )
Affiche_DCodes_Pistes( DrawPanel, DC, GetBoard(), GR_COPY );

View File

@ -3,7 +3,9 @@
#ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION
extern wxString g_BuildVersion;
extern wxString g_BuildAboutVersion;
/** Function GetBuildVersion()
* Return the build date and version
*/
wxString GetBuildVersion();
#endif // KICAD_BUILD_VERSION

View File

@ -267,8 +267,6 @@ void InitKiCadAbout( wxAboutDialogInfo& info );
/* common.cpp */
/**************/
wxString GetBuildVersion(); /* Return the build date */
wxString GetAboutBuildVersion(); /* Return custom build date for about
* dialog */
/**
* function Affiche_1_Parametre

View File

@ -57,6 +57,7 @@ void GRForceBlackPen( bool flagforce );
*/
bool GetGRForceBlackPenState( void );
void SetPenMinWidth( int minwidth );
int GetPenMinWidth( );
void GRSPutPixel( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int color );
void GRSFilledRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1,

View File

@ -54,7 +54,6 @@ public:
private:
void OnCloseWindow( wxCloseEvent& event );
void OnInitDialog( wxInitDialogEvent& event );
void OnPrintSetup( wxCommandEvent& event );
void OnPrintPreview( wxCommandEvent& event );
void OnPrintButtonClick( wxCommandEvent& event );

View File

@ -4170,7 +4170,8 @@ PARSER::PARSER( ELEM* aParent ) :
generated_by_freeroute = false;
host_cad = "Kicad's PCBNEW";
host_version = CONV_TO_UTF8(g_BuildVersion);
wxString msg = GetBuildVersion();
host_version = CONV_TO_UTF8(msg);
}