Commit 768ec258 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Encapsulate LABEL_OBJECT class and message panel window member of EDA_DRAW_FRAME.

parent 0498f265
...@@ -97,7 +97,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti ...@@ -97,7 +97,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti
m_HotkeysZoomAndGridList = NULL; m_HotkeysZoomAndGridList = NULL;
DrawPanel = NULL; DrawPanel = NULL;
MsgPanel = NULL; m_messagePanel = NULL;
m_currentScreen = NULL; m_currentScreen = NULL;
m_toolId = ID_NO_TOOL_SELECTED; m_toolId = ID_NO_TOOL_SELECTED;
m_ID_last_state = ID_NO_TOOL_SELECTED; m_ID_last_state = ID_NO_TOOL_SELECTED;
...@@ -148,12 +148,12 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti ...@@ -148,12 +148,12 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti
m_FrameSize.y -= m_MsgFrameHeight; m_FrameSize.y -= m_MsgFrameHeight;
DrawPanel = new EDA_DRAW_PANEL( this, -1, wxPoint( 0, 0 ), m_FrameSize ); DrawPanel = new EDA_DRAW_PANEL( this, -1, wxPoint( 0, 0 ), m_FrameSize );
MsgPanel = new EDA_MSG_PANEL( this, -1, wxPoint( 0, m_FrameSize.y ), m_messagePanel = new EDA_MSG_PANEL( this, -1, wxPoint( 0, m_FrameSize.y ),
wxSize( m_FrameSize.x, m_MsgFrameHeight ) ); wxSize( m_FrameSize.x, m_MsgFrameHeight ) );
MsgPanel->SetBackgroundColour( wxColour( ColorRefs[LIGHTGRAY].m_Red, m_messagePanel->SetBackgroundColour( wxColour( ColorRefs[LIGHTGRAY].m_Red,
ColorRefs[LIGHTGRAY].m_Green, ColorRefs[LIGHTGRAY].m_Green,
ColorRefs[LIGHTGRAY].m_Blue ) ); ColorRefs[LIGHTGRAY].m_Blue ) );
} }
...@@ -178,8 +178,8 @@ void EDA_DRAW_FRAME::unitsChangeRefresh() ...@@ -178,8 +178,8 @@ void EDA_DRAW_FRAME::unitsChangeRefresh()
void EDA_DRAW_FRAME::EraseMsgBox() void EDA_DRAW_FRAME::EraseMsgBox()
{ {
if( MsgPanel ) if( m_messagePanel )
MsgPanel->EraseMsgBox(); m_messagePanel->EraseMsgBox();
} }
...@@ -872,19 +872,19 @@ void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper, ...@@ -872,19 +872,19 @@ void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper,
const wxString& textLower, const wxString& textLower,
int color, int pad ) int color, int pad )
{ {
if( MsgPanel == NULL ) if( m_messagePanel == NULL )
return; return;
MsgPanel->AppendMessage( textUpper, textLower, color, pad ); m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
} }
void EDA_DRAW_FRAME::ClearMsgPanel( void ) void EDA_DRAW_FRAME::ClearMsgPanel( void )
{ {
if( MsgPanel == NULL ) if( m_messagePanel == NULL )
return; return;
MsgPanel->EraseMsgBox(); m_messagePanel->EraseMsgBox();
} }
......
/**********************/ /*
/** displayframe.cpp **/ * This program source code file is part of KiCad, a free EDA CAD application.
/**********************/ *
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2007-2011 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
*/
/**
* @file class_DisplayFootprintsFrame.cpp
*/
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
...@@ -106,7 +131,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father, ...@@ -106,7 +131,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
m_auimgr.AddPane( DrawPanel, m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DisplayFrame" ) ).CentrePane() ); wxAuiPaneInfo().Name( wxT( "DisplayFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel, m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
m_auimgr.AddPane( m_OptionsToolBar, m_auimgr.AddPane( m_OptionsToolBar,
...@@ -133,7 +158,8 @@ DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME() ...@@ -133,7 +158,8 @@ DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME()
void DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow( wxCloseEvent& event ) void DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow( wxCloseEvent& event )
{ {
if( m_Draw3DFrame ) if( m_Draw3DFrame )
m_Draw3DFrame->Close(true); m_Draw3DFrame->Close( true );
SaveSettings(); SaveSettings();
Destroy(); Destroy();
} }
...@@ -406,6 +432,7 @@ void DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame( wxCommandEvent& event ) ...@@ -406,6 +432,7 @@ void DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame( wxCommandEvent& event )
// This should work on any platform. // This should work on any platform.
if( m_Draw3DFrame->IsIconized() ) if( m_Draw3DFrame->IsIconized() )
m_Draw3DFrame->Iconize( false ); m_Draw3DFrame->Iconize( false );
m_Draw3DFrame->Raise(); m_Draw3DFrame->Raise();
// Raising the window does not set the focus on Linux. This should work on any platform. // Raising the window does not set the focus on Linux. This should work on any platform.
......
...@@ -41,13 +41,14 @@ ...@@ -41,13 +41,14 @@
#include "template_fieldnames.h" #include "template_fieldnames.h"
#include "netlist.h" #include "netlist.h"
/* Fill aList with labels /* Fill aList with labels
*/ */
void GenListeGLabels( LABEL_OBJECT_LIST& aList ) void GenListeGLabels( BOM_LABEL_LIST& aList )
{ {
// Build the sheet list // Build the sheet list
SCH_SHEET_LIST sheetList; SCH_SHEET_LIST sheetList;
LABEL_OBJECT label; BOM_LABEL label;
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() ) for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() )
{ {
...@@ -59,10 +60,7 @@ void GenListeGLabels( LABEL_OBJECT_LIST& aList ) ...@@ -59,10 +60,7 @@ void GenListeGLabels( LABEL_OBJECT_LIST& aList )
{ {
case SCH_HIERARCHICAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
label.m_LabelType = schItem->Type(); aList.push_back( BOM_LABEL( schItem->Type(), schItem, *path ) );
label.m_SheetPath = *path;
label.m_Label = schItem;
aList.push_back( label );
break; break;
case SCH_SHEET_T: case SCH_SHEET_T:
...@@ -71,10 +69,7 @@ void GenListeGLabels( LABEL_OBJECT_LIST& aList ) ...@@ -71,10 +69,7 @@ void GenListeGLabels( LABEL_OBJECT_LIST& aList )
BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, sheet->GetPins() ) BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, sheet->GetPins() )
{ {
label.m_LabelType = SCH_SHEET_PIN_T; aList.push_back( BOM_LABEL( SCH_SHEET_PIN_T, &sheetPin, *path ) );
label.m_SheetPath = *path;
label.m_Label = &sheetPin;
aList.push_back( label );
} }
} }
break; break;
...@@ -88,31 +83,21 @@ void GenListeGLabels( LABEL_OBJECT_LIST& aList ) ...@@ -88,31 +83,21 @@ void GenListeGLabels( LABEL_OBJECT_LIST& aList )
} }
} }
/* compare function for sorting labels /* compare function for sorting labels
* sort by * sort by
* value * value
* if same value: by sheet * if same value: by sheet
*/ */
bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 ) bool SortLabelsByValue( const BOM_LABEL& obj1, const BOM_LABEL& obj2 )
{ {
int ii; int ii;
wxString* Text1, * Text2;
if( obj1.m_LabelType == SCH_SHEET_PIN_T )
Text1 = &( (SCH_SHEET_PIN*)(obj1.m_Label) )->m_Text;
else
Text1 = &( (SCH_TEXT*)(obj1.m_Label) )->m_Text;
if( obj2.m_LabelType == SCH_SHEET_PIN_T )
Text2 = &( (SCH_SHEET_PIN*)(obj2.m_Label) )->m_Text;
else
Text2 = &( (SCH_TEXT*)(obj2.m_Label) )->m_Text;
ii = Text1->CmpNoCase( *Text2 ); ii = obj1.GetText().CmpNoCase( obj2.GetText() );
if( ii == 0 ) if( ii == 0 )
{ {
ii = obj1.m_SheetPath.Cmp( obj2.m_SheetPath ); ii = obj1.GetSheetPath().Cmp( obj2.GetSheetPath() );
} }
return ii < 0; return ii < 0;
...@@ -123,33 +108,22 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 ) ...@@ -123,33 +108,22 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
* by sheet * by sheet
* in a sheet, by alphabetic order * in a sheet, by alphabetic order
*/ */
bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 ) bool SortLabelsBySheet( const BOM_LABEL& obj1, const BOM_LABEL& obj2 )
{ {
int ii; int ii;
wxString Text1, Text2;
ii = obj1.m_SheetPath.Cmp( obj2.m_SheetPath ); ii = obj1.GetSheetPath().Cmp( obj2.GetSheetPath() );
if( ii == 0 ) if( ii == 0 )
{ {
if( obj1.m_LabelType == SCH_SHEET_PIN_T ) ii = obj1.GetText().CmpNoCase( obj2.GetText() );
Text1 = ( (SCH_SHEET_PIN*) obj1.m_Label )->m_Text;
else
Text1 = ( (SCH_TEXT*) obj1.m_Label )->m_Text;
if( obj2.m_LabelType == SCH_SHEET_PIN_T )
Text2 = ( (SCH_SHEET_PIN*) obj2.m_Label )->m_Text;
else
Text2 = ( (SCH_TEXT*) obj2.m_Label )->m_Text;
ii = Text1.CmpNoCase( Text2 );
} }
return ii < 0; return ii < 0;
} }
int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList ) int PrintListeGLabel( FILE* f, BOM_LABEL_LIST& aList )
{ {
SCH_LABEL* label; SCH_LABEL* label;
SCH_SHEET_PIN* pinsheet; SCH_SHEET_PIN* pinsheet;
...@@ -158,20 +132,20 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList ) ...@@ -158,20 +132,20 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
for( unsigned ii = 0; ii < aList.size(); ii++ ) for( unsigned ii = 0; ii < aList.size(); ii++ )
{ {
switch( aList[ii].m_LabelType ) switch( aList[ii].GetType() )
{ {
case SCH_HIERARCHICAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
label = (SCH_LABEL*)(aList[ii].m_Label); label = (SCH_LABEL*)(aList[ii].GetLabel());
if( aList[ii].m_LabelType == SCH_HIERARCHICAL_LABEL_T ) if( aList[ii].GetType() == SCH_HIERARCHICAL_LABEL_T )
labeltype = wxT( "Hierarchical" ); labeltype = wxT( "Hierarchical" );
else else
labeltype = wxT( "Global " ); labeltype = wxT( "Global " );
sheetpath = aList[ii].m_SheetPath.PathHumanReadable(); sheetpath = aList[ii].GetSheetPath().PathHumanReadable();
msg.Printf( _( "> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n" ), msg.Printf( _( "> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n" ),
GetChars( label->m_Text ), GetChars( label->GetText() ),
GetChars( labeltype ), GetChars( labeltype ),
GetChars( sheetpath ), GetChars( sheetpath ),
(float) label->m_Pos.x / 1000, (float) label->m_Pos.x / 1000,
...@@ -182,7 +156,7 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList ) ...@@ -182,7 +156,7 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
case SCH_SHEET_PIN_T: case SCH_SHEET_PIN_T:
{ {
pinsheet = (SCH_SHEET_PIN*) aList[ii].m_Label; pinsheet = (SCH_SHEET_PIN*) aList[ii].GetLabel();
int jj = pinsheet->GetShape(); int jj = pinsheet->GetShape();
if( jj < 0 ) if( jj < 0 )
...@@ -194,14 +168,15 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList ) ...@@ -194,14 +168,15 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
wxString labtype = FROM_UTF8( SheetLabelType[jj] ); wxString labtype = FROM_UTF8( SheetLabelType[jj] );
msg.Printf( _( "> %-28.28s PinSheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ), msg.Printf( _( "> %-28.28s PinSheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ),
GetChars( pinsheet->m_Text ), GetChars( pinsheet->GetText() ),
GetChars( labtype ), GetChars( labtype ),
GetChars( aList[ii].m_SheetPath.PathHumanReadable() ), GetChars( aList[ii].GetSheetPath().PathHumanReadable() ),
(float) pinsheet->m_Pos.x / 1000, (float) pinsheet->m_Pos.x / 1000,
(float) pinsheet->m_Pos.y / 1000 ); (float) pinsheet->m_Pos.y / 1000 );
fputs( TO_UTF8( msg ), f ); fputs( TO_UTF8( msg ), f );
} }
break; break;
default: default:
......
///////////////////////////////////////////////////////////////////////////// /*
// Name: dialog_build_BOM.cpp * This program source code file is part of KiCad, a free EDA CAD application.
// Author: jean-pierre Charras *
// Modified by: * Copyright (C) 2008 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
// Licence: GPL * Copyright (C) 1992-2011 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
*/
/**
* @file dialog_build_BOM.cpp
*/
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
...@@ -29,10 +49,10 @@ ...@@ -29,10 +49,10 @@
#include "protos.h" #include "protos.h"
extern void GenListeGLabels( std::vector <LABEL_OBJECT>& aList ); extern void GenListeGLabels( std::vector <BOM_LABEL>& aList );
extern bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 ); extern bool SortLabelsByValue( const BOM_LABEL& obj1, const BOM_LABEL& obj2 );
extern bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 ); extern bool SortLabelsBySheet( const BOM_LABEL& obj1, const BOM_LABEL& obj2 );
extern int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList ); extern int PrintListeGLabel( FILE* f, std::vector <BOM_LABEL>& aList );
/* Local variables */ /* Local variables */
...@@ -503,9 +523,10 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName, ...@@ -503,9 +523,10 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
/*************************************************/ /*************************************************/
/* Create list of global labels and pins sheets */ /* Create list of global labels and pins sheets */
/*************************************************/ /*************************************************/
std::vector <LABEL_OBJECT> listOfLabels; std::vector <BOM_LABEL> listOfLabels;
GenListeGLabels( listOfLabels ); GenListeGLabels( listOfLabels );
if( ( itemCount = listOfLabels.size() ) > 0 ) if( ( itemCount = listOfLabels.size() ) > 0 )
{ {
if( m_GenListLabelsbySheet->GetValue() ) if( m_GenListLabelsbySheet->GetValue() )
...@@ -610,10 +631,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem, ...@@ -610,10 +631,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
/* Print the B.O.M sorted by reference /* Print the B.O.M sorted by reference
*/ */
int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f, int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
SCH_REFERENCE_LIST& aList, SCH_REFERENCE_LIST& aList,
bool CompactForm, bool CompactForm,
bool aIncludeSubComponents ) bool aIncludeSubComponents )
{ {
wxString msg; wxString msg;
...@@ -659,6 +680,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f, ...@@ -659,6 +680,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
std::string CmpName; std::string CmpName;
wxString subRef; wxString subRef;
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
wxString strCur; wxString strCur;
wxString strPred; wxString strPred;
...@@ -683,6 +705,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f, ...@@ -683,6 +705,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
bool isMulti = false; bool isMulti = false;
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( comp->GetLibName() ); LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( comp->GetLibName() );
if( entry ) if( entry )
isMulti = entry->IsMulti(); isMulti = entry->IsMulti();
...@@ -748,35 +771,46 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f, ...@@ -748,35 +771,46 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
wxString tmpStr = PrintFieldData( comp, CompactForm ); wxString tmpStr = PrintFieldData( comp, CompactForm );
strCur += tmpStr; strCur += tmpStr;
if ( CompactForm ) if ( CompactForm )
{ {
if ( strPred.Len() == 0 ) if ( strPred.Len() == 0 )
CmpNameFirst = CmpName; {
else CmpNameFirst = CmpName;
{ }
if ( !strCur.IsSameAs(strPred) ) else
{ {
switch (amount) if ( !strCur.IsSameAs(strPred) )
{ {
case 1: fprintf( f, "%s%s%c%d\n", CmpNameFirst.c_str(), TO_UTF8(strPred), s_ExportSeparatorSymbol, amount ); switch (amount)
{
case 1:
fprintf( f, "%s%s%c%d\n", CmpNameFirst.c_str(), TO_UTF8( strPred ),
s_ExportSeparatorSymbol, amount );
break; break;
case 2: fprintf( f, "%s,%s%s%c%d\n",CmpNameFirst.c_str(), CmpNameLast.c_str(), TO_UTF8(strPred), s_ExportSeparatorSymbol, amount );
case 2:
fprintf( f, "%s,%s%s%c%d\n", CmpNameFirst.c_str(), CmpNameLast.c_str(),
TO_UTF8(strPred), s_ExportSeparatorSymbol, amount );
break; break;
default:fprintf( f, "%s..%s%s%c%d\n", CmpNameFirst.c_str(), CmpNameLast.c_str(), TO_UTF8(strPred), s_ExportSeparatorSymbol, amount );
default:
fprintf( f, "%s..%s%s%c%d\n", CmpNameFirst.c_str(), CmpNameLast.c_str(),
TO_UTF8( strPred ), s_ExportSeparatorSymbol, amount );
break; break;
} }
CmpNameFirst = CmpName; CmpNameFirst = CmpName;
amount = 0; amount = 0;
}
} }
} strPred = strCur;
strPred = strCur; CmpNameLast = CmpName;
CmpNameLast = CmpName; amount++;
amount++;
} }
else else
{ {
fprintf( f, "%s", TO_UTF8( tmpStr ) ); fprintf( f, "%s", TO_UTF8( tmpStr ) );
fprintf( f, "\n" ); fprintf( f, "\n" );
} }
#else #else
PrintFieldData( f, comp, CompactForm ); PrintFieldData( f, comp, CompactForm );
...@@ -796,12 +830,20 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f, ...@@ -796,12 +830,20 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
{ {
switch (amount) switch (amount)
{ {
case 1: fprintf( f, "%s%s%c%d\n", CmpNameFirst.c_str(), TO_UTF8(strPred), s_ExportSeparatorSymbol, amount ); case 1:
break; fprintf( f, "%s%s%c%d\n", CmpNameFirst.c_str(), TO_UTF8( strPred ),
case 2: fprintf( f, "%s,%s%s%c%d\n", CmpNameFirst.c_str(), CmpNameLast.c_str(), TO_UTF8(strPred), s_ExportSeparatorSymbol, amount ); s_ExportSeparatorSymbol, amount );
break; break;
default:fprintf( f, "%s..%s%s%c%d\n", CmpNameFirst.c_str(), CmpNameLast.c_str(), TO_UTF8(strPred), s_ExportSeparatorSymbol, amount );
break; case 2:
fprintf( f, "%s,%s%s%c%d\n", CmpNameFirst.c_str(), CmpNameLast.c_str(),
TO_UTF8( strPred ), s_ExportSeparatorSymbol, amount );
break;
default:
fprintf( f, "%s..%s%s%c%d\n", CmpNameFirst.c_str(), CmpNameLast.c_str(),
TO_UTF8( strPred ), s_ExportSeparatorSymbol, amount );
break;
} }
} }
#endif #endif
...@@ -862,6 +904,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* f, SCH_REFERENCE_LIST& aL ...@@ -862,6 +904,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* f, SCH_REFERENCE_LIST& aL
refName = aList[ii].GetRef(); refName = aList[ii].GetRef();
valName = currCmp->GetField( VALUE )->m_Text; valName = currCmp->GetField( VALUE )->m_Text;
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
footName = currCmp->GetField( FOOTPRINT )->m_Text; footName = currCmp->GetField( FOOTPRINT )->m_Text;
datsName = currCmp->GetField( DATASHEET )->m_Text; datsName = currCmp->GetField( DATASHEET )->m_Text;
...@@ -931,8 +974,10 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* f, SCH_REFERENCE_LIST& aL ...@@ -931,8 +974,10 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* f, SCH_REFERENCE_LIST& aL
int last_nonempty_field_idx = 0; int last_nonempty_field_idx = 0;
for( int jj = FOOTPRINT; jj < dummyCmp.GetFieldCount(); jj++ ) for( int jj = FOOTPRINT; jj < dummyCmp.GetFieldCount(); jj++ )
{
if ( !dummyCmp.GetField( jj )->m_Text.IsEmpty() ) if ( !dummyCmp.GetField( jj )->m_Text.IsEmpty() )
last_nonempty_field_idx = jj; last_nonempty_field_idx = jj;
}
for( int jj = FIELD1; jj <= last_nonempty_field_idx ; jj++ ) for( int jj = FIELD1; jj <= last_nonempty_field_idx ; jj++ )
{ {
...@@ -1010,6 +1055,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f, ...@@ -1010,6 +1055,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
if( aIncludeSubComponents ) if( aIncludeSubComponents )
{ {
BASE_SCREEN * screen = (BASE_SCREEN*) DrawLibItem->GetParent(); BASE_SCREEN * screen = (BASE_SCREEN*) DrawLibItem->GetParent();
if( screen ) if( screen )
{ {
msg = aList[ii].GetSheetPath().PathHumanReadable(); msg = aList[ii].GetSheetPath().PathHumanReadable();
......
...@@ -259,7 +259,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, ...@@ -259,7 +259,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
m_auimgr.AddPane( DrawPanel, m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel, m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
m_auimgr.Update(); m_auimgr.Update();
......
...@@ -83,6 +83,14 @@ void dumpNetTable() ...@@ -83,6 +83,14 @@ void dumpNetTable()
#endif #endif
wxString BOM_LABEL::GetText() const
{
const SCH_TEXT* tmp = (SCH_TEXT*) m_label;
return tmp->GetText();
}
/* /*
* Routine to free memory used to calculate the netlist TabNetItems = pointer * Routine to free memory used to calculate the netlist TabNetItems = pointer
* to the main table (list items) * to the main table (list items)
......
/**
* @file netlist.h
*/
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
...@@ -28,6 +24,10 @@ ...@@ -28,6 +24,10 @@
*/ */
/**
* @file netlist.h
*/
#ifndef _NETLIST_H_ #ifndef _NETLIST_H_
#define _NETLIST_H_ #define _NETLIST_H_
...@@ -50,6 +50,7 @@ class SCH_REFERENC_LIST; ...@@ -50,6 +50,7 @@ class SCH_REFERENC_LIST;
/* Max pin number per component and footprint */ /* Max pin number per component and footprint */
#define MAXPIN 5000 #define MAXPIN 5000
/** /**
* Class SCH_REFERENCE * Class SCH_REFERENCE
* is used as a helper to define a component's reference designator in a schematic. This * is used as a helper to define a component's reference designator in a schematic. This
...@@ -471,26 +472,40 @@ private: ...@@ -471,26 +472,40 @@ private:
/** /**
* helper Class LABEL_OBJECT * Class BOM_LABEL
* is used in build BOM to handle the list of labels in schematic * is used to build a BOM by handling the list of labels in schematic because in a
* because in a complex hierarchy, a label is used more than once, * complex hierarchy, a label is used more than once and has more than one sheet path
* and had more than one sheet path, so we must create a flat list of labels * so we must create a flat list of labels.
*/ */
class LABEL_OBJECT class BOM_LABEL
{ {
public: KICAD_T m_type;
int m_LabelType; SCH_ITEM* m_label;
SCH_ITEM* m_Label;
// have to store it here since the object references will be duplicated.
SCH_SHEET_PATH m_sheetPath; //composed of UIDs
//have to store it here since the object references will be duplicated. static SCH_SHEET_PATH emptySheetPath;
SCH_SHEET_PATH m_SheetPath; //composed of UIDs
public: LABEL_OBJECT() public:
BOM_LABEL( KICAD_T aType = TYPE_NOT_INIT, SCH_ITEM* aLabel = NULL,
const SCH_SHEET_PATH& aSheetPath = emptySheetPath )
: m_type( aType )
, m_label( aLabel )
, m_sheetPath( aSheetPath )
{ {
m_Label = NULL;
m_LabelType = 0;
} }
KICAD_T GetType() const { return m_type; }
const SCH_ITEM* GetLabel() const { return m_label; }
const SCH_SHEET_PATH& GetSheetPath() const { return m_sheetPath; }
wxString GetText() const;
}; };
typedef std::vector <LABEL_OBJECT> LABEL_OBJECT_LIST;
#endif
typedef std::vector <BOM_LABEL> BOM_LABEL_LIST;
#endif // _NETLIST_H_
...@@ -264,9 +264,9 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father, ...@@ -264,9 +264,9 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
if( DrawPanel ) if( DrawPanel )
m_auimgr.AddPane( DrawPanel, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); m_auimgr.AddPane( DrawPanel, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( MsgPanel ) if( m_messagePanel )
m_auimgr.AddPane( MsgPanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom(). m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().
Layer(10) ); Layer(10) );
m_auimgr.Update(); m_auimgr.Update();
......
...@@ -231,7 +231,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph ...@@ -231,7 +231,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).Centre() ); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).Centre() );
// Manage the message panel // Manage the message panel
m_auimgr.AddPane( MsgPanel, m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
/* Now the minimum windows are fixed, set library list /* Now the minimum windows are fixed, set library list
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1994 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 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
*/
/** /**
* @file gerbview_frame.cpp * @file gerbview_frame.cpp
*/ */
...@@ -27,9 +52,9 @@ const wxString GerbviewShowPageSizeOption( wxT( "ShowPageSizeOpt" ) ); ...@@ -27,9 +52,9 @@ const wxString GerbviewShowPageSizeOption( wxT( "ShowPageSizeOpt" ) );
const wxString GerbviewShowDCodes( wxT( "ShowDCodesOpt" ) ); const wxString GerbviewShowDCodes( wxT( "ShowDCodesOpt" ) );
/****************************************/ /*************************************/
/* class GERBVIEW_FRAME for GerbView*/ /* class GERBVIEW_FRAME for GerbView */
/****************************************/ /*************************************/
GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father, GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
...@@ -122,8 +147,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father, ...@@ -122,8 +147,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
m_auimgr.AddPane( DrawPanel, m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( MsgPanel ) if( m_messagePanel )
m_auimgr.AddPane( MsgPanel, m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
ReFillLayerWidget(); // this is near end because contents establish size ReFillLayerWidget(); // this is near end because contents establish size
......
/************************************************/ /*
/* Locate items at the current cursor position. */ * This program source code file is part of KiCad, a free EDA CAD application.
/************************************************/ *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2011 KiCad Developers, see change_log.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
*/
/**
* @file locate.cpp
*/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
...@@ -12,7 +36,7 @@ ...@@ -12,7 +36,7 @@
*/ */
GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc ) GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc )
{ {
MsgPanel->EraseMsgBox(); m_messagePanel->EraseMsgBox();
wxPoint ref = aPosition; wxPoint ref = aPosition;
bool found = false; bool found = false;
......
...@@ -152,6 +152,32 @@ protected: ...@@ -152,6 +152,32 @@ protected:
*/ */
virtual bool isAutoSaveRequired() const; virtual bool isAutoSaveRequired() const;
/**
* Function propagate
* Used now only in autoplace calculations
* Uses the routing matrix to fill the cells within the zone
* Search and mark cells within the zone, and agree with DRC options.
* Requirements:
* Start from an initial point, to fill zone
* The zone must have no "copper island"
* Algorithm:
* If the current cell has a neighbor flagged as "cell in the zone", it
* become a cell in the zone
* The first point in the zone is the starting point
* 4 searches within the matrix are made:
* 1 - Left to right and top to bottom
* 2 - Right to left and top to bottom
* 3 - bottom to top and Right to left
* 4 - bottom to top and Left to right
* Given the current cell, for each search, we consider the 2 neighbor cells
* the previous cell on the same line and the previous cell on the same column.
*
* This function can request some iterations
* Iterations are made until no cell is added to the zone.
* @return: added cells count (i.e. which the attribute CELL_is_ZONE is set)
*/
int propagate();
public: public:
LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
wxComboBox* m_SelTrackWidthBox; // a combo box to display and select current track width wxComboBox* m_SelTrackWidthBox; // a combo box to display and select current track width
......
...@@ -371,12 +371,11 @@ public: ...@@ -371,12 +371,11 @@ public:
*/ */
class EDA_DRAW_FRAME : public EDA_BASE_FRAME class EDA_DRAW_FRAME : public EDA_BASE_FRAME
{ {
int m_toolId; ///< Id of active button on the vertical toolbar. ///< Id of active button on the vertical toolbar.
int m_toolId;
public: public:
EDA_DRAW_PANEL* DrawPanel; // Draw area EDA_DRAW_PANEL* DrawPanel; // Draw area
EDA_MSG_PANEL* MsgPanel; // Panel used to display some
// info (bottom of the screen)
EDA_TOOLBAR* m_VToolBar; // Vertical (right side) Toolbar EDA_TOOLBAR* m_VToolBar; // Vertical (right side) Toolbar
EDA_TOOLBAR* m_AuxVToolBar; // Auxiliary Vertical (right side) EDA_TOOLBAR* m_AuxVToolBar; // Auxiliary Vertical (right side)
// Toolbar // Toolbar
...@@ -416,6 +415,9 @@ protected: ...@@ -416,6 +415,9 @@ protected:
bool m_DrawGrid; // hide/Show grid bool m_DrawGrid; // hide/Show grid
int m_GridColor; // Grid color int m_GridColor; // Grid color
/// Panel used to display information at the bottom of the main window.
EDA_MSG_PANEL* m_messagePanel;
private: private:
BASE_SCREEN* m_currentScreen; ///< current used SCREEN BASE_SCREEN* m_currentScreen; ///< current used SCREEN
bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid. bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -437,25 +437,25 @@ int PCB_EDIT_FRAME::GenPlaceBoard() ...@@ -437,25 +437,25 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
Ncols += 2; Nrows += 2; Ncols += 2; Nrows += 2;
NbCells = Ncols * Nrows; NbCells = Ncols * Nrows;
MsgPanel->EraseMsgBox(); m_messagePanel->EraseMsgBox();
msg.Printf( wxT( "%d" ), Ncols ); msg.Printf( wxT( "%d" ), Ncols );
MsgPanel->SetMessage( 1, _( "Cols" ), msg, GREEN ); m_messagePanel->SetMessage( 1, _( "Cols" ), msg, GREEN );
msg.Printf( wxT( "%d" ), Nrows ); msg.Printf( wxT( "%d" ), Nrows );
MsgPanel->SetMessage( 7, _( "Lines" ), msg, GREEN ); m_messagePanel->SetMessage( 7, _( "Lines" ), msg, GREEN );
msg.Printf( wxT( "%d" ), NbCells ); msg.Printf( wxT( "%d" ), NbCells );
MsgPanel->SetMessage( 14, _( "Cells." ), msg, YELLOW ); m_messagePanel->SetMessage( 14, _( "Cells." ), msg, YELLOW );
/* Choose the number of board sides. */ /* Choose the number of board sides. */
Nb_Sides = TWO_SIDES; Nb_Sides = TWO_SIDES;
MsgPanel->SetMessage( 22, wxT( "S" ), ( Nb_Sides == TWO_SIDES ) ? wxT( "2" ) : wxT( "1" ), m_messagePanel->SetMessage( 22, wxT( "S" ),
WHITE ); ( Nb_Sides == TWO_SIDES ) ? wxT( "2" ) : wxT( "1" ), WHITE );
Board.InitBoard(); Board.InitBoard();
/* Display memory usage. */ /* Display memory usage. */
msg.Printf( wxT( "%d" ), Board.m_MemSize / 1024 ); msg.Printf( wxT( "%d" ), Board.m_MemSize / 1024 );
MsgPanel->SetMessage( 24, wxT( "Mem(Kb)" ), msg, CYAN ); m_messagePanel->SetMessage( 24, wxT( "Mem(Kb)" ), msg, CYAN );
Route_Layer_BOTTOM = LAYER_N_FRONT; Route_Layer_BOTTOM = LAYER_N_FRONT;
...@@ -509,8 +509,8 @@ int PCB_EDIT_FRAME::GenPlaceBoard() ...@@ -509,8 +509,8 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
while( ii ) while( ii )
{ {
msg.Printf( wxT( "%d" ), jj++ ); msg.Printf( wxT( "%d" ), jj++ );
MsgPanel->SetMessage( 50, _( "Loop" ), msg, CYAN ); m_messagePanel->SetMessage( 50, _( "Loop" ), msg, CYAN );
ii = Propagation( this ); ii = propagate();
} }
/* Initialize top layer. */ /* Initialize top layer. */
...@@ -1157,31 +1157,7 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC ) ...@@ -1157,31 +1157,7 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
} }
/** int PCB_EDIT_FRAME::propagate()
* Function Propagation
* Used now only in autoplace calculations
* Uses the routing matrix to fill the cells within the zone
* Search and mark cells within the zone, and agree with DRC options.
* Requirements:
* Start from an initial point, to fill zone
* The zone must have no "copper island"
* Algorithm:
* If the current cell has a neighbor flagged as "cell in the zone", it
* become a cell in the zone
* The first point in the zone is the starting point
* 4 searches within the matrix are made:
* 1 - Left to right and top to bottom
* 2 - Right to left and top to bottom
* 3 - bottom to top and Right to left
* 4 - bottom to top and Left to right
* Given the current cell, for each search, we consider the 2 neighbor cells
* the previous cell on the same line and the previous cell on the same column.
*
* This function can request some iterations
* Iterations are made until no cell is added to the zone.
* @return: added cells count (i.e. which the attribute CELL_is_ZONE is set)
*/
int Propagation( PCB_EDIT_FRAME* frame )
{ {
int row, col; int row, col;
long current_cell, old_cell_H; long current_cell, old_cell_H;
...@@ -1191,8 +1167,8 @@ int Propagation( PCB_EDIT_FRAME* frame ) ...@@ -1191,8 +1167,8 @@ int Propagation( PCB_EDIT_FRAME* frame )
#define NO_CELL_ZONE (HOLE | CELL_is_EDGE | CELL_is_ZONE) #define NO_CELL_ZONE (HOLE | CELL_is_EDGE | CELL_is_ZONE)
wxString msg; wxString msg;
frame->MsgPanel->SetMessage( 57, wxT( "Detect" ), msg, CYAN ); m_messagePanel->SetMessage( 57, wxT( "Detect" ), msg, CYAN );
frame->MsgPanel->SetMessage( -1, wxEmptyString, wxT( "1" ), CYAN ); m_messagePanel->SetMessage( -1, wxEmptyString, wxT( "1" ), CYAN );
pt_cell_V.reserve( MAX( Nrows, Ncols ) ); pt_cell_V.reserve( MAX( Nrows, Ncols ) );
fill( pt_cell_V.begin(), pt_cell_V.end(), 0 ); fill( pt_cell_V.begin(), pt_cell_V.end(), 0 );
...@@ -1221,7 +1197,7 @@ int Propagation( PCB_EDIT_FRAME* frame ) ...@@ -1221,7 +1197,7 @@ int Propagation( PCB_EDIT_FRAME* frame )
} }
// Search from right to left and top to bottom/ // Search from right to left and top to bottom/
frame->MsgPanel->SetMessage( -1, wxEmptyString, wxT( "2" ), CYAN ); m_messagePanel->SetMessage( -1, wxEmptyString, wxT( "2" ), CYAN );
fill( pt_cell_V.begin(), pt_cell_V.end(), 0 ); fill( pt_cell_V.begin(), pt_cell_V.end(), 0 );
for( row = 0; row < Nrows; row++ ) for( row = 0; row < Nrows; row++ )
...@@ -1247,7 +1223,7 @@ int Propagation( PCB_EDIT_FRAME* frame ) ...@@ -1247,7 +1223,7 @@ int Propagation( PCB_EDIT_FRAME* frame )
} }
// Search from bottom to top and right to left. // Search from bottom to top and right to left.
frame->MsgPanel->SetMessage( -1, wxEmptyString, wxT( "3" ), CYAN ); m_messagePanel->SetMessage( -1, wxEmptyString, wxT( "3" ), CYAN );
fill( pt_cell_V.begin(), pt_cell_V.end(), 0 ); fill( pt_cell_V.begin(), pt_cell_V.end(), 0 );
for( col = Ncols - 1; col >= 0; col-- ) for( col = Ncols - 1; col >= 0; col-- )
...@@ -1273,7 +1249,7 @@ int Propagation( PCB_EDIT_FRAME* frame ) ...@@ -1273,7 +1249,7 @@ int Propagation( PCB_EDIT_FRAME* frame )
} }
// Search from bottom to top and left to right. // Search from bottom to top and left to right.
frame->MsgPanel->SetMessage( -1, wxEmptyString, wxT( "4" ), CYAN ); m_messagePanel->SetMessage( -1, wxEmptyString, wxT( "4" ), CYAN );
fill( pt_cell_V.begin(), pt_cell_V.end(), 0 ); fill( pt_cell_V.begin(), pt_cell_V.end(), 0 );
for( col = 0; col < Ncols; col++ ) for( col = 0; col < Ncols; col++ )
......
...@@ -152,7 +152,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) ...@@ -152,7 +152,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
/* Calculated ncol and nrow, matrix size for routing. */ /* Calculated ncol and nrow, matrix size for routing. */
Board.ComputeMatrixSize( GetBoard() ); Board.ComputeMatrixSize( GetBoard() );
MsgPanel->EraseMsgBox(); m_messagePanel->EraseMsgBox();
/* Map the board */ /* Map the board */
Nb_Sides = ONE_SIDE; Nb_Sides = ONE_SIDE;
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2010 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see change_log.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
*/
/** /**
* @file clean.cpp * @file clean.cpp
* @brief functions to clean tracks: remove null lenght and redundant segments * @brief functions to clean tracks: remove null lenght and redundant segments
...@@ -16,7 +41,8 @@ ...@@ -16,7 +41,8 @@
static void clean_segments( PCB_EDIT_FRAME* aFrame ); static void clean_segments( PCB_EDIT_FRAME* aFrame );
static void clean_vias( BOARD* aPcb ); static void clean_vias( BOARD* aPcb );
static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame ); static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame );
static TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef, TRACK* aCandidate, int aEndType ); static TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef,
TRACK* aCandidate, int aEndType );
static void CleanupTracks( PCB_EDIT_FRAME* aFrame, static void CleanupTracks( PCB_EDIT_FRAME* aFrame,
bool aCleanVias, bool aMergeSegments, bool aCleanVias, bool aMergeSegments,
bool aDeleteUnconnectedSegm, bool aConnectToPads ); bool aDeleteUnconnectedSegm, bool aConnectToPads );
...@@ -40,7 +66,7 @@ void PCB_EDIT_FRAME::Clean_Pcb( wxDC* DC ) ...@@ -40,7 +66,7 @@ void PCB_EDIT_FRAME::Clean_Pcb( wxDC* DC )
if( dlg.ShowModal() == wxID_OK ) if( dlg.ShowModal() == wxID_OK )
CleanupTracks( this, dlg.cleanVias, dlg.mergeSegments, CleanupTracks( this, dlg.cleanVias, dlg.mergeSegments,
dlg.deleteUnconnectedSegm, dlg.connectToPads ); dlg.deleteUnconnectedSegm, dlg.connectToPads );
DrawPanel->Refresh( true ); DrawPanel->Refresh( true );
} }
...@@ -55,12 +81,12 @@ void PCB_EDIT_FRAME::Clean_Pcb( wxDC* DC ) ...@@ -55,12 +81,12 @@ void PCB_EDIT_FRAME::Clean_Pcb( wxDC* DC )
* i.e. when a track end covers a pad or a via but is not exactly on the pad or the via center * i.e. when a track end covers a pad or a via but is not exactly on the pad or the via center
*/ */
void CleanupTracks( PCB_EDIT_FRAME* aFrame, void CleanupTracks( PCB_EDIT_FRAME* aFrame,
bool aCleanVias, bool aMergeSegments, bool aCleanVias, bool aMergeSegments,
bool aDeleteUnconnectedSegm, bool aConnectToPads ) bool aDeleteUnconnectedSegm, bool aConnectToPads )
{ {
wxBusyCursor( dummy ); wxBusyCursor( dummy );
aFrame->MsgPanel->EraseMsgBox(); aFrame->ClearMsgPanel();
aFrame->GetBoard()->GetNumSegmTrack(); // update the count aFrame->GetBoard()->GetNumSegmTrack(); // update the count
// Clear undo and redo lists to avoid inconsistencies between lists // Clear undo and redo lists to avoid inconsistencies between lists
...@@ -487,7 +513,8 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -487,7 +513,8 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
if( flag ) // We have the starting point of the segment is connected to an other segment if( flag ) // We have the starting point of the segment is connected to an other segment
{ {
segDelete = MergeColinearSegmentIfPossible( aFrame->GetBoard(), segment, segStart, START ); segDelete = MergeColinearSegmentIfPossible( aFrame->GetBoard(), segment, segStart,
START );
if( segDelete ) if( segDelete )
{ {
...@@ -555,9 +582,8 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -555,9 +582,8 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
* and return aCandidate (which can be deleted). * and return aCandidate (which can be deleted).
* else return NULL * else return NULL
*/ */
TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef, TRACK* aCandidate,
TRACK* aTrackRef, TRACK* aCandidate, int aEndType )
int aEndType )
{ {
if( aTrackRef->m_Width != aCandidate->m_Width ) if( aTrackRef->m_Width != aCandidate->m_Width )
return NULL; return NULL;
......
...@@ -74,7 +74,7 @@ static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -74,7 +74,7 @@ static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( pcb->IsHighLightNetON() ) if( pcb->IsHighLightNetON() )
pcb->DrawHighLight( Panel, DC, pcb->GetHighLightNetCode() ); pcb->DrawHighLight( Panel, DC, pcb->GetHighLightNetCode() );
frame->MsgPanel->EraseMsgBox(); frame->ClearMsgPanel();
// Undo pending changes (mainly a lock point creation) and clear the // Undo pending changes (mainly a lock point creation) and clear the
// undo picker list: // undo picker list:
......
...@@ -467,7 +467,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF ...@@ -467,7 +467,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
} }
/* Display the file names: */ /* Display the file names: */
MsgPanel->EraseMsgBox(); m_messagePanel->EraseMsgBox();
if( saveok ) if( saveok )
{ {
......
...@@ -120,7 +120,7 @@ void DIALOG_GENDRILL::GenDrillAndReportFiles() ...@@ -120,7 +120,7 @@ void DIALOG_GENDRILL::GenDrillAndReportFiles()
UpdateConfig(); // set params and Save drill options UpdateConfig(); // set params and Save drill options
m_Parent->MsgPanel->EraseMsgBox(); m_Parent->ClearMsgPanel();
if( m_microViasCount || m_blindOrBuriedViasCount ) if( m_microViasCount || m_blindOrBuriedViasCount )
hasBuriedVias = true; hasBuriedVias = true;
......
...@@ -206,7 +206,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father, ...@@ -206,7 +206,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father,
m_auimgr.AddPane( DrawPanel, m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel, m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg_pane ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); wxAuiPaneInfo( mesg_pane ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
m_auimgr.Update(); m_auimgr.Update();
......
...@@ -391,8 +391,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, ...@@ -391,8 +391,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_auimgr.AddPane( DrawPanel, m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( MsgPanel ) if( m_messagePanel )
m_auimgr.AddPane( MsgPanel, m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
ReFillLayerWidget(); // this is near end because contents establish size ReFillLayerWidget(); // this is near end because contents establish size
......
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