Gerbview: fix incorrect printing of negative objects, when using black and white option

Enhancement in Excellon file reader: accept Feed Rate and Spindle Speed definitions in Tool information line (but does not use them)
Eeschema: better name for m_SheetList (changed to m_SheetPath) member of class NETLIST_OBJECT.
This commit is contained in:
jean-pierre charras 2013-09-30 08:36:40 +02:00
commit 25b20c5564
21 changed files with 203 additions and 126 deletions

View File

@ -116,7 +116,7 @@ const char* ShowType( NETLIST_ITEM_T aType )
void NETLIST_OBJECT::Show( std::ostream& out, int ndx ) const
{
wxString path = m_SheetList.PathHumanReadable();
wxString path = m_SheetPath.PathHumanReadable();
out << "<netItem ndx=\"" << ndx << '"' <<
" type=\"" << ShowType( m_Type ) << '"' <<
@ -129,13 +129,13 @@ void NETLIST_OBJECT::Show( std::ostream& out, int ndx ) const
if( !m_Label.IsEmpty() )
out << " <label>" << m_Label.mb_str() << "</label>\n";
out << " <sheetpath>" << m_SheetList.PathHumanReadable().mb_str() << "</sheetpath>\n";
out << " <sheetpath>" << m_SheetPath.PathHumanReadable().mb_str() << "</sheetpath>\n";
switch( m_Type )
{
case NET_PIN:
/* GetRef() needs to be const
out << " <refOfComp>" << ((SCH_COMPONENT*)m_Link)->GetRef(&m_SheetList).mb_str()
out << " <refOfComp>" << GetComponentParent()->GetRef(&m_SheetPath).mb_str()
<< "</refOfComp>\n";
*/
@ -222,7 +222,7 @@ bool NETLIST_OBJECT::IsLabelConnected( NETLIST_OBJECT* aNetItem )
if( ( at == NET_HIERLABEL || at == NET_HIERBUSLABELMEMBER )
&& ( bt == NET_SHEETLABEL || bt == NET_SHEETBUSLABELMEMBER ) )
{
if( m_SheetList == aNetItem->m_SheetListInclude )
if( m_SheetPath == aNetItem->m_SheetPathInclude )
{
return true; //connected!
}
@ -325,7 +325,7 @@ wxString NETLIST_OBJECT::GetNetName() const
if( !m_netNameCandidate->IsLabelGlobal() )
{
// usual net name, prefix it by the sheet path
netName = m_netNameCandidate->m_SheetList.PathHumanReadable();
netName = m_netNameCandidate->m_SheetPath.PathHumanReadable();
}
netName += m_netNameCandidate->m_Label;
@ -347,11 +347,11 @@ wxString NETLIST_OBJECT::GetShortNetName() const
if( m_netNameCandidate->m_Type == NET_PIN )
{
SCH_COMPONENT* link = (SCH_COMPONENT*)m_netNameCandidate->m_Link;
SCH_COMPONENT* link = m_netNameCandidate->GetComponentParent();
if( link ) // Should be always true
{
netName = wxT("Net-<");
netName << link->GetRef( &m_netNameCandidate->m_SheetList );
netName << link->GetRef( &m_netNameCandidate->m_SheetPath );
netName << wxT("-Pad")
<< LIB_PIN::ReturnPinStringNum( m_netNameCandidate->m_PinNum )
<< wxT(">");

View File

@ -36,6 +36,7 @@
#include <lib_pin.h> // LIB_PIN::ReturnPinStringNum( m_PinNum )
class NETLIST_OBJECT_LIST;
class SCH_COMPONENT;
/* Type of Net objects (wires, labels, pins...) */
@ -97,7 +98,8 @@ public:
* that contains this pin
*/
int m_Flag; /* flag used in calculations */
SCH_SHEET_PATH m_SheetList;
SCH_SHEET_PATH m_SheetPath; // the sheet path which contains this item
SCH_SHEET_PATH m_SheetPathInclude; // sheet path which contains the hierarchical label
int m_ElectricalType; /* Has meaning only for Pins and
* hierarchical pins: electrical type */
int m_BusNetCode; /* Used for BUS connections */
@ -105,7 +107,6 @@ public:
* created from the BUS label ) member number.
*/
NET_CONNECTION_T m_ConnectionType; // Used to store the connection type
SCH_SHEET_PATH m_SheetListInclude; // sheet path which contains the hierarchical label
long m_PinNum; // pin number ( 1 long = 4 bytes -> 4 ascii codes)
wxString m_Label; // Label text (for labels) or Pin name (for pins)
wxPoint m_Start; // Position of object or for segments: starting point
@ -181,6 +182,19 @@ public:
return LIB_PIN::ReturnPinStringNum( m_PinNum );
}
/** For Pins (NET_PINS):
* @return the schematic component which contains this pin
* (Note: this is the schematic component, not the library component
* for others items: return NULL
*/
SCH_COMPONENT* GetComponentParent() const
{
if( m_Link && m_Link->Type() == SCH_COMPONENT_T )
return (SCH_COMPONENT*) m_Link;
return NULL;
}
/**
* Function IsLabelConnected
* tests if the net list object is a hierarchical label or sheet label and is
@ -385,7 +399,7 @@ private:
*/
static bool sortItemsBySheet( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 )
{
return Objet1->m_SheetList.Cmp( Objet2->m_SheetList ) < 0;
return Objet1->m_SheetPath.Cmp( Objet2->m_SheetPath ) < 0;
}
/*
* Propagate net codes from a parent sheet to an include sheet,

View File

@ -240,7 +240,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
marker->SetMarkerType( MARK_ERC );
marker->SetErrorLevel( WAR );
screen = aNetItemRef->m_SheetList.LastScreen();
screen = aNetItemRef->m_SheetPath.LastScreen();
screen->Append( marker );
wxString msg;
@ -277,7 +277,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
cmp_ref = wxT( "?" );
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
cmp_ref = ( (SCH_COMPONENT*) aNetItemRef->m_Link )->GetRef( &aNetItemRef->m_SheetList );
cmp_ref = aNetItemRef->GetComponentParent()->GetRef( &aNetItemRef->m_SheetPath );
if( aNetItemTst == NULL )
{
@ -295,8 +295,8 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
if( aMinConn == NOD ) /* Nothing driving the net. */
{
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
cmp_ref = ( (SCH_COMPONENT*) aNetItemRef->m_Link )->GetRef(
&aNetItemRef->m_SheetList );
cmp_ref = aNetItemRef->GetComponentParent()->GetRef(
&aNetItemRef->m_SheetPath );
msg.Printf( _( "Pin %s (%s) of component %s is not driven (Net %d)." ),
GetChars( string_pinnum ), MsgPinElectricType[ii], GetChars( cmp_ref ),
@ -336,7 +336,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
alt_cmp = wxT( "?" );
if( aNetItemTst->m_Type == NET_PIN && aNetItemTst->m_Link )
alt_cmp = ( (SCH_COMPONENT*) aNetItemTst->m_Link )->GetRef( &aNetItemTst->m_SheetList );
alt_cmp = aNetItemTst->GetComponentParent()->GetRef( &aNetItemTst->m_SheetPath );
msg.Printf( _( "Pin %s (%s) of component %s is connected to " ),
GetChars( string_pinnum ), MsgPinElectricType[ii], GetChars( cmp_ref ) );
@ -405,9 +405,9 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList,
continue;
if( ( (SCH_COMPONENT*) aList->GetItem( aNetItemRef )->
m_Link )->GetRef( &aList->GetItem( aNetItemRef )-> m_SheetList ) !=
m_Link )->GetRef( &aList->GetItem( aNetItemRef )-> m_SheetPath ) !=
( (SCH_COMPONENT*) aList->GetItem( duplicate )->m_Link )
->GetRef( &aList->GetItem( duplicate )->m_SheetList ) )
->GetRef( &aList->GetItem( duplicate )->m_SheetPath ) )
continue;
// Same component and same pin. Do dot create error for this pin

View File

@ -875,10 +875,10 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericListOfNets()
if( nitem->m_Flag != 0 ) // Redundant pin, skip it
continue;
comp = (SCH_COMPONENT*) nitem->m_Link;
comp = nitem->GetComponentParent();
// Get the reference for the net name and the main parent component
ref = comp->GetRef( &nitem->m_SheetList );
ref = comp->GetRef( &nitem->m_SheetPath );
if( ref[0] == wxChar( '#' ) )
continue;
@ -1520,7 +1520,7 @@ bool NETLIST_EXPORT_TOOL::addPinToComponentPinList( SCH_COMPONENT* aComponent,
continue;
// most expensive test at the end.
if( pin->m_SheetList != *aSheetPath )
if( pin->m_SheetPath != *aSheetPath )
continue;
m_SortedComponentPinList.push_back( pin );
@ -1675,10 +1675,10 @@ bool NETLIST_EXPORT_TOOL::writeGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST&
if( nitem->m_Flag != 0 ) // Redundant pin, skip it
continue;
comp = (SCH_COMPONENT*) nitem->m_Link;
comp = nitem->GetComponentParent();
// Get the reference for the net name and the main parent component
ref = comp->GetRef( &nitem->m_SheetList );
ref = comp->GetRef( &nitem->m_SheetPath );
if( ref[0] == wxChar( '#' ) )
continue; // Pseudo component (Like Power symbol)
@ -1824,8 +1824,8 @@ bool NETLIST_EXPORT_TOOL::writeListOfNetsCADSTAR( FILE* f )
if( nitem->m_Flag != 0 )
continue;
Cmp = (SCH_COMPONENT*) nitem->m_Link;
wxString refstr = Cmp->GetRef( &nitem->m_SheetList );
Cmp = nitem->GetComponentParent();
wxString refstr = Cmp->GetRef( &nitem->m_SheetPath );
if( refstr[0] == '#' )
continue; // Power supply symbols.

View File

@ -147,16 +147,16 @@ bool NETLIST_OBJECT_LIST::BuildNetListInfo( SCH_SHEET_LIST& aSheets )
// Sort objects by Sheet
SortListbySheet();
sheet = &(GetItem( 0 )->m_SheetList);
sheet = &(GetItem( 0 )->m_SheetPath);
m_lastNetCode = m_lastBusNetCode = 1;
for( unsigned ii = 0, istart = 0; ii < size(); ii++ )
{
NETLIST_OBJECT* net_item = GetItem( ii );
if( net_item->m_SheetList != *sheet ) // Sheet change
if( net_item->m_SheetPath != *sheet ) // Sheet change
{
sheet = &(net_item->m_SheetList);
sheet = &(net_item->m_SheetPath);
istart = ii;
}
@ -377,8 +377,8 @@ static bool evalLabelsPriority( const NETLIST_OBJECT* aLabel1,
// use name defined in higher hierarchical sheet
// (i.e. shorter path because paths are /<timestamp1>/<timestamp2>/...
// and timestamp = 8 letters.
if( aLabel1->m_SheetList.Path().Length() != aLabel2->m_SheetList.Path().Length() )
return aLabel1->m_SheetList.Path().Length() < aLabel2->m_SheetList.Path().Length();
if( aLabel1->m_SheetPath.Path().Length() != aLabel2->m_SheetPath.Path().Length() )
return aLabel1->m_SheetPath.Path().Length() < aLabel2->m_SheetPath.Path().Length();
// Sheet paths have the same length: use alphabetic label name order
// For labels on sheets having an equivalent deep in hierarchy, use
@ -386,8 +386,8 @@ static bool evalLabelsPriority( const NETLIST_OBJECT* aLabel1,
if( aLabel1->m_Label.Cmp( aLabel2->m_Label ) != 0 )
return aLabel1->m_Label.Cmp( aLabel2->m_Label ) < 0;
return aLabel1->m_SheetList.PathHumanReadable().Cmp(
aLabel2->m_SheetList.PathHumanReadable() ) < 0;
return aLabel1->m_SheetPath.PathHumanReadable().Cmp(
aLabel2->m_SheetPath.PathHumanReadable() ) < 0;
}
@ -508,19 +508,24 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet()
idxstart = ii;
}
// Search all pins having no net name candidate yet, i.e. on nets
// having no labels
// Examine all pins of the net to find the best candidate,
// i.e. the first net name candidate, by alphabetic order
// the net names are names bu_ilt by GetShortNetName
// (Net-<{reference}-Pad{pad number}> like Net-<U3-Pad5>
// Not named nets do not have usually a lot of members.
// Many have only 2 members(a pad and a non connection symbol)
if( item->m_Type == NET_PIN )
{
// A candidate is found, however components which are not in
// netlist are not candidate because some have their reference
// is changed each time the netlist is built (power components)
// and anyway they are not a good candidate
SCH_COMPONENT* link = (SCH_COMPONENT*)item->m_Link;
if( link->IsInNetlist() )
// changed each time the netlist is built (power components)
// and anyway obviously they are not a good candidate
SCH_COMPONENT* link = item->GetComponentParent();
if( link && link->IsInNetlist() )
{
// select the better between the previous and this one
item->SetNetNameCandidate( item ); // Needed to calculate GetShortNetName
if( candidate == NULL )
candidate = item;
else
@ -547,7 +552,7 @@ void NETLIST_OBJECT_LIST::sheetLabelConnect( NETLIST_OBJECT* SheetLabel )
{
NETLIST_OBJECT* ObjetNet = GetItem( ii );
if( ObjetNet->m_SheetList != SheetLabel->m_SheetListInclude )
if( ObjetNet->m_SheetPath != SheetLabel->m_SheetPathInclude )
continue; //use SheetInclude, not the sheet!!
if( (ObjetNet->m_Type != NET_HIERLABEL ) && (ObjetNet->m_Type != NET_HIERBUSLABELMEMBER ) )
@ -681,7 +686,7 @@ void NETLIST_OBJECT_LIST::pointToPointConnect( NETLIST_OBJECT* aRef, bool aIsBus
{
NETLIST_OBJECT* item = GetItem( i );
if( item->m_SheetList != aRef->m_SheetList ) //used to be > (why?)
if( item->m_SheetPath != aRef->m_SheetPath ) //used to be > (why?)
continue;
switch( item->m_Type )
@ -725,7 +730,7 @@ void NETLIST_OBJECT_LIST::pointToPointConnect( NETLIST_OBJECT* aRef, bool aIsBus
{
NETLIST_OBJECT* item = GetItem( i );
if( item->m_SheetList != aRef->m_SheetList )
if( item->m_SheetPath != aRef->m_SheetPath )
continue;
switch( item->m_Type )
@ -779,7 +784,7 @@ void NETLIST_OBJECT_LIST::segmentToPointConnect( NETLIST_OBJECT* aJonction,
NETLIST_OBJECT* segment = GetItem( i );
// if different sheets, obviously no physical connection between elements.
if( segment->m_SheetList != aJonction->m_SheetList )
if( segment->m_SheetPath != aJonction->m_SheetPath )
continue;
if( aIsBus == IS_WIRE )
@ -832,7 +837,7 @@ void NETLIST_OBJECT_LIST::labelConnect( NETLIST_OBJECT* aLabelRef )
if( item->GetNet() == aLabelRef->GetNet() )
continue;
if( item->m_SheetList != aLabelRef->m_SheetList )
if( item->m_SheetPath != aLabelRef->m_SheetPath )
{
if( item->m_Type != NET_PINLABEL && item->m_Type != NET_GLOBLABEL
&& item->m_Type != NET_GLOBBUSLABELMEMBER )

View File

@ -1741,9 +1741,9 @@ void SCH_COMPONENT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
wxPoint pos = GetTransform().TransformCoordinate( pin->GetPosition() ) + m_Pos;
NETLIST_OBJECT* item = new NETLIST_OBJECT();
item->m_SheetListInclude = *aSheetPath;
item->m_SheetPathInclude = *aSheetPath;
item->m_Comp = (SCH_ITEM*) pin;
item->m_SheetList = *aSheetPath;
item->m_SheetPath = *aSheetPath;
item->m_Type = NET_PIN;
item->m_Link = (SCH_ITEM*) this;
item->m_ElectricalType = pin->GetType();
@ -1757,9 +1757,9 @@ void SCH_COMPONENT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
{
/* There is an associated PIN_LABEL. */
item = new NETLIST_OBJECT();
item->m_SheetListInclude = *aSheetPath;
item->m_SheetPathInclude = *aSheetPath;
item->m_Comp = NULL;
item->m_SheetList = *aSheetPath;
item->m_SheetPath = *aSheetPath;
item->m_Type = NET_PINLABEL;
item->m_Label = pin->GetName();
item->m_Start = pos;

View File

@ -179,8 +179,8 @@ void SCH_JUNCTION::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
{
NETLIST_OBJECT* item = new NETLIST_OBJECT();
item->m_SheetList = *aSheetPath;
item->m_SheetListInclude = *aSheetPath;
item->m_SheetPath = *aSheetPath;
item->m_SheetPathInclude = *aSheetPath;
item->m_Comp = (SCH_ITEM*) this;
item->m_Type = NET_JUNCTION;
item->m_Start = item->m_End = m_pos;

View File

@ -524,8 +524,8 @@ void SCH_LINE::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
return;
NETLIST_OBJECT* item = new NETLIST_OBJECT();
item->m_SheetList = *aSheetPath;
item->m_SheetListInclude = *aSheetPath;
item->m_SheetPath = *aSheetPath;
item->m_SheetPathInclude = *aSheetPath;
item->m_Comp = (SCH_ITEM*) this;
item->m_Start = m_start;
item->m_End = m_end;

View File

@ -193,8 +193,8 @@ void SCH_NO_CONNECT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
{
NETLIST_OBJECT* item = new NETLIST_OBJECT();
item->m_SheetList = *aSheetPath;
item->m_SheetListInclude = *aSheetPath;
item->m_SheetPath = *aSheetPath;
item->m_SheetPathInclude = *aSheetPath;
item->m_Comp = this;
item->m_Type = NET_NOCONNECT;
item->m_Start = item->m_End = m_pos;

View File

@ -1081,8 +1081,8 @@ void SCH_SHEET::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
for( size_t i = 0; i < m_pins.size(); i++ )
{
NETLIST_OBJECT* item = new NETLIST_OBJECT();
item->m_SheetListInclude = sheetPath;
item->m_SheetList = *aSheetPath;
item->m_SheetPathInclude = sheetPath;
item->m_SheetPath = *aSheetPath;
item->m_Comp = &m_pins[i];
item->m_Link = this;
item->m_Type = NET_SHEETLABEL;

View File

@ -620,8 +620,8 @@ void SCH_TEXT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
return;
NETLIST_OBJECT* item = new NETLIST_OBJECT();
item->m_SheetList = *aSheetPath;
item->m_SheetListInclude = *aSheetPath;
item->m_SheetPath = *aSheetPath;
item->m_SheetPathInclude = *aSheetPath;
item->m_Comp = (SCH_ITEM*) this;
item->m_Type = NET_LABEL;

View File

@ -81,9 +81,12 @@ public:
* @param aDC = the current device context
* @param aDrawMode = GR_COPY, GR_OR ... (not always used)
* @param aOffset = an draw offset value
* @param aPrintBlackAndWhite = true to force black and white insdeat of color
* useful only to print/plot gebview layers
*/
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GR_DRAWMODE aDrawMode, const wxPoint& aOffset );
GR_DRAWMODE aDrawMode, const wxPoint& aOffset,
bool aPrintBlackAndWhite = false );
/**
* Function SetVisibleLayers

View File

@ -16,7 +16,6 @@
#include <gerbview.h>
#include <pcbplot.h>
#include <class_board_design_settings.h>
static long s_SelectedLayers;
static double s_ScaleList[] =
@ -34,10 +33,10 @@ static wxPageSetupDialogData* g_pageSetupData = (wxPageSetupDialogData*) NULL;
static PRINT_PARAMETERS s_Parameters;
/* Dialog to print schematic. Class derived from DIALOG_PRINT_USING_PRINTER_base
/* Dialog to print schematic. Class derived from DIALOG_PRINT_USING_PRINTER_BASE
* created by wxFormBuilder
*/
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_base
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE
{
private:
GERBVIEW_FRAME* m_Parent;
@ -76,17 +75,17 @@ void GERBVIEW_FRAME::ToPrinter( wxCommandEvent& event )
*/
{
if( g_PrintData == NULL ) // First print
{
g_PrintData = new wxPrintData();
if( !g_PrintData->Ok() )
{
DisplayError( this, _( "Error Init Printer info" ) );
}
g_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGHT;
if( !g_PrintData->Ok() )
{
DisplayError( this, _( "Error Init Printer info" ) );
return;
}
g_PrintData->SetOrientation( GetPageSettings().IsPortrait() ? wxPORTRAIT : wxLANDSCAPE );
g_PrintData->SetQuality( wxPRINT_QUALITY_HIGH );
g_PrintData->SetOrientation( GetPageSettings().IsPortrait() ?
wxPORTRAIT : wxLANDSCAPE );
DIALOG_PRINT_USING_PRINTER* frame = new DIALOG_PRINT_USING_PRINTER( this );
@ -97,24 +96,19 @@ void GERBVIEW_FRAME::ToPrinter( wxCommandEvent& event )
/*************************************************************************************/
DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( GERBVIEW_FRAME* parent ) :
DIALOG_PRINT_USING_PRINTER_base( parent )
DIALOG_PRINT_USING_PRINTER_BASE( parent )
/*************************************************************************************/
{
m_Parent = parent;
m_Config = wxGetApp().GetSettings();
InitValues( );
GetSizer()->SetSizeHints( this );
if( GetSizer() )
{
GetSizer()->SetSizeHints( this );
}
#ifdef __WXMAC__
/* Problems with modal on wx-2.9 - Anyway preview is standard for OSX */
m_buttonPreview->Hide();
#endif
m_buttonPrint->SetDefault();
}
@ -130,7 +124,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
{
g_pageSetupData = new wxPageSetupDialogData;
// Set initial page margins.
// Margins are already set in Pcbnew, so we cans use 0
// Margins are already set in Pcbnew, so we can use 0
g_pageSetupData->SetMarginTopLeft(wxPoint(0, 0));
g_pageSetupData->SetMarginBottomRight(wxPoint(0, 0));
}
@ -176,7 +170,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
s_Parameters.m_XScaleAdjust = s_Parameters.m_YScaleAdjust = 1.0;
s_SelectedLayers = 0;
for( LAYER_NUM layer = FIRST_LAYER; layer<layer_max; ++layer )
for( LAYER_NUM layer = FIRST_LAYER; layer < layer_max; ++layer )
{
wxString layerKey;
bool option;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
@ -52,6 +52,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
bmiddleLeftSizer->Add( m_FineAdjustXscaleTitle, 0, wxRIGHT|wxLEFT, 5 );
m_FineAdjustXscaleOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_FineAdjustXscaleOpt->SetMaxLength( 0 );
m_FineAdjustXscaleOpt->SetToolTip( _("Set X scale adjust for exact scale plotting") );
bmiddleLeftSizer->Add( m_FineAdjustXscaleOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
@ -61,6 +62,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
bmiddleLeftSizer->Add( m_FineAdjustYscaleTitle, 0, wxRIGHT|wxLEFT, 5 );
m_FineAdjustYscaleOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_FineAdjustYscaleOpt->SetMaxLength( 0 );
m_FineAdjustYscaleOpt->SetToolTip( _("Set Y scale adjust for exact scale plotting") );
bmiddleLeftSizer->Add( m_FineAdjustYscaleOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
@ -101,6 +103,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
b_buttonsSizer->Add( m_buttonPreview, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonPrint = new wxButton( this, wxID_PRINT_ALL, _("Print"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonPrint->SetDefault();
b_buttonsSizer->Add( m_buttonPrint, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
@ -114,22 +117,22 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
this->Layout();
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) );
m_ScaleOption->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnScaleSelectionClick ), NULL, this );
m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPageSetup ), NULL, this );
m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintPreview ), NULL, this );
m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintButtonClick ), NULL, this );
m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnButtonCancelClick ), NULL, this );
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnCloseWindow ) );
m_ScaleOption->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnScaleSelectionClick ), NULL, this );
m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this );
m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this );
m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintButtonClick ), NULL, this );
m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnButtonCancelClick ), NULL, this );
}
DIALOG_PRINT_USING_PRINTER_base::~DIALOG_PRINT_USING_PRINTER_base()
DIALOG_PRINT_USING_PRINTER_BASE::~DIALOG_PRINT_USING_PRINTER_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) );
m_ScaleOption->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnScaleSelectionClick ), NULL, this );
m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPageSetup ), NULL, this );
m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintPreview ), NULL, this );
m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintButtonClick ), NULL, this );
m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnButtonCancelClick ), NULL, this );
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnCloseWindow ) );
m_ScaleOption->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnScaleSelectionClick ), NULL, this );
m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this );
m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this );
m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintButtonClick ), NULL, this );
m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnButtonCancelClick ), NULL, this );
}

