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
m_HotkeysZoomAndGridList = NULL;
DrawPanel = NULL;
MsgPanel = NULL;
m_messagePanel = NULL;
m_currentScreen = NULL;
m_toolId = ID_NO_TOOL_SELECTED;
m_ID_last_state = ID_NO_TOOL_SELECTED;
......@@ -148,10 +148,10 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti
m_FrameSize.y -= m_MsgFrameHeight;
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 ) );
MsgPanel->SetBackgroundColour( wxColour( ColorRefs[LIGHTGRAY].m_Red,
m_messagePanel->SetBackgroundColour( wxColour( ColorRefs[LIGHTGRAY].m_Red,
ColorRefs[LIGHTGRAY].m_Green,
ColorRefs[LIGHTGRAY].m_Blue ) );
}
......@@ -178,8 +178,8 @@ void EDA_DRAW_FRAME::unitsChangeRefresh()
void EDA_DRAW_FRAME::EraseMsgBox()
{
if( MsgPanel )
MsgPanel->EraseMsgBox();
if( m_messagePanel )
m_messagePanel->EraseMsgBox();
}
......@@ -872,19 +872,19 @@ void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper,
const wxString& textLower,
int color, int pad )
{
if( MsgPanel == NULL )
if( m_messagePanel == NULL )
return;
MsgPanel->AppendMessage( textUpper, textLower, color, pad );
m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
}
void EDA_DRAW_FRAME::ClearMsgPanel( void )
{
if( MsgPanel == NULL )
if( m_messagePanel == NULL )
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 "appl_wxstruct.h"
......@@ -106,7 +131,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DisplayFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel,
m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
m_auimgr.AddPane( m_OptionsToolBar,
......@@ -133,7 +158,8 @@ DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME()
void DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow( wxCloseEvent& event )
{
if( m_Draw3DFrame )
m_Draw3DFrame->Close(true);
m_Draw3DFrame->Close( true );
SaveSettings();
Destroy();
}
......@@ -406,6 +432,7 @@ void DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame( wxCommandEvent& event )
// This should work on any platform.
if( m_Draw3DFrame->IsIconized() )
m_Draw3DFrame->Iconize( false );
m_Draw3DFrame->Raise();
// Raising the window does not set the focus on Linux. This should work on any platform.
......
......@@ -41,13 +41,14 @@
#include "template_fieldnames.h"
#include "netlist.h"
/* Fill aList with labels
*/
void GenListeGLabels( LABEL_OBJECT_LIST& aList )
void GenListeGLabels( BOM_LABEL_LIST& aList )
{
// Build the sheet list
SCH_SHEET_LIST sheetList;
LABEL_OBJECT label;
BOM_LABEL label;
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() )
{
......@@ -59,10 +60,7 @@ void GenListeGLabels( LABEL_OBJECT_LIST& aList )
{
case SCH_HIERARCHICAL_LABEL_T:
case SCH_GLOBAL_LABEL_T:
label.m_LabelType = schItem->Type();
label.m_SheetPath = *path;
label.m_Label = schItem;
aList.push_back( label );
aList.push_back( BOM_LABEL( schItem->Type(), schItem, *path ) );
break;
case SCH_SHEET_T:
......@@ -71,10 +69,7 @@ void GenListeGLabels( LABEL_OBJECT_LIST& aList )
BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, sheet->GetPins() )
{
label.m_LabelType = SCH_SHEET_PIN_T;
label.m_SheetPath = *path;
label.m_Label = &sheetPin;
aList.push_back( label );
aList.push_back( BOM_LABEL( SCH_SHEET_PIN_T, &sheetPin, *path ) );
}
}
break;
......@@ -88,31 +83,21 @@ void GenListeGLabels( LABEL_OBJECT_LIST& aList )
}
}
/* compare function for sorting labels
* sort by
* value
* 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;
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 )
{
ii = obj1.m_SheetPath.Cmp( obj2.m_SheetPath );
ii = obj1.GetSheetPath().Cmp( obj2.GetSheetPath() );
}
return ii < 0;
......@@ -123,33 +108,22 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
* by sheet
* 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;
wxString Text1, Text2;
ii = obj1.m_SheetPath.Cmp( obj2.m_SheetPath );
ii = obj1.GetSheetPath().Cmp( obj2.GetSheetPath() );
if( ii == 0 )
{
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() );
}
return ii < 0;
}
int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
int PrintListeGLabel( FILE* f, BOM_LABEL_LIST& aList )
{
SCH_LABEL* label;
SCH_SHEET_PIN* pinsheet;
......@@ -158,20 +132,20 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
for( unsigned ii = 0; ii < aList.size(); ii++ )
{
switch( aList[ii].m_LabelType )
switch( aList[ii].GetType() )
{
case SCH_HIERARCHICAL_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" );
else
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" ),
GetChars( label->m_Text ),
GetChars( label->GetText() ),
GetChars( labeltype ),
GetChars( sheetpath ),
(float) label->m_Pos.x / 1000,
......@@ -182,7 +156,7 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
case SCH_SHEET_PIN_T:
{
pinsheet = (SCH_SHEET_PIN*) aList[ii].m_Label;
pinsheet = (SCH_SHEET_PIN*) aList[ii].GetLabel();
int jj = pinsheet->GetShape();
if( jj < 0 )
......@@ -194,14 +168,15 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
wxString labtype = FROM_UTF8( SheetLabelType[jj] );
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( aList[ii].m_SheetPath.PathHumanReadable() ),
GetChars( aList[ii].GetSheetPath().PathHumanReadable() ),
(float) pinsheet->m_Pos.x / 1000,
(float) pinsheet->m_Pos.y / 1000 );
fputs( TO_UTF8( msg ), f );
}
break;
default:
......
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_build_BOM.cpp
// Author: jean-pierre Charras
// Modified by:
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2008 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* 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 "appl_wxstruct.h"
......@@ -29,10 +49,10 @@
#include "protos.h"
extern void GenListeGLabels( std::vector <LABEL_OBJECT>& aList );
extern bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 );
extern bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 );
extern int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList );
extern void GenListeGLabels( std::vector <BOM_LABEL>& aList );
extern bool SortLabelsByValue( const BOM_LABEL& obj1, const BOM_LABEL& obj2 );
extern bool SortLabelsBySheet( const BOM_LABEL& obj1, const BOM_LABEL& obj2 );
extern int PrintListeGLabel( FILE* f, std::vector <BOM_LABEL>& aList );
/* Local variables */
......@@ -503,9 +523,10 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
/*************************************************/
/* Create list of global labels and pins sheets */
/*************************************************/
std::vector <LABEL_OBJECT> listOfLabels;
std::vector <BOM_LABEL> listOfLabels;
GenListeGLabels( listOfLabels );
if( ( itemCount = listOfLabels.size() ) > 0 )
{
if( m_GenListLabelsbySheet->GetValue() )
......@@ -659,6 +680,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
std::string CmpName;
wxString subRef;
#if defined(KICAD_GOST)
wxString strCur;
wxString strPred;
......@@ -683,6 +705,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
bool isMulti = false;
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( comp->GetLibName() );
if( entry )
isMulti = entry->IsMulti();
......@@ -748,21 +771,32 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
#if defined(KICAD_GOST)
wxString tmpStr = PrintFieldData( comp, CompactForm );
strCur += tmpStr;
if ( CompactForm )
{
if ( strPred.Len() == 0 )
{
CmpNameFirst = CmpName;
}
else
{
if ( !strCur.IsSameAs(strPred) )
{
switch (amount)
{
case 1: fprintf( f, "%s%s%c%d\n", CmpNameFirst.c_str(), TO_UTF8(strPred), s_ExportSeparatorSymbol, amount );
case 1:
fprintf( f, "%s%s%c%d\n", CmpNameFirst.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 );
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 );
default:
fprintf( f, "%s..%s%s%c%d\n", CmpNameFirst.c_str(), CmpNameLast.c_str(),
TO_UTF8( strPred ), s_ExportSeparatorSymbol, amount );
break;
}
CmpNameFirst = CmpName;
......@@ -796,11 +830,19 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
{
switch (amount)
{
case 1: fprintf( f, "%s%s%c%d\n", CmpNameFirst.c_str(), TO_UTF8(strPred), s_ExportSeparatorSymbol, amount );
case 1:
fprintf( f, "%s%s%c%d\n", CmpNameFirst.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 );
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 );
default:
fprintf( f, "%s..%s%s%c%d\n", CmpNameFirst.c_str(), CmpNameLast.c_str(),
TO_UTF8( strPred ), s_ExportSeparatorSymbol, amount );
break;
}
}
......@@ -862,6 +904,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* f, SCH_REFERENCE_LIST& aL
refName = aList[ii].GetRef();
valName = currCmp->GetField( VALUE )->m_Text;
#if defined(KICAD_GOST)
footName = currCmp->GetField( FOOTPRINT )->m_Text;
datsName = currCmp->GetField( DATASHEET )->m_Text;
......@@ -931,8 +974,10 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* f, SCH_REFERENCE_LIST& aL
int last_nonempty_field_idx = 0;
for( int jj = FOOTPRINT; jj < dummyCmp.GetFieldCount(); jj++ )
{
if ( !dummyCmp.GetField( jj )->m_Text.IsEmpty() )
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,
if( aIncludeSubComponents )
{
BASE_SCREEN * screen = (BASE_SCREEN*) DrawLibItem->GetParent();
if( screen )
{
msg = aList[ii].GetSheetPath().PathHumanReadable();
......
......@@ -259,7 +259,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel,
m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
m_auimgr.Update();
......
......@@ -83,6 +83,14 @@ void dumpNetTable()
#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
* to the main table (list items)
......
/**
* @file netlist.h
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
......@@ -28,6 +24,10 @@
*/
/**
* @file netlist.h
*/
#ifndef _NETLIST_H_
#define _NETLIST_H_
......@@ -50,6 +50,7 @@ class SCH_REFERENC_LIST;
/* Max pin number per component and footprint */
#define MAXPIN 5000
/**
* Class SCH_REFERENCE
* is used as a helper to define a component's reference designator in a schematic. This
......@@ -471,26 +472,40 @@ private:
/**
* helper Class LABEL_OBJECT
* is used in build BOM to handle the list of labels in schematic
* because in a complex hierarchy, a label is used more than once,
* and had more than one sheet path, so we must create a flat list of labels
* Class BOM_LABEL
* is used to build a BOM by handling the list of labels in schematic because in a
* complex hierarchy, a label is used more than once and has more than one sheet path
* so we must create a flat list of labels.
*/
class LABEL_OBJECT
class BOM_LABEL
{
public:
int m_LabelType;
SCH_ITEM* m_Label;
KICAD_T m_type;
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.
SCH_SHEET_PATH m_SheetPath; //composed of UIDs
static SCH_SHEET_PATH emptySheetPath;
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,8 +264,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
if( DrawPanel )
m_auimgr.AddPane( DrawPanel, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( MsgPanel )
m_auimgr.AddPane( MsgPanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().
if( m_messagePanel )
m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().
Layer(10) );
m_auimgr.Update();
......
......@@ -231,7 +231,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).Centre() );
// Manage the message panel
m_auimgr.AddPane( MsgPanel,
m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
/* 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
*/
......@@ -27,9 +52,9 @@ const wxString GerbviewShowPageSizeOption( wxT( "ShowPageSizeOpt" ) );
const wxString GerbviewShowDCodes( wxT( "ShowDCodesOpt" ) );
/****************************************/
/* class GERBVIEW_FRAME for GerbView*/
/****************************************/
/*************************************/
/* class GERBVIEW_FRAME for GerbView */
/*************************************/
GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
......@@ -122,8 +147,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( MsgPanel )
m_auimgr.AddPane( MsgPanel,
if( m_messagePanel )
m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
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 "common.h"
......@@ -12,7 +36,7 @@
*/
GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc )
{
MsgPanel->EraseMsgBox();
m_messagePanel->EraseMsgBox();
wxPoint ref = aPosition;
bool found = false;
......
......@@ -152,6 +152,32 @@ protected:
*/
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:
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
......
......@@ -371,12 +371,11 @@ public:
*/
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:
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_AuxVToolBar; // Auxiliary Vertical (right side)
// Toolbar
......@@ -416,6 +415,9 @@ protected:
bool m_DrawGrid; // hide/Show grid
int m_GridColor; // Grid color
/// Panel used to display information at the bottom of the main window.
EDA_MSG_PANEL* m_messagePanel;
private:
BASE_SCREEN* m_currentScreen; ///< current used SCREEN
bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid.
......
......@@ -3,7 +3,7 @@
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* 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
* modify it under the terms of the GNU General Public License
......@@ -437,25 +437,25 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
Ncols += 2; Nrows += 2;
NbCells = Ncols * Nrows;
MsgPanel->EraseMsgBox();
m_messagePanel->EraseMsgBox();
msg.Printf( wxT( "%d" ), Ncols );
MsgPanel->SetMessage( 1, _( "Cols" ), msg, GREEN );
m_messagePanel->SetMessage( 1, _( "Cols" ), msg, GREEN );
msg.Printf( wxT( "%d" ), Nrows );
MsgPanel->SetMessage( 7, _( "Lines" ), msg, GREEN );
m_messagePanel->SetMessage( 7, _( "Lines" ), msg, GREEN );
msg.Printf( wxT( "%d" ), NbCells );
MsgPanel->SetMessage( 14, _( "Cells." ), msg, YELLOW );
m_messagePanel->SetMessage( 14, _( "Cells." ), msg, YELLOW );
/* Choose the number of board sides. */
Nb_Sides = TWO_SIDES;
MsgPanel->SetMessage( 22, wxT( "S" ), ( Nb_Sides == TWO_SIDES ) ? wxT( "2" ) : wxT( "1" ),
WHITE );
m_messagePanel->SetMessage( 22, wxT( "S" ),
( Nb_Sides == TWO_SIDES ) ? wxT( "2" ) : wxT( "1" ), WHITE );
Board.InitBoard();
/* Display memory usage. */
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;
......@@ -509,8 +509,8 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
while( ii )
{
msg.Printf( wxT( "%d" ), jj++ );
MsgPanel->SetMessage( 50, _( "Loop" ), msg, CYAN );
ii = Propagation( this );
m_messagePanel->SetMessage( 50, _( "Loop" ), msg, CYAN );
ii = propagate();
}
/* Initialize top layer. */
......@@ -1157,31 +1157,7 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
}
/**
* 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 PCB_EDIT_FRAME::propagate()
{
int row, col;
long current_cell, old_cell_H;
......@@ -1191,8 +1167,8 @@ int Propagation( PCB_EDIT_FRAME* frame )
#define NO_CELL_ZONE (HOLE | CELL_is_EDGE | CELL_is_ZONE)
wxString msg;
frame->MsgPanel->SetMessage( 57, wxT( "Detect" ), msg, CYAN );
frame->MsgPanel->SetMessage( -1, wxEmptyString, wxT( "1" ), CYAN );
m_messagePanel->SetMessage( 57, wxT( "Detect" ), msg, CYAN );
m_messagePanel->SetMessage( -1, wxEmptyString, wxT( "1" ), CYAN );
pt_cell_V.reserve( MAX( Nrows, Ncols ) );
fill( pt_cell_V.begin(), pt_cell_V.end(), 0 );
......@@ -1221,7 +1197,7 @@ int Propagation( PCB_EDIT_FRAME* frame )
}
// 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 );
for( row = 0; row < Nrows; row++ )
......@@ -1247,7 +1223,7 @@ int Propagation( PCB_EDIT_FRAME* frame )
}
// 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 );
for( col = Ncols - 1; col >= 0; col-- )
......@@ -1273,7 +1249,7 @@ int Propagation( PCB_EDIT_FRAME* frame )
}
// 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 );
for( col = 0; col < Ncols; col++ )
......
......@@ -152,7 +152,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
/* Calculated ncol and nrow, matrix size for routing. */
Board.ComputeMatrixSize( GetBoard() );
MsgPanel->EraseMsgBox();
m_messagePanel->EraseMsgBox();
/* Map the board */
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
* @brief functions to clean tracks: remove null lenght and redundant segments
......@@ -16,7 +41,8 @@
static void clean_segments( PCB_EDIT_FRAME* aFrame );
static void clean_vias( BOARD* aPcb );
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,
bool aCleanVias, bool aMergeSegments,
bool aDeleteUnconnectedSegm, bool aConnectToPads );
......@@ -60,7 +86,7 @@ void CleanupTracks( PCB_EDIT_FRAME* aFrame,
{
wxBusyCursor( dummy );
aFrame->MsgPanel->EraseMsgBox();
aFrame->ClearMsgPanel();
aFrame->GetBoard()->GetNumSegmTrack(); // update the count
// Clear undo and redo lists to avoid inconsistencies between lists
......@@ -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
{
segDelete = MergeColinearSegmentIfPossible( aFrame->GetBoard(), segment, segStart, START );
segDelete = MergeColinearSegmentIfPossible( aFrame->GetBoard(), segment, segStart,
START );
if( segDelete )
{
......@@ -555,8 +582,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
* and return aCandidate (which can be deleted).
* else return NULL
*/
TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb,
TRACK* aTrackRef, TRACK* aCandidate,
TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef, TRACK* aCandidate,
int aEndType )
{
if( aTrackRef->m_Width != aCandidate->m_Width )
......
......@@ -74,7 +74,7 @@ static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( pcb->IsHighLightNetON() )
pcb->DrawHighLight( Panel, DC, pcb->GetHighLightNetCode() );
frame->MsgPanel->EraseMsgBox();
frame->ClearMsgPanel();
// Undo pending changes (mainly a lock point creation) and clear the
// undo picker list:
......
......@@ -467,7 +467,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
}
/* Display the file names: */
MsgPanel->EraseMsgBox();
m_messagePanel->EraseMsgBox();
if( saveok )
{
......
......@@ -120,7 +120,7 @@ void DIALOG_GENDRILL::GenDrillAndReportFiles()
UpdateConfig(); // set params and Save drill options
m_Parent->MsgPanel->EraseMsgBox();
m_Parent->ClearMsgPanel();
if( m_microViasCount || m_blindOrBuriedViasCount )
hasBuriedVias = true;
......
......@@ -206,7 +206,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father,
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel,
m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg_pane ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
m_auimgr.Update();
......
......@@ -391,8 +391,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( MsgPanel )
m_auimgr.AddPane( MsgPanel,
if( m_messagePanel )
m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
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