Commit d4fb921b authored by Wayne Stambaugh's avatar Wayne Stambaugh

Eeschema ERC improvements and other minor fixes.

* Move the hierarchical label connected test into the NETLIST_OBJECT class.
* ERC pin type strings can now be translated.
* Remove unused EDA_DRAW_PANEL attribute from all ERC test functions.
* Add get marker count method to SCH_SCREENS object.
* Redundant header removal.
* Lots of coding style policy fixes.
parent 5602177d
......@@ -13,7 +13,7 @@ endif(WIN32)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
#
# KiCad build options go here.
# KiCad build options should be added below.
#
# If you add a new build option, please add it's state to the CopyVersionInfoToClipboard()
# function in common/basicframe.cpp so that build option settings can be includeed in bug
......
/**************************************/
/* annotate.cpp: component annotation */
/**************************************/
/**
* @file annotate.cpp
* @brief Component annotation.
*/
#include <algorithm> // to use sort vector
#include <vector>
......@@ -8,8 +9,6 @@
#include "fctsys.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "wxstruct.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "netlist.h"
......
/****************************************************/
/* BLOCK.CPP */
/****************************************************/
/**
* @file eeschema/block.cpp
*/
#include "fctsys.h"
#include "appl_wxstruct.h"
......@@ -8,7 +8,6 @@
#include "class_drawpanel.h"
#include "confirm.h"
#include "wxEeschemaStruct.h"
#include "class_sch_screen.h"
#include "general.h"
#include "class_library.h"
......
/****************************************************/
/* block_libedit.cpp */
/****************************************************/
/**
* @file block_libedit.cpp
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "block_commande.h"
#include "general.h"
#include "class_library.h"
......
/***************************************************************/
/* Code for handling creation of buses, wires, and junctions. */
/***************************************************************/
/**
* @file bus-wire-junction.cpp
* @brief Code for editing buses, wires, and junctions.
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "wxEeschemaStruct.h"
#include "class_sch_screen.h"
#include "lib_draw_item.h"
#include "lib_pin.h"
......
/*****************************************************/
/* Code to handle manipulation on bus entry objects. */
/*****************************************************/
/**
* @file busentry.cpp
* @brief Code to handle manipulation of bus entry objects.
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "class_drawpanel.h"
#include "eeschema_id.h"
#include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......
/**********************************************************/
/* libclass.cpp */
/**********************************************************/
/**
* @file class_library.cpp
*/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -232,18 +232,6 @@ bool CMP_LIBRARY::AddAlias( LIB_ALIAS* aAlias )
}
/**
* Add \a aComponent entry to library.
* Note a component can have an alias list,
* so these alias will be added in library.
* Conflicts can happen if aliases are already existing.
* User is asked to choose what alias is removed (existing, or new)
* a special case is the library cache:
* user is not asked, and old aliases removed.
* this is not perfect, but sufficient to create a library cache project
* @param aComponent - Component to add.
* @return Added component if successful.
*/
LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent )
{
if( aComponent == NULL )
......@@ -323,13 +311,6 @@ LIB_ALIAS* CMP_LIBRARY::RemoveEntry( LIB_ALIAS* aEntry )
}
/**
* Replace an existing component entry in the library.
*
* @param aOldComponent - The component to replace.
* @param aNewComponent - The new component.
* the new component and the old component are expected having the same name.
*/
LIB_COMPONENT* CMP_LIBRARY::ReplaceComponent( LIB_COMPONENT* aOldComponent,
LIB_COMPONENT* aNewComponent )
{
......@@ -569,10 +550,12 @@ bool CMP_LIBRARY::LoadHeader( FILE* libfile, int* LineNum )
{
text = strtok( Line, " \t\r\n" );
data = strtok( NULL, " \t\r\n" );
if( stricmp( text, "TimeStamp" ) == 0 )
timeStamp = atol( data );
if( stricmp( text, "$ENDHEADER" ) == 0 )
return TRUE;
return true;
}
return FALSE;
......
/*********************************************/
/* Headers for component library definition */
/*********************************************/
/**
* @file class_library.h
* @brief Definition for component library class.
*/
#ifndef CLASS_LIBRARY_H
#define CLASS_LIBRARY_H
......
/*************************************************************************************/
/* Class NETLIST_OBJECT to handle 1 item connected (in netlist and erc calculations) */
/*************************************************************************************/
/**
* @file class_netlist_object.cpp
* @brief Class NETLIST_OBJECT to handle 1 item connected (in netlist and erc calculations)
*/
#include "fctsys.h"
#include "macros.h"
......@@ -9,9 +9,9 @@
#include "general.h"
#include "sch_component.h"
#include "class_netlist_object.h"
#if defined(DEBUG)
#include <iostream>
const char* ShowType( NetObjetType aType )
{
......@@ -25,7 +25,7 @@ const char* ShowType( NetObjetType aType )
case NET_BUS:
ret = "bus"; break;
case NET_JONCTION:
case NET_JUNCTION:
ret = "junction"; break;
case NET_LABEL:
......@@ -89,10 +89,12 @@ void NETLIST_OBJECT::Show( std::ostream& out, int ndx )
switch( m_Type )
{
case NET_PIN:
out << " <refOfComp>" << ((SCH_COMPONENT*)m_Link)->GetRef(&m_SheetList).mb_str() << "</refOfComp>\n";
out << " <refOfComp>" << ((SCH_COMPONENT*)m_Link)->GetRef(&m_SheetList).mb_str()
<< "</refOfComp>\n";
if( m_Comp )
m_Comp->Show( 1, out );
break;
default:
......@@ -110,7 +112,6 @@ void NETLIST_OBJECT::Show( std::ostream& out, int ndx )
out << "</netItem>\n";
}
#endif
......@@ -153,3 +154,23 @@ NETLIST_OBJECT::~NETLIST_OBJECT()
{
}
bool NETLIST_OBJECT::IsLabelConnected( NETLIST_OBJECT* aNetItem )
{
if( aNetItem == this ) // Don't compare the same net list object.
return false;
int at = m_Type;
int bt = aNetItem->m_Type;
if( ( at == NET_HIERLABEL || at == NET_HIERBUSLABELMEMBER )
&& ( bt == NET_SHEETLABEL || bt == NET_SHEETBUSLABELMEMBER ) )
{
if( m_SheetList == aNetItem->m_SheetListInclude )
{
return true; //connected!
}
}
return false; //these two are unconnected
}
/***********************************************************************/
/* Class NETLIST_OBJECT to handle 1 item connected (in netlist and erc */
/* calculations) */
/***********************************************************************/
/**
* @file class_netlist_object.h
* @brief Definition of the NETLIST_OBJECT class.
*/
#ifndef _CLASS_NETLIST_OBJECT_H_
#define _CLASS_NETLIST_OBJECT_H_
#include "sch_sheet_path.h"
#include "lib_pin.h" // LIB_PIN::ReturnPinStringNum( m_PinNum )
......@@ -16,7 +17,7 @@ enum NetObjetType {
NET_ITEM_UNSPECIFIED, // only for not yet initialized instances
NET_SEGMENT, // connection by wire
NET_BUS, // connection by bus
NET_JONCTION, // connection by junction: can connect to
NET_JUNCTION, // connection by junction: can connect to
// or more crossing wires
NET_LABEL, // this is a local label
NET_GLOBLABEL, // this is a global label that connect all
......@@ -60,7 +61,7 @@ class NETLIST_OBJECT
public:
NetObjetType m_Type; /* Type of item (see NetObjetType
* enum) */
EDA_ITEM * m_Comp; /* Pointer on the library item that
EDA_ITEM* m_Comp; /* Pointer on the library item that
* created this net object (the parent)
*/
SCH_ITEM* m_Link; /* For SCH_SHEET_PIN:
......@@ -101,8 +102,8 @@ public:
#if defined(DEBUG)
void Show( std::ostream& out, int ndx );
#endif
NETLIST_OBJECT();
NETLIST_OBJECT( NETLIST_OBJECT& aSource ); // Copy constructor
......@@ -114,15 +115,27 @@ public:
/**
* Function GetPinNum
* returns a pin number in wxString form. Pin numbers are not always
* numbers. "A23" would be a valid pin number.
* numbers. \"A23\" would be a valid pin number.
*/
wxString GetPinNumText()
{
// hide the ugliness in here, but do it inline.
return LIB_PIN::ReturnPinStringNum( m_PinNum );
}
/**
* Function IsLabelConnected
* tests if the net list object is a hierarchical label or sheet label and is
* connected to an associated hierarchical label or sheet label of \a aNetItem.
*
* @param aNetItem A pointer to a NETLIST_OBJECT to test against.
* @return A bool value of true if there is a connection with \a aNetItem or false
* if no connection to \a aNetItem.
*/
bool IsLabelConnected( NETLIST_OBJECT* aNetItem );
};
// Buffer to build the list of items used in netlist and erc calculations
typedef std::vector <NETLIST_OBJECT*> NETLIST_OBJECT_LIST;
......
/*
* component_references_lister.cpp: creates a flat list of components.
* Needed for annotation and BOM.
* @file component_references_lister.cpp
* @brief Code for creating a flat list of components needed for annotation and BOM.
*/
/*
......@@ -36,7 +36,6 @@
#include "kicad_string.h"
#include "wxEeschemaStruct.h"
#include "netlist.h"
#include "class_sch_screen.h"
#include "sch_component.h"
......
/*********************/
/* dangling_ends.cpp */
/*********************/
/**
* @file dangling_ends.cpp
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "sch_item_struct.h"
#include "wxEeschemaStruct.h"
#include "class_sch_screen.h"
#include "general.h"
#include "protos.h"
......
......@@ -25,7 +25,7 @@
* BufName mask (with * and?)
*
* Returns
* TRUE if the selected component
* true if the selected component
* FALSE canceled order
* Place the name of the component has loaded, select from a list in
* BufName
......
/*
* 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.
*
* Copyright (C) 1992-2009 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2009 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
......
This diff is collapsed.
/********************************/
/* Schematic component edition */
/********************************/
/**
* @file edit_component_in_schematic.cpp
* @brief Schematic component editing code.
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......
/*********************************************************************/
/* edit_label.cpp: label, global label and text creation or edition */
/*********************************************************************/
/**
* @file edit_label.cpp
* @brief Label, global label and text creation and editing.
*/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -8,7 +9,6 @@
#include "drawtxt.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "kicad_device_context.h"
......
/*****************************************************************************
* Program to draw EE diagrams. *
* This module redraw/draw all structs. *
*****************************************************************************/
/**
* @file eeredraw.cpp
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "class_drawpanel.h"
#include "appl_wxstruct.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......
......@@ -9,7 +9,6 @@
#include "gestfich.h"
#include "eda_dde.h"
#include "id.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......@@ -22,7 +21,7 @@
// Global variables
bool g_OptNetListUseNames; /* TRUE to use names rather than net
bool g_OptNetListUseNames; /* true to use names rather than net
* The numbers (PSPICE netlist only) */
wxSize g_RepeatStep;
int g_RepeatDeltaLabel;
......@@ -30,8 +29,6 @@ int g_RepeatDeltaLabel;
bool g_HVLines = true; // Bool: force H or V
// directions (Wires, Bus ..)
struct EESchemaVariables g_EESchemaVar;
int g_DefaultTextLabelSize = DEFAULT_SIZE_TEXT;
HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
......
/*****************/
/** eeconfig.h **/
/*****************/
/**
* @file eeschema_config.h
*/
#include "param_config.h"
......@@ -11,6 +11,6 @@
extern int g_PenMinWidth;
/* saving parameters option : */
#define INSETUP TRUE /* used when the parameter is saved in general config
#define INSETUP true /* used when the parameter is saved in general config
* if not used, the parameter is saved in the local
* config (project config) */
This diff is collapsed.
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jea-Pierre.Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2009 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2009-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
......@@ -22,6 +23,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file erc.h
*/
#ifndef _ERC_H
#define _ERC_H
......@@ -58,16 +63,44 @@ enum errortype
#define NOC 0 // initial state of a net: no connection
extern bool WriteDiagnosticERC( const wxString& FullFileName );
/**
* Function WriteDiagnosticERC
* save the ERC errors to \a aFullFileName.
*
* @param aFullFileName A wxString object containing the file name and path.
*/
extern bool WriteDiagnosticERC( const wxString& aFullFileName );
extern void Diagnose( EDA_DRAW_PANEL* panel, NETLIST_OBJECT* NetItemRef,
NETLIST_OBJECT* NetItemTst, int MinConnexion, int Diag );
/**
* Performs ERC testing and creates an ERC marker to show the ERC problem for aNetItemRef
* or between aNetItemRef and aNetItemTst.
* if MinConn < 0: this is an error on labels
*/
extern void Diagnose( NETLIST_OBJECT* NetItemRef, NETLIST_OBJECT* NetItemTst,
int MinConnexion, int Diag );
extern void TestOthersItems( EDA_DRAW_PANEL* panel, unsigned NetItemRef, unsigned NetStart,
/**
* Perform ERC testing for electrical conflicts between \a NetItemRef and other items
* on the same net.
*/
extern void TestOthersItems( unsigned NetItemRef, unsigned NetStart,
int* NetNbItems, int* MinConnexion );
extern void TestLabel( EDA_DRAW_PANEL* panel, unsigned NetItemRef, unsigned StartNet );
/**
* Function TestLabel
* performs an ERC on a sheet labels to verify that it is connected to a corresponding
* sub sheet global label.
*/
extern void TestLabel( unsigned NetItemRef, unsigned StartNet );
/**
* Function TestDuplicateSheetNames( )
* inside a given sheet, one cannot have sheets with duplicate names (file
* names can be duplicated).
* @return the error count
* @param aCreateMarker: true = create error markers in schematic,
* false = calculate error count only
*/
extern int TestDuplicateSheetNames( bool aCreateMarker );
......
/*
* events_called_functions.cpp
* some events functions
* @file events_called_functions.cpp
*/
#include "fctsys.h"
......@@ -8,7 +7,6 @@
#include "class_drawpanel.h"
#include "general.h"
#include "kicad_device_context.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "protos.h"
......
......@@ -185,8 +185,6 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
SetStatusText( wxEmptyString );
ClearMsgPanel();
memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) );
screen->ClrModify();
if( aIsNew )
......
......@@ -14,7 +14,6 @@
#include "confirm.h"
#include "kicad_string.h"
#include "gestfich.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......
/***************/
/* GENERAL.H */
/***************/
/**
* @file general.h
*/
#ifndef _GENERAL_H_
#define _GENERAL_H_
......@@ -115,14 +115,6 @@ extern int g_RepeatDeltaLabel;
// Management options.
extern bool g_HVLines;
// Management variables, option ... to be stored. Reset to 0 during a
// project reload.
struct EESchemaVariables
{
int NbErrorErc;
int NbWarningErc;
};
extern struct EESchemaVariables g_EESchemaVar;
extern int g_DefaultTextLabelSize;
......@@ -170,7 +162,7 @@ extern int g_InvisibleItemColor;
extern NETLIST_OBJECT_LIST g_NetObjectslist;
extern bool g_OptNetListUseNames; /* TRUE to use names rather than
extern bool g_OptNetListUseNames; /* true to use names rather than
* net numbers. SPICE netlist only
*/
......
/*************************************************/
/* Module to handle Get & Place Library Part */
/*************************************************/
/**
* @file getpart.cpp
* @brief Cod to handle get & place library component.
*/
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "gr_basic.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "kicad_device_context.h"
......
/******************/
/* hierarch.cpp */
/******************/
/**
* @file hierarch.cpp
*/
#include "fctsys.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......@@ -61,7 +60,7 @@ HIERARCHY_TREE::HIERARCHY_TREE( HIERARCHY_NAVIG_DLG* parent ) :
m_Parent = parent;
// Make an image list containing small icons
imageList = new wxImageList( 16, 15, TRUE, 2 );
imageList = new wxImageList( 16, 15, true, 2 );
imageList->Add( KiBitmap( tree_nosel_xpm ) );
imageList->Add( KiBitmap( tree_sel_xpm ) );
......@@ -122,7 +121,7 @@ HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG( SCH_EDIT_FRAME* parent, wxDC* DC, cons
m_nbsheets = 1;
cellule = m_Tree->AddRoot( _( "Root" ), 0, 1 );
m_Tree->SetItemBold( cellule, TRUE );
m_Tree->SetItemBold( cellule, true );
SCH_SHEET_PATH list;
list.Push( g_RootSheet );
m_Tree->SetItemData( cellule, new TreeItemData( list ) );
......
......@@ -22,11 +22,6 @@
extern int ExportPartId;
/* Routine to read one part.
* The format is that of libraries, but it loads only 1 component.
* Or 1 component if there are several.
* If the first component is an alias, it will load the corresponding root.
*/
void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
{
wxString errMsg;
......@@ -74,18 +69,6 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
}
/* Routine to create a new library and backup the current component in this
* library or export the component of the current library.
* createLib == TRUE if we are creating a new library.
* If not: export the library component.
* Basically these 2 options do the same thing, but for user's convenience
* > When creating a new lib, the user is prompted to add the new lib to
* current eeschema config library list
* > When exporting there is no message (it is expected the user does not want to add the
* new created lib
*
* The file format is created in all cases the same.
*/
void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent& event )
{
wxFileName fn;
......
/*****************************************************/
/* libarch.cpp */
/* Module for generation of component archive files. */
/*****************************************************/
/**
* @file libarch.cpp
* @brief Module for generation of component archive files.
*/
#include "fctsys.h"
#include "confirm.h"
#include "class_sch_screen.h"
......
......@@ -96,7 +96,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
SaveCopyInUndoList( m_component );
PlaceAncre();
PlaceAnchor();
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
break;
......
......@@ -17,10 +17,6 @@
#include "class_library.h"
/**
* Function OnPlotCurrentComponent
* plot in SVG or PNG format the curren component
*/
void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
{
LIB_COMPONENT* cmp = GetComponent();
......@@ -47,7 +43,7 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, TRUE );
wxFD_SAVE, true );
if( FullFileName.IsEmpty() )
return;
......@@ -67,7 +63,7 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
fn.SetExt( file_ext );
FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, TRUE );
wxFD_SAVE, true );
if( FullFileName.IsEmpty() )
return;
......@@ -90,13 +86,6 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
}
/**
* Function CreatePNGorJPEGFile
* Create an image (screenshot) of the current component.
* Output file format is png or jpeg
* @param aFileName = the full filename
* @param aFmt_jpeg = true to use JPEG file format, false to use PNG file format
*/
void LIB_EDIT_FRAME::CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_jpeg )
{
wxSize image_size = DrawPanel->GetClientSize();
......@@ -121,16 +110,8 @@ void LIB_EDIT_FRAME::CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_j
image.Destroy();
}
/**
* Function PrintPage (virtual)
* used to print a page.
* @param aDC = wxDC given by the calling print function
* @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not used here)
*/
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask,
bool aPrintMirrorMode, void* aData)
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData)
{
if( ! m_component )
return;
......
......@@ -9,7 +9,6 @@
#include "confirm.h"
#include "eda_doc.h"
#include "gr_basic.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......
This diff is collapsed.
......@@ -7,7 +7,6 @@
#include "confirm.h"
#include "kicad_string.h"
#include "wxEeschemaStruct.h"
#include "class_sch_screen.h"
#include "richio.h"
#include "general.h"
......@@ -318,7 +317,7 @@ line %d, \aAbort reading file.\n" ),
for( ; ; )
{
if( !aLine->ReadLine() )
return TRUE;
return true;
line = aLine->Line();
......
......@@ -23,19 +23,16 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*****************************/
/* Net list generation code. */
/*****************************/
/**
* @file netform.cpp
* @brief Net list generation code.
*/
#include "fctsys.h"
#include "confirm.h"
#include "kicad_string.h"
#include "gestfich.h"
#include "appl_wxstruct.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......@@ -47,7 +44,7 @@
#include "sch_component.h"
#include "sch_text.h"
#include "sch_sheet.h"
#include "template_fieldnames.h"
#include <wx/tokenzr.h>
......
This diff is collapsed.
......@@ -18,7 +18,6 @@
#include "confirm.h"
#include "gestfich.h"
#include "wxEeschemaStruct.h"
#include "class_sch_screen.h"
#include "general.h"
#include "netlist.h"
......
/*******************/
/* onleftclick.cpp */
/*******************/
/**
* @file eeschema/onleftclick.cpp
*/
#include "fctsys.h"
#include "eeschema_id.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......
/********************/
/* onrightclick.cpp */
/********************/
/**
* @file eeschema/onrightclick.cpp
*/
#include "fctsys.h"
#include "eeschema_id.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......
/***************************************************
* operations_on_item_lists.cpp
* functions used in block commands, or undo/redo,
* to move, mirror, delete, copy ... lists of schematic items
/**
* @file operations_on_items_lists.cpp
* @brief Functions used in block commands, or undo/redo, to move, mirror, delete, copy ...
* lists of schematic items.
*/
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "class_drawpanel.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......
/*******************************************************/
/* sch_component.cpp : handle the class SCH_COMPONENT */
/*******************************************************/
/**
* @file sch_component.cpp
* @brief Implementation of the class SCH_COMPONENT.
*/
#include "fctsys.h"
#include "appl_wxstruct.h"
......@@ -20,7 +21,6 @@
#include "sch_component.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include "template_fieldnames.h"
#include "dialogs/dialog_schematic_find.h"
......@@ -274,7 +274,7 @@ void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset
if( Entry == NULL )
{
/* Create a dummy component if the actual component can not be found. */
dummy = TRUE;
dummy = true;
if( DummyCmp == NULL )
CreateDummyCmp();
......@@ -779,7 +779,7 @@ void SCH_COMPONENT::SetOrientation( int aOrientation )
temp.x1 = 1;
temp.y2 = -1;
temp.y1 = temp.x2 = 0;
transform = TRUE;
transform = true;
break;
case CMP_ORIENT_90:
......@@ -1082,7 +1082,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
newfmt = 1;
if( !aLine.ReadLine() )
return TRUE;
return true;
line = aLine.Line();
}
......
/***********************************************/
/* sch_field.cpp : handle the class SCH_FIELD */
/***********************************************/
/**
* @file sch_field.cpp
* @brief Implementation of the SCH_FIELD class.
*/
/* Fields are texts attached to a component, having a special meaning
* Fields 0 and 1 are very important: reference and value
......@@ -17,7 +18,6 @@
#include "drawtxt.h"
#include "macros.h"
#include "trigo.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "plot_common.h"
......@@ -26,9 +26,9 @@
#include "class_library.h"
#include "sch_component.h"
#include "sch_field.h"
#include "template_fieldnames.h"
#include "kicad_string.h"
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent, wxString aName ) :
SCH_ITEM( aParent, SCH_FIELD_T ),
EDA_TEXT()
......
......@@ -18,7 +18,7 @@
class SCH_LINE : public SCH_ITEM
{
bool m_StartIsDangling;
bool m_EndIsDangling; // TRUE if not connected (wires, tracks...)
bool m_EndIsDangling; // true if not connected (wires, tracks...)
public:
int m_Width; // 0 = line, > 0 = tracks, bus ...
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2010 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 sch_screen.cpp
* @brief Implementation of SCH_SCREEN and SCH_SCREENS classes.
*/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -6,7 +35,6 @@
#include "appl_wxstruct.h"
#include "class_drawpanel.h"
#include "sch_item_struct.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "plot_common.h"
......@@ -21,7 +49,6 @@
#include "sch_no_connect.h"
#include "sch_sheet.h"
#include "sch_component.h"
#include "sch_collectors.h"
#include "sch_text.h"
#include <boost/foreach.hpp>
......@@ -1480,3 +1507,33 @@ void SCH_SCREENS::DeleteAllMarkers( int aMarkerType )
}
}
}
int SCH_SCREENS::GetMarkerCount( int aMarkerType )
{
SCH_ITEM* item;
SCH_ITEM* nextItem;
SCH_MARKER* marker;
SCH_SCREEN* screen;
int count = 0;
for( screen = GetFirst(); screen != NULL; screen = GetNext() )
{
for( item = screen->GetDrawItems(); item != NULL; item = nextItem )
{
nextItem = item->Next();
if( item->Type() != SCH_MARKER_T )
continue;
marker = (SCH_MARKER*) item;
if( (aMarkerType != -1) && (marker->GetMarkerType() != aMarkerType) )
continue;
count++;
}
}
return count;
}
/////////////////////////////////////////////////////////////////////////////
// Name: sch_sheet.cpp
// Purpose: member functions for SCH_SHEET
// header = sch_sheet.h
// Author: jean-pierre Charras
// Modified by: Wayne Stambaugh
// Created: 08/02/2006 18:37:02
// RCS-ID:
// Copyright:
// License: License GNU
/////////////////////////////////////////////////////////////////////////////
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 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 sch_sheet.cpp
* @brief Implementation of SCH_SHEET class.
*/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -17,7 +35,6 @@
#include "drawtxt.h"
#include "trigo.h"
#include "richio.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "plot_common.h"
......
/////////////////////////////////////////////////////////////////////////////
// Name: sch_sheet_pin.cpp
// Purpose: member functions SCH_SHEET_PIN
// header = sch_sheet.h
// Author: jean-pierre Charras
// Modified by:
// Created: 08/02/2006 18:37:02
// RCS-ID:
// Copyright: License GNU
// License:
/////////////////////////////////////////////////////////////////////////////
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2006 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 sch_sheet_pin.cpp
* @brief Implementation of the SCH_SHEET_PIN class.
*/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -17,7 +35,6 @@
#include "plot_common.h"
#include "trigo.h"
#include "richio.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......@@ -48,7 +65,7 @@ SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxStr
else
SetEdge( 0 );
m_Shape = NET_INPUT;
m_IsDangling = TRUE;
m_IsDangling = true;
m_Number = 2;
}
......
/*********************************************/
/* Code for handling schematic sheet labels. */
/*********************************************/
/**
* @file sch_text.cpp
* @brief Code for handling schematic sheet labels.
*/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -729,7 +730,7 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) :
{
m_Layer = LAYER_LOCLABEL;
m_Shape = NET_INPUT;
m_IsDangling = TRUE;
m_IsDangling = true;
m_MultilineAllowed = false;
}
......@@ -937,7 +938,7 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) :
{
m_Layer = LAYER_GLOBLABEL;
m_Shape = NET_BIDI;
m_IsDangling = TRUE;
m_IsDangling = true;
m_MultilineAllowed = false;
}
......@@ -1369,7 +1370,7 @@ SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T
{
m_Layer = LAYER_HIERLABEL;
m_Shape = NET_INPUT;
m_IsDangling = TRUE;
m_IsDangling = true;
m_MultilineAllowed = false;
}
......
/*****************/
/* schedit.cpp */
/*****************/
/**
* @file schedit.cpp
*/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -9,7 +9,6 @@
#include "confirm.h"
#include "eda_doc.h"
#include "wxEeschemaStruct.h"
#include "class_sch_screen.h"
#include "kicad_device_context.h"
#include "general.h"
......
......@@ -5,7 +5,6 @@
#include "fctsys.h"
#include "class_drawpanel.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......
/******************/
/* schframe.cpp */
/******************/
/**
* @file schframe.cpp
*/
#ifdef __GNUG__
#pragma implementation
......@@ -19,7 +19,6 @@
#include "lib_pin.h"
#include "class_library.h"
#include "wxEeschemaStruct.h"
#include "class_sch_screen.h"
#include "sch_component.h"
#include "dialog_helpers.h"
......@@ -157,8 +156,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
EDA_DRAW_FRAME( father, SCHEMATIC_FRAME, title, pos, size, style )
{
m_FrameName = wxT( "SchematicFrame" );
m_Draw_Axis = FALSE; // TRUE to show axis
m_Draw_Sheet_Ref = TRUE; // TRUE to show sheet references
m_Draw_Axis = FALSE; // true to show axis
m_Draw_Sheet_Ref = true; // true to show sheet references
m_CurrentSheet = new SCH_SHEET_PATH();
m_Multiflag = 0;
m_TextFieldSize = DEFAULT_SIZE_TEXT;
......@@ -196,7 +195,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
if( DrawPanel )
DrawPanel->m_Block_Enable = TRUE;
DrawPanel->m_Block_Enable = true;
ReCreateMenuBar();
ReCreateHToolbar();
......@@ -597,7 +596,7 @@ void SCH_EDIT_FRAME::OnFindItems( wxCommandEvent& event )
wxASSERT_MSG( m_findReplaceData != NULL,
wxT( "Forgot to create find/replace data. Bad Programmer!" ) );
this->DrawPanel->m_IgnoreMouseEvents = TRUE;
this->DrawPanel->m_IgnoreMouseEvents = true;
if( m_dlgFindReplace )
{
......
......@@ -14,7 +14,6 @@
#include "class_drawpanel.h"
#include "confirm.h"
#include "wxEeschemaStruct.h"
#include "class_sch_screen.h"
#include "general.h"
#include "sch_sheet.h"
......
/**********************************************************/
/* sheetlab.cpp create and edit the SCH_SHEET_PIN items */
/**********************************************************/
/**
* @file sheetlab.cpp
* @brief Create and edit the SCH_SHEET_PIN items.
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "macros.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......
/*************************************************/
/* Functions to Load from file and save to file */
/* the graphic shapes used to draw a component */
/* When using the import/export symbol options */
/* files are the *.sym files */
/*************************************************/
/**
* @file symbedit.cpp
* @brief Functions to load from and save to file component libraries and symbols.
*/
#include "fctsys.h"
#include "appl_wxstruct.h"
......@@ -23,14 +21,7 @@
#include <wx/ffile.h>
/*
* Read a component shape file (symbol file *.sym ) and add data (graphic
* items) to the current component.
*
* A symbol file *.sym has the same format as a library, and contains only
* one symbol
*/
void LIB_EDIT_FRAME::LoadOneSymbol( void )
void LIB_EDIT_FRAME::LoadOneSymbol()
{
LIB_COMPONENT* Component;
wxString msg, err;
......@@ -40,7 +31,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol( void )
if( m_component == NULL || ( m_drawItem && m_drawItem->m_Flags ) )
return;
DrawPanel->m_IgnoreMouseEvents = TRUE;
DrawPanel->m_IgnoreMouseEvents = true;
wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath();
......@@ -113,14 +104,6 @@ void LIB_EDIT_FRAME::LoadOneSymbol( void )
}
/*
* Save the current symbol to a file.
*
* The symbol file format is like the standard libraries, but there is only
* one symbol.
*
* Invisible pins are not saved
*/
void LIB_EDIT_FRAME::SaveOneSymbol()
{
wxString msg;
......@@ -218,12 +201,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
}
/*
* Place anchor reference coordinators for current component
*
* All coordinates of the object are offset to the cursor position.
*/
void LIB_EDIT_FRAME::PlaceAncre()
void LIB_EDIT_FRAME::PlaceAnchor()
{
if( m_component == NULL )
return;
......
/******************/
/* tool_sch.cpp */
/******************/
/**
* @file tool_sch.cpp
*/
#include "fctsys.h"
#include "class_drawpanel.h"
......@@ -21,7 +21,7 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
return;
wxString msg;
m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true );
// Set up toolbar
m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, KiBitmap( new_xpm ),
......
/***********************/
/* viewlib_frame.cpp */
/***********************/
/**
* @file viewlib_frame.cpp
*/
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "eeschema_id.h"
#include "class_drawpanel.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
......@@ -134,7 +133,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
wxT( "LibWindow" ) );
m_LibListWindow->SetOrientation( wxLAYOUT_VERTICAL );
m_LibListWindow->SetAlignment( wxLAYOUT_LEFT );
m_LibListWindow->SetSashVisible( wxSASH_RIGHT, TRUE );
m_LibListWindow->SetSashVisible( wxSASH_RIGHT, true );
m_LibListWindow->SetExtraBorderSize( EXTRA_BORDER_SIZE );
m_LibList = new wxListBox( m_LibListWindow, ID_LIBVIEW_LIB_LIST,
wxPoint( 0, 0 ), wxDefaultSize,
......@@ -158,7 +157,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
wxT( "CmpWindow" ) );
m_CmpListWindow->SetOrientation( wxLAYOUT_VERTICAL );
m_CmpListWindow->SetSashVisible( wxSASH_RIGHT, TRUE );
m_CmpListWindow->SetSashVisible( wxSASH_RIGHT, true );
m_CmpListWindow->SetExtraBorderSize( EXTRA_BORDER_SIZE );
m_CmpList = new wxListBox( m_CmpListWindow, ID_LIBVIEW_CMP_LIST,
wxPoint( 0, 0 ), wxDefaultSize,
......@@ -489,7 +488,7 @@ void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event )
else
m_exportToEeschemaCmpName.Empty();
Close( TRUE );
Close( true );
}
......
......@@ -56,7 +56,7 @@ void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT:
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, TRUE );
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, true );
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, FALSE );
m_convert = 1;
DrawPanel->Refresh();
......@@ -64,7 +64,7 @@ void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT:
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, FALSE );
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, TRUE );
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, true );
m_convert = 2;
DrawPanel->Refresh();
break;
......
......@@ -434,9 +434,10 @@ public:
};
/********************************************************/
/* Class to handle the list of *screens* in a hierarchy */
/********************************************************/
/**
* Class SCH_SCREENS
* is a class to handle the list of *screens* in a hierarchy.
*/
// screens are unique, and correspond to .sch files.
class SCH_SCREENS
......@@ -490,6 +491,16 @@ public:
*/
void DeleteAllMarkers( int aMarkerType );
/**
* Function GetMarkerCount
* returns the number of ERC markers of \a aMarkerType from all of the screens in the list.
*
* @param aMarkerType Indicates the type of marker to count. A value less then zero
* indicates all markers are counted.
* @return int count of the markers found.
*/
int GetMarkerCount( int aMarkerType = -1 );
private:
void AddScreenToList( SCH_SCREEN* aScreen );
void BuildScreenList( EDA_ITEM* aItem );
......
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