View File

@ -40,7 +40,7 @@
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_PRINT_USING_PRINTER_base</property>
<property name="name">DIALOG_PRINT_USING_PRINTER_BASE</property>
<property name="pos"></property>
<property name="size">551,314</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
@ -1002,7 +1002,7 @@
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -11,6 +11,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/sizer.h>
@ -29,9 +31,9 @@
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PRINT_USING_PRINTER_base
/// Class DIALOG_PRINT_USING_PRINTER_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PRINT_USING_PRINTER_base : public DIALOG_SHIM
class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM
{
private:
@ -68,8 +70,8 @@ class DIALOG_PRINT_USING_PRINTER_base : public DIALOG_SHIM
public:
DIALOG_PRINT_USING_PRINTER_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 551,314 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PRINT_USING_PRINTER_base();
DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 551,314 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PRINT_USING_PRINTER_BASE();
};

View File

@ -39,6 +39,7 @@
#include <colors_selection.h>
#include <class_gerber_draw_item.h>
#include <class_GERBER.h>
#include <printout_controler.h>
void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
@ -56,10 +57,13 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
m_DisplayOptions.m_DisplayDCodes = false;
m_DisplayOptions.m_IsPrinting = true;
m_canvas->SetPrintMirrored( aPrintMirrorMode );
PRINT_PARAMETERS* printParameters = (PRINT_PARAMETERS*)aData;
// XXX -1 as drawmode?
GetGerberLayout()->Draw( m_canvas, aDC, UNSPECIFIED_DRAWMODE, wxPoint( 0, 0 ) );
m_canvas->SetPrintMirrored( aPrintMirrorMode );
bool printBlackAndWhite = printParameters && printParameters->m_Print_Black_and_White;
GetGerberLayout()->Draw( m_canvas, aDC, UNSPECIFIED_DRAWMODE,
wxPoint( 0, 0 ), printBlackAndWhite );
m_canvas->SetPrintMirrored( false );
@ -123,13 +127,13 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
* Redraw All GerbView layers, using a buffered mode or not
*/
void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
const wxPoint& aOffset )
const wxPoint& aOffset, bool aPrintBlackAndWhite )
{
// Because Images can be negative (i.e with background filled in color) items are drawn
// graphic layer per graphic layer, after the background is filled
// to a temporary bitmap
// at least when aDrawMode = GR_COPY or aDrawMode = GR_OR
// If aDrawMode = -1, items are drawn to the main screen, and therefore
// If aDrawMode = UNSPECIFIED_DRAWMODE, items are drawn to the main screen, and therefore
// artifacts can happen with negative items or negative images
wxColour bgColor = MakeColour( g_DrawBgColor );
@ -200,7 +204,7 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( layer == active_layer ) // active layer will be drawn after other layers
continue;
if( layer == 32 ) // last loop: draw active layer
if( layer == NB_GERBER_LAYERS ) // last loop: draw active layer
{
end = true;
layer = active_layer;
@ -214,6 +218,12 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( gerber == NULL ) // Graphic layer not yet used
continue;
EDA_COLOR_T color = gerbFrame->GetLayerColor( layer );
// Force black and white draw mode on request:
if( aPrintBlackAndWhite )
gerbFrame->SetLayerColor( layer, g_DrawBgColor == BLACK ? WHITE : BLACK );
if( useBufferBitmap )
{
// Draw each layer into a bitmap first. Negative Gerber
@ -299,6 +309,9 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
item->Draw( aPanel, plotDC, drawMode, wxPoint(0,0) );
doBlit = true;
}
if( aPrintBlackAndWhite )
gerbFrame->SetLayerColor( layer, color );
}
if( doBlit && useBufferBitmap ) // Blit is used only if aDrawMode >= 0

View File

@ -56,6 +56,12 @@
* T0
* M30
*/
/*
* Note there are some variant of tool definition:
* T1F00S00C... Feed Rate and Spindle Speed of Tool 1
* Feed Rate and Spindle Speed are just skipped because they are not used in a viwer
*/
#include <fctsys.h>
#include <common.h>
#include <confirm.h>
@ -73,6 +79,14 @@
#include <html_messagebox.h>
// Default format for dimensions
// number of digits in mantissa:
static int fmtMantissaMM = 3;
static int fmtMantissaInch = 4;
// number of digits, integer part:
static int fmtIntegerMM = 3;
static int fmtIntegerInch = 2;
extern int ReadInt( char*& text, bool aSkipSeparator = true );
extern double ReadDouble( char*& text, bool aSkipSeparator = true );
extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
@ -426,12 +440,21 @@ bool EXCELLON_IMAGE::Execute_HEADER_Command( char*& text )
case DRILL_TOOL_INFORMATION:
// Read a tool definition like T1C0.02:
// or T1F00S00C0.02000
// Read tool number:
iprm = ReadInt( text, false );
// Skip Feed rate and Spindle speed
while( *text && ( *text == 'F' || *text == 'S' ) )
{
text++;
ReadInt( text, false );
}
// Read tool shape
if( *text != 'C' )
ReportMessage( _( "Tool definition <%c> not supported" ) );
ReportMessage( wxString:: Format(
_( "Tool definition <%c> not supported" ), *text ) );
if( *text )
text++;
@ -622,19 +645,30 @@ bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command( char*& text )
void EXCELLON_IMAGE::SelectUnits( bool aMetric )
{
/* Inches: Default fmt = 2.4 for X and Y axis: 6 digits with 0.0001 resolution (00.0000)
* metric: Default fmt = 3.2 for X and Y axis: 5 digits, 1 micron resolution (00.000)
/* Coordinates are measured either in inch or metric (millimeters).
* Inch coordinates are in six digits (00.0000) with increments
* as small as 0.0001 (1/10,000).
* Metric coordinates can be measured in microns (thousandths of a millimeter)
* in one of the following three ways:
* Five digit 10 micron resolution (000.00)
* Six digit 10 micron resolution (0000.00)
* Six digit micron resolution (000.000)
*/
/* Inches: Default fmt = 2.4 for X and Y axis: 6 digits with 0.0001 resolution
* metric: Default fmt = 3.3 for X and Y axis: 6 digits, 1 micron resolution
*/
if( aMetric )
{
m_GerbMetric = true;
m_FmtScale.x = m_FmtScale.y = 3; // number of digits in mantissa: here 2
m_FmtLen.x = m_FmtLen.y = 5; // number of digits: here 3+2
// number of digits in mantissa
m_FmtScale.x = m_FmtScale.y = fmtMantissaMM;
// number of digits (mantissa+interger)
m_FmtLen.x = m_FmtLen.y = fmtIntegerMM+fmtMantissaMM;
}
else
{
m_GerbMetric = false;
m_FmtScale.x = m_FmtScale.y = 4; // number of digits in mantissa: here 4
m_FmtLen.x = m_FmtLen.y = 6; // number of digits: here 2+4
m_FmtScale.x = m_FmtScale.y = fmtMantissaInch;
m_FmtLen.x = m_FmtLen.y = fmtIntegerInch+fmtMantissaInch;
}
}

View File

@ -378,14 +378,14 @@ void GERBVIEW_FRAME::syncLayerBox()
UpdateTitleAndInfo();
}
void GERBVIEW_FRAME::Liste_D_Codes()
{
int ii, jj;
D_CODE* pt_D_code;
wxString Line;
wxArrayString list;
double scale = IU_PER_MILS * 1000;
double scale = g_UserUnit == INCHES ? IU_PER_MILS * 1000 :
IU_PER_MM;
LAYER_NUM curr_layer = getActiveLayer();
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer )
@ -405,6 +405,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
list.Add( Line );
const char* units = g_UserUnit == INCHES ? "\"" : "mm";
for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
{
pt_D_code = gerber->GetDCODE( ii + FIRST_DCODE, false );
@ -415,19 +416,19 @@ void GERBVIEW_FRAME::Liste_D_Codes()
if( !pt_D_code->m_InUse && !pt_D_code->m_Defined )
continue;
Line.Printf( wxT( "tool %2.2d: D%2.2d V %2.4f H %2.4f %s" ),
Line.Printf( wxT( "tool %2.2d: D%2.2d V %.4f %s H %.4f %s %s " ),
jj,
pt_D_code->m_Num_Dcode,
pt_D_code->m_Size.y / scale,
pt_D_code->m_Size.x / scale,
pt_D_code->m_Size.y / scale, units,
pt_D_code->m_Size.x / scale, units,
D_CODE::ShowApertureType( pt_D_code->m_Shape )
);
if( !pt_D_code->m_Defined )
Line += wxT( " ?" );
Line += wxT( "(not used)" );
if( !pt_D_code->m_InUse )
Line += wxT( " *" );
Line += wxT( "(in use)" );
list.Add( Line );
jj++;

View File

@ -2633,8 +2633,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
if( aReporter && aReporter->ReportAll() )
{
msg.Printf( _( "Remove single pad net \"%s\" on \"%s\" pad <%s>\n" ),
GetChars( pad->GetNetname() ),
GetChars( pad->GetParent()->GetReference() ),
GetChars( previouspad->GetNetname() ),
GetChars( previouspad->GetParent()->GetReference() ),
GetChars( previouspad->GetPadName() ) );
aReporter->Report( msg );
}

View File

@ -59,7 +59,7 @@ static const wxString tracePrinting( wxT( "KicadPrinting" ) );
PRINT_PARAMETERS::PRINT_PARAMETERS()
{
m_PenDefaultSize = Millimeter2iu( 0.2 ); // A reasonable defualt value to draw items
m_PenDefaultSize = Millimeter2iu( 0.2 ); // A reasonable default value to draw items
// which do not have a specified line width
m_PrintScale = 1.0;
m_XScaleAdjust = 1.0;
@ -290,9 +290,6 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
GRResetPenAndBrush( dc );
if( m_PrintParams.m_Print_Black_and_White )
GRForceBlackPen( true );
EDA_DRAW_PANEL* panel = m_Parent->GetCanvas();
EDA_RECT tmp = *panel->GetClipBox();
@ -358,15 +355,26 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
{
// Creates a "local" black background
GRForceBlackPen( true );
m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams );
m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer,
printMirror, &m_PrintParams );
GRForceBlackPen( false );
}
if( m_PrintParams.m_Print_Black_and_White )
GRForceBlackPen( true );
if( m_PrintParams.PrintBorderAndTitleBlock() )
m_Parent->DrawWorkSheet( dc, screen, m_PrintParams.m_PenDefaultSize,
IU_PER_MILS, titleblockFilename );
m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams );
#if defined (GERBVIEW)
// In B&W mode, do not force black pen for Gerbview
// because negative objects need a white pen, not a black pen
// B&W mode is handled in print page
GRForceBlackPen( false );
#endif
m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror,
&m_PrintParams );
g_DrawBgColor = bg_color;
screen->m_IsPrinting = false;