Commit 37ad67df authored by Wayne Stambaugh's avatar Wayne Stambaugh

EESchema file name and location house keeping.

parent 32394e05
......@@ -4,6 +4,20 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.
2010-nov-11 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++EESchema
* Make schematic object file naming consistent.
* Move annotate dialog to dialogs subdirectory and set the "Annotation"
button as the default.
* Move ERC dialog to dialogs subdirectory and set the "Test Erc" button
as the default.
* Move the print dialog to dialogs subdirectory and set the "Print" button
as the default.
* Create print dialog header and move the OnPrint() method into
schframe.cpp.
2010-nov-10 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++EESchema
......
......@@ -8,26 +8,16 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
set(EESCHEMA_SRCS
annotate.cpp
annotate_dialog.cpp
backanno.cpp
block.cpp
block_libedit.cpp
build_BOM.cpp
busentry.cpp
bus-wire-junction.cpp
class_drawsheet.cpp
class_drawsheetpath.cpp
class_drc_erc_item.cpp
class_hierarchical_PIN_sheet.cpp
class_libentry.cpp
class_library.cpp
class_marker_sch.cpp
class_netlist_object.cpp
class_sch_cmp_field.cpp
class_sch_component.cpp
class_schematic_items.cpp
class_sch_screen.cpp
class_text-label.cpp
cleanup.cpp
cmp_library_keywords.cpp
cmp_library_lexer.cpp
......@@ -43,7 +33,8 @@ set(EESCHEMA_SRCS
dialogs/dialog_plot_schematic_HPGL_base.cpp
dialogs/dialog_plot_schematic_PS.cpp
dialogs/dialog_plot_schematic_PS_base.cpp
dialog_annotate_base.cpp
dialogs/annotate_dialog.cpp
dialogs/dialog_annotate_base.cpp
dialog_bodygraphictext_properties_base.cpp
dialog_build_BOM.cpp
dialog_build_BOM_base.cpp
......@@ -59,8 +50,8 @@ set(EESCHEMA_SRCS
dialog_eeschema_config_fbp.cpp
dialog_eeschema_options_base.cpp
dialog_eeschema_options.cpp
dialog_erc.cpp
dialog_erc_base.cpp
dialogs/dialog_erc.cpp
dialogs/dialog_erc_base.cpp
dialog_libedit_dimensions.cpp
dialog_libedit_dimensions_base.cpp
dialog_lib_edit_draw_item.cpp
......@@ -69,8 +60,8 @@ set(EESCHEMA_SRCS
dialog_lib_edit_pin_base.cpp
dialog_lib_new_component.cpp
dialog_lib_new_component_base.cpp
dialog_print_using_printer_base.cpp
dialog_print_using_printer.cpp
dialogs/dialog_print_using_printer_base.cpp
dialogs/dialog_print_using_printer.cpp
dialog_sch_sheet_props.cpp
dialog_sch_sheet_props_base.cpp
dialogs/dialog_schematic_find.cpp
......@@ -122,6 +113,15 @@ set(EESCHEMA_SRCS
operations_on_items_lists.cpp
pinedit.cpp
plot.cpp
sch_component.cpp
sch_field.cpp
sch_items.cpp
sch_marker.cpp
sch_screen.cpp
sch_sheet.cpp
sch_sheet_path.cpp
sch_sheet_pin.cpp
sch_text.cpp
schedit.cpp
schematic_undo_redo.cpp
schframe.cpp
......
......@@ -10,12 +10,12 @@
#include "class_drawpanel.h"
#include "confirm.h"
#include "wxstruct.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "class_library.h"
#include "protos.h"
#include "class_sch_screen.h"
#include "class_sch_component.h"
#include "sch_component.h"
#include "netlist.h"
#include "lib_pin.h"
......
......@@ -13,8 +13,8 @@
#include "build_version.h"
#include "general.h"
#include "class_drawsheetpath.h"
#include "class_sch_component.h"
#include "sch_sheet_path.h"
#include "sch_component.h"
/** function FillFootprintFieldForAllInstancesofComponent
......
......@@ -13,14 +13,14 @@
#include "class_sch_screen.h"
#include "general.h"
#include "class_marker_sch.h"
#include "class_library.h"
#include "lib_pin.h"
#include "protos.h"
#include "class_schematic_items.h"
#include "class_text-label.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_text.h"
#include "sch_component.h"
#include "sch_sheet.h"
#include <boost/foreach.hpp>
......
......@@ -21,9 +21,9 @@
#include "class_library.h"
#include "netlist.h"
#include "protos.h"
#include "class_drawsheet.h"
#include "sch_sheet.h"
#include "template_fieldnames.h"
#include "class_sch_component.h"
#include "sch_component.h"
#include "build_version.h"
......
......@@ -14,10 +14,10 @@
#include "lib_pin.h"
#include "general.h"
#include "protos.h"
#include "class_schematic_items.h"
#include "class_text-label.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "sch_items.h"
#include "sch_text.h"
#include "sch_component.h"
#include "sch_sheet.h"
/* Routines Locales */
......
......@@ -13,7 +13,7 @@
#include "general.h"
#include "protos.h"
#include "class_schematic_items.h"
#include "sch_items.h"
static int s_LastShape = '\\';
......
......@@ -9,7 +9,7 @@
#include "wxEeschemaStruct.h"
#include "general.h"
#include "class_sch_component.h"
#include "sch_component.h"
#include "class_netlist_object.h"
#if defined(DEBUG)
......
......@@ -6,7 +6,7 @@
#ifndef _CLASS_NETLIST_OBJECT_H_
#define _CLASS_NETLIST_OBJECT_H_
#include "class_drawsheetpath.h"
#include "sch_sheet_path.h"
#include "lib_pin.h" // LIB_PIN::ReturnPinStringNum( m_PinNum )
......
......@@ -12,7 +12,7 @@
#include "general.h"
#include "protos.h"
#include "netlist.h"
#include "class_schematic_items.h"
#include "sch_items.h"
/* Routine to start/end segment (BUS or wires) on junctions.
......
......@@ -16,10 +16,10 @@
#include "viewlib_frame.h"
#include "lib_draw_item.h"
#include "lib_pin.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "class_marker_sch.h"
#include "class_sch_component.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include "sch_marker.h"
#include "sch_component.h"
/** Function SchematicGeneralLocateAndDisplay
......
......@@ -14,7 +14,7 @@
#include "protos.h"
#include "lib_draw_item.h"
#include "lib_pin.h"
#include "class_sch_component.h"
#include "sch_component.h"
/***************************************************************/
......
......@@ -11,7 +11,7 @@
#include "protos.h"
#include "class_libentry.h"
#include "lib_pin.h"
#include "class_sch_component.h"
#include "sch_component.h"
/* Returns true if the point P is on the segment S. */
......
......@@ -10,10 +10,10 @@
#include "general.h"
#include "protos.h"
#include "class_marker_sch.h"
#include "class_schematic_items.h"
#include "class_drawsheet.h"
#include "class_text-label.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_sheet.h"
#include "sch_text.h"
// Imported function:
......
......@@ -11,7 +11,7 @@
#include "general.h"
#include "protos.h"
#include "class_drawsheet.h"
#include "sch_sheet.h"
/**************************************************************************/
......
......@@ -20,7 +20,7 @@
#include "general.h"
#include "libeditframe.h"
#include "class_drawsheetpath.h"
#include "sch_sheet_path.h"
// Keys for configuration
......
......@@ -14,7 +14,7 @@
#include "general.h"
#include "protos.h"
#include "class_library.h"
#include "class_sch_component.h"
#include "sch_component.h"
#include "dialog_edit_component_in_schematic.h"
......
......@@ -3,7 +3,7 @@
#define __dialog_edit_component_in_schematic__
#include "class_sch_cmp_field.h"
#include "sch_field.h"
#include "template_fieldnames.h"
#include "dialog_edit_component_in_schematic_fbp.h"
......
......@@ -15,7 +15,7 @@
#include "general.h"
#include "drawtxt.h"
#include "confirm.h"
#include "class_text-label.h"
#include "sch_text.h"
#include "dialog_edit_label.h"
......
......@@ -15,7 +15,7 @@
#include "protos.h"
#include "libeditframe.h"
#include "class_library.h"
#include "class_sch_cmp_field.h"
#include "sch_field.h"
#include "template_fieldnames.h"
#include "dialog_edit_libentry_fields_in_lib_base.h"
......
......@@ -12,8 +12,7 @@
#include "fctsys.h"
#include "class_drawpanel.h"
//#include "general.h"
#include "class_marker_sch.h"
#include "sch_marker.h"
/**
* Class ERC_HTML_LISTBOX
......
......@@ -69,6 +69,8 @@ void DIALOG_ANNOTATE::InitValues()
annotate_right_down_bitmap->SetBitmap(bitmap1);
wxBitmap bitmap2(add_text_xpm);
annotate_by_value_bitmap->SetBitmap(bitmap2);
m_btnApply->SetDefault();
}
......@@ -92,12 +94,10 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
message += _( "on the current sheet?" );
message += _( "\n\nThis operation will change the current annotation and cannot be undone." );
response = wxMessageBox( message, wxT( "" ),
wxICON_EXCLAMATION | wxOK | wxCANCEL );
response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL );
if (response == wxCANCEL)
return;
AnnotateComponents( m_Parent, GetLevel(), GetSortOrder(),
GetResetItems() , true );
AnnotateComponents( m_Parent, GetLevel(), GetSortOrder(), GetResetItems() , true );
m_btnClear->Enable();
}
......
......@@ -9,13 +9,17 @@
#include "fctsys.h"
#include "common.h"
#include "class_drawpanel.h"
#include "kicad_string.h"
#include "gestfich.h"
#include "bitmaps.h"
#include "appl_wxstruct.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
#include "netlist.h"
#include "class_marker_sch.h"
#include "sch_marker.h"
#include "sch_sheet.h"
#include "lib_pin.h"
#include "protos.h"
......@@ -24,6 +28,9 @@
#include "erc.h"
bool DIALOG_ERC::m_writeErcFile = false;
BEGIN_EVENT_TABLE( DIALOG_ERC, DIALOG_ERC_BASE )
EVT_COMMAND_RANGE( ID_MATRIX_0, ID_MATRIX_0 + ( PIN_NMAX * PIN_NMAX ) - 1,
wxEVT_COMMAND_BUTTON_CLICKED,
......@@ -50,15 +57,13 @@ void DIALOG_ERC::Init()
for( int jj = 0; jj < PIN_NMAX; jj++ )
m_ButtonList[ii][jj] = NULL;
m_WriteResultOpt->SetValue( WriteFichierERC );
m_WriteResultOpt->SetValue( m_writeErcFile );
wxString num;
num.Printf( wxT( "%d" ), g_EESchemaVar.NbErrorErc );
m_TotalErrCount->SetLabel( num );
num.Printf( wxT(
"%d" ), g_EESchemaVar.NbErrorErc -
g_EESchemaVar.NbWarningErc );
num.Printf( wxT( "%d" ), g_EESchemaVar.NbErrorErc - g_EESchemaVar.NbWarningErc );
m_LastErrCount->SetLabel( num );
num.Printf( wxT( "%d" ), g_EESchemaVar.NbWarningErc );
......@@ -68,6 +73,9 @@ void DIALOG_ERC::Init()
// Init Panel Matrix
ReBuildMatrixPanel();
// Set the run ERC button as the default button.
m_buttonERC->SetDefault();
}
......@@ -377,10 +385,171 @@ void DIALOG_ERC::ChangeErrorLevel( wxCommandEvent& event )
if( new_bitmap_xpm )
{
delete Butt;
Butt = new wxBitmapButton( m_PanelERCOptions, id,
wxBitmap( new_bitmap_xpm ), pos );
Butt = new wxBitmapButton( m_PanelERCOptions, id, wxBitmap( new_bitmap_xpm ), pos );
m_ButtonList[y][x] = Butt;
DiagErc[y][x] = DiagErc[x][y] = level;
}
}
void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
{
wxFileName fn;
unsigned NetItemRef;
unsigned OldItem;
unsigned StartNet;
int NetNbItems, MinConn;
if( !DiagErcTableInit )
{
memcpy( DiagErc, DefaultDiagErc, sizeof(DefaultDiagErc) );
DiagErcTableInit = TRUE;
}
m_writeErcFile = m_WriteResultOpt->GetValue();
ReAnnotatePowerSymbolsOnly();
if( m_Parent->CheckAnnotate( aMessagesList, false ) )
{
if( aMessagesList )
{
wxString msg = _( "Annotation required!" );
msg += wxT( "\n" );
aMessagesList->Add( msg );
}
return;
}
/* Erase all DRC markers */
DeleteAllMarkers( MARK_ERC );
g_EESchemaVar.NbErrorErc = 0;
g_EESchemaVar.NbWarningErc = 0;
/* Cleanup the entire hierarchy */
SCH_SCREENS ScreenList;
for( SCH_SCREEN* Screen = ScreenList.GetFirst();
Screen != NULL;
Screen = ScreenList.GetNext() )
{
bool ModifyWires;
ModifyWires = Screen->SchematicCleanUp( NULL );
/* if wire list has changed, delete Undo Redo list to avoid
* pointers on deleted data problems */
if( ModifyWires )
Screen->ClearUndoRedoList();
}
/* Test duplicate sheet names
* inside a given sheet, one cannot have sheets with duplicate names (file
* names can be duplicated).
*/
int errcnt = TestDuplicateSheetNames( true );
g_EESchemaVar.NbErrorErc += errcnt;
m_Parent->BuildNetListBase();
/* Reset the flag m_FlagOfConnection, that will be used next, in
* calculations */
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
g_NetObjectslist[ii]->m_FlagOfConnection = UNCONNECTED;
StartNet = OldItem = 0;
NetNbItems = 0;
MinConn = NOC;
for( NetItemRef = 0; NetItemRef < g_NetObjectslist.size(); NetItemRef++ )
{
if( g_NetObjectslist[OldItem]->GetNet() != g_NetObjectslist[NetItemRef]->GetNet() )
{ // New net found:
MinConn = NOC;
NetNbItems = 0;
StartNet = NetItemRef;
}
switch( g_NetObjectslist[NetItemRef]->m_Type )
{
case NET_ITEM_UNSPECIFIED:
case NET_SEGMENT:
case NET_BUS:
case NET_JONCTION:
case NET_LABEL:
case NET_BUSLABELMEMBER:
case NET_PINLABEL:
case NET_GLOBLABEL:
case NET_GLOBBUSLABELMEMBER:
// These items do not create erc problems
break;
case NET_HIERLABEL:
case NET_HIERBUSLABELMEMBER:
case NET_SHEETLABEL:
case NET_SHEETBUSLABELMEMBER:
// ERC problems when pin sheets do not match hierarchical labels.
// Each pin sheet must match a hierarchical label
// Each hierarchical label must match a pin sheet
TestLabel( m_Parent->DrawPanel, NetItemRef, StartNet );
break;
case NET_NOCONNECT:
// ERC problems when a noconnect symbol is connected to more than
// one pin.
MinConn = NET_NC;
if( NetNbItems != 0 )
Diagnose( m_Parent->DrawPanel, g_NetObjectslist[NetItemRef], NULL, MinConn, UNC );
break;
case NET_PIN:
// Look for ERC problems between pins:
TestOthersItems( m_Parent->DrawPanel, NetItemRef, StartNet, &NetNbItems, &MinConn );
break;
}
OldItem = NetItemRef;
}
// Displays global results:
wxString num;
num.Printf( wxT( "%d" ), g_EESchemaVar.NbErrorErc );
m_TotalErrCount->SetLabel( num );
num.Printf( wxT( "%d" ), g_EESchemaVar.NbErrorErc - g_EESchemaVar.NbWarningErc );
m_LastErrCount->SetLabel( num );
num.Printf( wxT( "%d" ), g_EESchemaVar.NbWarningErc );
m_LastWarningCount->SetLabel( num );
// Display diags:
DisplayERC_MarkersList();
// Display new markers:
m_Parent->DrawPanel->Refresh();
if( m_writeErcFile )
{
fn = g_RootSheet->m_AssociatedScreen->m_FileName;
fn.SetExt( wxT( "erc" ) );
wxFileDialog dlg( this, _( "ERC File" ), fn.GetPath(), fn.GetFullName(),
_( "Electronic rule check file (.erc)|*.erc" ),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return;
if( WriteDiagnosticERC( dlg.GetPath() ) )
{
Close( TRUE );
ExecuteFile( this, wxGetApp().GetEditorName(), QuoteFullPath( fn ) );
}
}
}
......@@ -14,7 +14,6 @@
#include "dialog_erc_base.h"
/* Variable locales */
extern int WriteFichierERC;
extern int DiagErc[PIN_NMAX][PIN_NMAX];
extern bool DiagErcTableInit; // go to TRUE after DiagErc init
extern int DefaultDiagErc[PIN_NMAX][PIN_NMAX];
......@@ -36,6 +35,7 @@ private:
WinEDA_SchematicFrame* m_Parent;
wxBitmapButton* m_ButtonList[PIN_NMAX][PIN_NMAX];
bool m_Initialized;
static bool m_writeErcFile;
public:
......
......@@ -37,7 +37,7 @@
#include "general.h"
#include "protos.h"
#include "class_drawsheetpath.h"
#include "sch_sheet_path.h"
#include "dialog_plot_schematic_DXF_base.h"
......
......@@ -36,7 +36,7 @@
#include "general.h"
#include "protos.h"
#include "class_drawsheetpath.h"
#include "sch_sheet_path.h"
#include "dialog_plot_schematic_HPGL_base.h"
......
......@@ -36,7 +36,7 @@
#include "general.h"
#include "protos.h"
#include "class_drawsheetpath.h"
#include "sch_sheet_path.h"
enum PageFormatReq {
......
......@@ -13,33 +13,10 @@
#include "general.h"
#include "eeschema_config.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include "dialog_print_using_printer_base.h"
/**
* Print schematic dialog.
*
* Class derived from DIALOG_PRINT_USING_PRINTER_base created by wxFormBuilder
*/
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE
{
public:
DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* aParent );
~DIALOG_PRINT_USING_PRINTER() {};
WinEDA_SchematicFrame* GetParent() const;
private:
void OnCloseWindow( wxCloseEvent& event );
void OnInitDialog( wxInitDialogEvent& event );
void OnPageSetup( wxCommandEvent& event );
void OnPrintPreview( wxCommandEvent& event );
void OnPrintButtonClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event ){ Close(); }
};
#include "dialog_print_using_printer.h"
/**
......@@ -110,25 +87,6 @@ BEGIN_EVENT_TABLE( SCH_PREVIEW_FRAME, wxPreviewFrame )
END_EVENT_TABLE()
void WinEDA_SchematicFrame::OnPrint( wxCommandEvent& event )
{
wxFileName fn;
DIALOG_PRINT_USING_PRINTER dlg( this );
dlg.ShowModal();
fn = g_RootSheet->m_AssociatedScreen->m_FileName;
wxString default_name = NAMELESS_PROJECT;
default_name += wxT( ".sch" );
if( fn.GetFullName() != default_name )
{
fn.SetExt( ProjectFileExtension );
wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
}
}
DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* aParent ) :
DIALOG_PRINT_USING_PRINTER_BASE( aParent )
{
......@@ -164,6 +122,8 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
}
SetFocus();
m_buttonPrint->SetDefault();
}
......
#ifndef _DIALOG_PRINT_USING_PRINTER_H_
#define _DIALOG_PRINT_USING_PRINTER_H_
#include "dialog_print_using_printer_base.h"
/**
* Print schematic dialog.
*
* Class derived from DIALOG_PRINT_USING_PRINTER_base created by wxFormBuilder
*/
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE
{
public:
DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* aParent );
~DIALOG_PRINT_USING_PRINTER() {};
WinEDA_SchematicFrame* GetParent() const;
private:
void OnCloseWindow( wxCloseEvent& event );
void OnInitDialog( wxInitDialogEvent& event );
void OnPageSetup( wxCommandEvent& event );
void OnPrintPreview( wxCommandEvent& event );
void OnPrintButtonClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event ){ Close(); }
};
#endif // _DIALOG_PRINT_USING_PRINTER_H_
......@@ -13,7 +13,7 @@
#include "general.h"
#include "protos.h"
#include "class_library.h"
#include "class_sch_component.h"
#include "sch_component.h"
static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC );
......
......@@ -15,7 +15,7 @@
#include "general.h"
#include "protos.h"
#include "class_text-label.h"
#include "sch_text.h"
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
......
......@@ -14,10 +14,10 @@
#include "general.h"
#include "protos.h"
#include "class_library.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "class_sch_component.h"
#include "class_schematic_items.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include "sch_component.h"
#include "sch_items.h"
#include "build_version.h"
......
......@@ -18,7 +18,7 @@
#include "eeschema_config.h"
#include "worksheet.h"
#include "hotkeys.h"
#include "class_drawsheet.h"
#include "sch_sheet.h"
#include "dialog_eeschema_options.h"
#include "dialog_hotkeys_editor.h"
......
......@@ -6,22 +6,18 @@
#include "common.h"
#include "class_drawpanel.h"
#include "kicad_string.h"
#include "gestfich.h"
#include "appl_wxstruct.h"
#include "bitmaps.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "general.h"
#include "netlist.h"
#include "class_marker_sch.h"
#include "lib_pin.h"
#include "protos.h"
#include "erc.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "dialog_erc.h"
#include "sch_marker.h"
#include "sch_component.h"
#include "sch_sheet.h"
/* ERC tests :
......@@ -31,21 +27,6 @@
*/
static bool WriteDiagnosticERC( const wxString& FullFileName );
static void Diagnose( WinEDA_DrawPanel* panel,
NETLIST_OBJECT* NetItemRef,
NETLIST_OBJECT* NetItemTst, int MinConnexion, int Diag );
static void TestOthersItems( WinEDA_DrawPanel* panel,
unsigned NetItemRef,
unsigned NetStart,
int* NetNbItems, int* MinConnexion );
static void TestLabel( WinEDA_DrawPanel* panel,
unsigned NetItemRef,
unsigned StartNet );
/* Local variables */
int WriteFichierERC = FALSE;
/*
* Electrical type of pins:
* PIN_INPUT = usual pin input: must be connected
......@@ -143,13 +124,6 @@ int DefaultDiagErc[PIN_NMAX][PIN_NMAX] =
};
/* Minimal connection table */
#define NPI 4 /* Net with Pin isolated, but this pin has type Not Connected, and must be left N.C. */
#define DRV 3 /* Net driven by a signal (a pin output for instance) */
#define NET_NC 2 /* Net "connected" to a "NoConnect symbol" */
#define NOD 1 /* Net not driven ( Such as 2 or more connected inputs )*/
#define NOC 0 /* initial state of a net: no connection */
/* Look up table which gives the minimal drive for a pair of connected pins on
* a net
* Initial state of a net is NOC (Net with No Connection)
......@@ -185,7 +159,7 @@ static int MinimalReq[PIN_NMAX][PIN_NMAX] =
* @param aCreateMarker: true = create error markers in schematic,
* false = calculate error count only
*/
int TestDuplicateSheetNames(bool aCreateMarker)
int TestDuplicateSheetNames( bool aCreateMarker )
{
int err_count = 0;
SCH_SCREENS ScreenList; // Created the list of screen
......@@ -237,178 +211,11 @@ int TestDuplicateSheetNames(bool aCreateMarker)
}
void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
{
wxFileName fn;
unsigned NetItemRef;
unsigned OldItem;
unsigned StartNet;
int NetNbItems, MinConn;
if( !DiagErcTableInit )
{
memcpy( DiagErc, DefaultDiagErc, sizeof(DefaultDiagErc) );
DiagErcTableInit = TRUE;
}
WriteFichierERC = m_WriteResultOpt->GetValue();
ReAnnotatePowerSymbolsOnly();
if( m_Parent->CheckAnnotate( aMessagesList, false ) )
{
if( aMessagesList )
{
wxString msg = _( "Annotation required!" );
msg += wxT( "\n" );
aMessagesList->Add( msg );
}
return;
}
/* Erase all DRC markers */
DeleteAllMarkers( MARK_ERC );
g_EESchemaVar.NbErrorErc = 0;
g_EESchemaVar.NbWarningErc = 0;
/* Cleanup the entire hierarchy */
SCH_SCREENS ScreenList;
for( SCH_SCREEN* Screen = ScreenList.GetFirst();
Screen != NULL;
Screen = ScreenList.GetNext() )
{
bool ModifyWires;
ModifyWires = Screen->SchematicCleanUp( NULL );
/* if wire list has changed, delete Undo Redo list to avoid
* pointers on deleted data problems */
if( ModifyWires )
Screen->ClearUndoRedoList();
}
/* Test duplicate sheet names
* inside a given sheet, one cannot have sheets with duplicate names (file
* names can be duplicated).
*/
int errcnt = TestDuplicateSheetNames( true );
g_EESchemaVar.NbErrorErc += errcnt;
m_Parent->BuildNetListBase();
/* Reset the flag m_FlagOfConnection, that will be used next, in
* calculations */
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
g_NetObjectslist[ii]->m_FlagOfConnection = UNCONNECTED;
StartNet = OldItem = 0;
NetNbItems = 0;
MinConn = NOC;
for( NetItemRef = 0; NetItemRef < g_NetObjectslist.size(); NetItemRef++ )
{
if( g_NetObjectslist[OldItem]->GetNet() !=
g_NetObjectslist[NetItemRef]->GetNet() )
{ // New ne found:
MinConn = NOC;
NetNbItems = 0;
StartNet = NetItemRef;
}
switch( g_NetObjectslist[NetItemRef]->m_Type )
{
case NET_ITEM_UNSPECIFIED:
case NET_SEGMENT:
case NET_BUS:
case NET_JONCTION:
case NET_LABEL:
case NET_BUSLABELMEMBER:
case NET_PINLABEL:
case NET_GLOBLABEL:
case NET_GLOBBUSLABELMEMBER:
// These items do not create erc problems
break;
case NET_HIERLABEL:
case NET_HIERBUSLABELMEMBER:
case NET_SHEETLABEL:
case NET_SHEETBUSLABELMEMBER:
// ERC problems when pin sheets do not match hierarchical labels.
// Each pin sheet must match a hierarchical label
// Each hierarchical label must match a pin sheet
TestLabel( m_Parent->DrawPanel, NetItemRef, StartNet );
break;
case NET_NOCONNECT:
// ERC problems when a noconnect symbol is connected to more than
// one pin.
MinConn = NET_NC;
if( NetNbItems != 0 )
Diagnose( m_Parent->DrawPanel,
g_NetObjectslist[NetItemRef], NULL, MinConn, UNC );
break;
case NET_PIN:
// Look for ERC problems between pins:
TestOthersItems( m_Parent->DrawPanel,
NetItemRef, StartNet, &NetNbItems, &MinConn );
break;
}
OldItem = NetItemRef;
}
// Displays global results:
wxString num;
num.Printf( wxT( "%d" ), g_EESchemaVar.NbErrorErc );
m_TotalErrCount->SetLabel( num );
num.Printf( wxT(
"%d" ), g_EESchemaVar.NbErrorErc -
g_EESchemaVar.NbWarningErc );
m_LastErrCount->SetLabel( num );
num.Printf( wxT( "%d" ), g_EESchemaVar.NbWarningErc );
m_LastWarningCount->SetLabel( num );
// Display diags:
DisplayERC_MarkersList();
// Display new markers:
m_Parent->DrawPanel->Refresh();
if( WriteFichierERC == TRUE )
{
fn = g_RootSheet->m_AssociatedScreen->m_FileName;
fn.SetExt( wxT( "erc" ) );
wxFileDialog dlg( this, _( "ERC File" ), fn.GetPath(), fn.GetFullName(),
_( "Electronic rule check file (.erc)|*.erc" ),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return;
if( WriteDiagnosticERC( dlg.GetPath() ) )
{
Close( TRUE );
ExecuteFile( this, wxGetApp().GetEditorName(),
QuoteFullPath( fn ) );
}
}
}
/* Creates an ERC marker to show the ERC problem about aNetItemRef
* or between aNetItemRef and aNetItemTst
* if MinConn < 0: this is an error on labels
*/
static void Diagnose( WinEDA_DrawPanel* aPanel,
void Diagnose( WinEDA_DrawPanel* aPanel,
NETLIST_OBJECT* aNetItemRef,
NETLIST_OBJECT* aNetItemTst,
int aMinConn, int aDiag )
......@@ -464,8 +271,7 @@ static void Diagnose( WinEDA_DrawPanel* aPanel,
string_pinnum = CONV_FROM_UTF8( ascii_buf );
cmp_ref = wxT( "?" );
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
cmp_ref = ( (SCH_COMPONENT*) aNetItemRef->m_Link )->GetRef(
&aNetItemRef->m_SheetList );
cmp_ref = ( (SCH_COMPONENT*) aNetItemRef->m_Link )->GetRef( &aNetItemRef->m_SheetList );
if( aNetItemTst == NULL )
{
......@@ -498,8 +304,7 @@ static void Diagnose( WinEDA_DrawPanel* aPanel,
if( aDiag == UNC )
{
msg.Printf(
_( "More than 1 Pin connected to UnConnect symbol" ) );
msg.Printf( _( "More than 1 Pin connected to UnConnect symbol" ) );
Marker->SetData( ERCE_NOCONNECT_CONNECTED,
aNetItemRef->m_Start,
msg,
......@@ -543,7 +348,7 @@ static void Diagnose( WinEDA_DrawPanel* aPanel,
/* Routine testing electrical conflicts between NetItemRef and other items
* of the same net
*/
static void TestOthersItems( WinEDA_DrawPanel* panel,
void TestOthersItems( WinEDA_DrawPanel* panel,
unsigned NetItemRef,
unsigned netstart,
int* NetNbItems, int* MinConnexion )
......@@ -687,7 +492,7 @@ static void TestOthersItems( WinEDA_DrawPanel* panel,
/* Create the Diagnostic file (<xxx>.erc file)
*/
static bool WriteDiagnosticERC( const wxString& FullFileName )
bool WriteDiagnosticERC( const wxString& FullFileName )
{
SCH_ITEM* DrawStruct;
SCH_MARKER* Marker;
......@@ -706,9 +511,7 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
SCH_SHEET_LIST SheetList;
for( Sheet = SheetList.GetFirst();
Sheet != NULL;
Sheet = SheetList.GetNext() )
for( Sheet = SheetList.GetFirst(); Sheet != NULL; Sheet = SheetList.GetNext() )
{
if( Sheet->Last() == g_RootSheet )
{
......@@ -764,9 +567,7 @@ static bool IsLabelsConnected( NETLIST_OBJECT* a, NETLIST_OBJECT* b )
/* Routine to perform erc on a sheetLabel that is connected to a corresponding
* sub sheet Glabel
*/
void TestLabel( WinEDA_DrawPanel* panel,
unsigned NetItemRef,
unsigned StartNet )
void TestLabel( WinEDA_DrawPanel* panel, unsigned NetItemRef, unsigned StartNet )
{
unsigned NetItemTst;
int erc = 1;
......
......@@ -25,6 +25,10 @@
#ifndef _ERC_H
#define _ERC_H
class WinEDA_DrawPanel;
class NETLIST_OBJECT;
/* For ERC markers: error types (used in diags, and to set the color):
*/
enum errortype
......@@ -46,5 +50,25 @@ enum errortype
#define ERCE_HIERACHICAL_LABEL 6 // mismatch between hierarchical labels and pins sheets
#define ERCE_NOCONNECT_CONNECTED 7 // a no connect symbol is connected to more than 1 pin
/* Minimal connection table */
#define NPI 4 // Net with Pin isolated, this pin has type Not Connected and must be left N.C.
#define DRV 3 // Net driven by a signal (a pin output for instance)
#define NET_NC 2 // Net "connected" to a "NoConnect symbol"
#define NOD 1 // Net not driven ( Such as 2 or more connected inputs )
#define NOC 0 // initial state of a net: no connection
extern bool WriteDiagnosticERC( const wxString& FullFileName );
extern void Diagnose( WinEDA_DrawPanel* panel, NETLIST_OBJECT* NetItemRef,
NETLIST_OBJECT* NetItemTst, int MinConnexion, int Diag );
extern void TestOthersItems( WinEDA_DrawPanel* panel, unsigned NetItemRef, unsigned NetStart,
int* NetNbItems, int* MinConnexion );
extern void TestLabel( WinEDA_DrawPanel* panel, unsigned NetItemRef, unsigned StartNet );
extern int TestDuplicateSheetNames( bool aCreateMarker );
#endif // _ERC_H
......@@ -13,8 +13,8 @@
#include "wxEeschemaStruct.h"
#include "protos.h"
#include "class_sch_component.h"
#include "class_text-label.h"
#include "sch_component.h"
#include "sch_text.h"
/** Event function WinEDA_SchematicFrame::OnCopySchematicItemRequest
......
......@@ -14,7 +14,7 @@
#include "eeschema_id.h"
#include "class_library.h"
#include "libeditframe.h"
#include "class_drawsheet.h"
#include "sch_sheet.h"
......
......@@ -18,13 +18,13 @@
#include "wxEeschemaStruct.h"
#include "general.h"
#include "class_marker_sch.h"
#include "protos.h"
#include "class_library.h"
#include "lib_pin.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "sch_marker.h"
#include "sch_component.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include "kicad_device_context.h"
......
......@@ -14,7 +14,7 @@
#include "general.h"
#include "protos.h"
#include "class_library.h"
#include "class_sch_component.h"
#include "sch_component.h"
#include "viewlib_frame.h"
#include "get_component_dialog.h"
......
......@@ -12,8 +12,8 @@
#include "wxEeschemaStruct.h"
#include "general.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include "wx/imaglist.h"
#include "wx/treectrl.h"
......
......@@ -12,9 +12,9 @@
#include "protos.h"
#include "libeditframe.h"
#include "class_libentry.h"
#include "class_schematic_items.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "sch_items.h"
#include "sch_component.h"
#include "sch_sheet.h"
#include "dialogs/dialog_schematic_find.h"
......
......@@ -13,7 +13,7 @@
#include "netlist.h"
#include "protos.h"
#include "class_library.h"
#include "class_sch_component.h"
#include "sch_component.h"
/*
......
......@@ -11,11 +11,11 @@
#include "general.h"
#include "protos.h"
#include "class_marker_sch.h"
#include "class_schematic_items.h"
#include "class_sch_component.h"
#include "class_text-label.h"
#include "class_drawsheet.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_component.h"
#include "sch_text.h"
#include "sch_sheet.h"
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window );
......
......@@ -9,12 +9,12 @@
#include "class_sch_screen.h"
#include "general.h"
#include "class_marker_sch.h"
#include "protos.h"
#include "class_library.h"
#include "class_schematic_items.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_component.h"
#include "sch_sheet.h"
#include "lib_pin.h"
#include "template_fieldnames.h"
......
......@@ -45,9 +45,9 @@
#include "protos.h"
#include "class_library.h"
#include "lib_pin.h"
#include "class_sch_component.h"
#include "class_text-label.h"
#include "class_drawsheet.h"
#include "sch_component.h"
#include "sch_text.h"
#include "sch_sheet.h"
#include "template_fieldnames.h"
#include "xnode.h" // also nests: <wx/xml/xml.h>
......
......@@ -12,10 +12,10 @@
#include "protos.h"
#include "class_library.h"
#include "lib_pin.h"
#include "class_schematic_items.h"
#include "class_sch_component.h"
#include "class_text-label.h"
#include "class_drawsheet.h"
#include "sch_items.h"
#include "sch_component.h"
#include "sch_text.h"
#include "sch_sheet.h"
#include "algorithm"
......
......@@ -24,7 +24,7 @@
#include "netlist.h"
#include "protos.h"
#include "netlist_control.h"
#include "class_drawsheet.h"
#include "sch_sheet.h"
//Imported function:
......
......@@ -11,12 +11,12 @@
#include "wxEeschemaStruct.h"
#include "general.h"
#include "class_marker_sch.h"
#include "protos.h"
#include "class_text-label.h"
#include "class_schematic_items.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "sch_text.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_component.h"
#include "sch_sheet.h"
static wxArrayString s_CmpNameList;
......
......@@ -12,15 +12,15 @@
#include "wxEeschemaStruct.h"
#include "general.h"
#include "class_marker_sch.h"
#include "protos.h"
#include "hotkeys.h"
#include "class_library.h"
#include "class_text-label.h"
#include "class_schematic_items.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "sch_marker.h"
#include "sch_text.h"
#include "sch_items.h"
#include "sch_component.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include <iostream>
using namespace std;
......
......@@ -12,11 +12,11 @@
#include "wxEeschemaStruct.h"
#include "general.h"
#include "class_marker_sch.h"
#include "protos.h"
#include "class_drawsheet.h"
#include "class_sch_component.h"
#include "class_schematic_items.h"
#include "sch_marker.h"
#include "sch_sheet.h"
#include "sch_component.h"
#include "sch_items.h"
void RotateListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& rotationPoint )
......
......@@ -14,10 +14,10 @@
#include "protos.h"
#include "class_library.h"
#include "lib_pin.h"
#include "class_schematic_items.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "class_text-label.h"
#include "sch_items.h"
#include "sch_component.h"
#include "sch_sheet.h"
#include "sch_text.h"
#include "template_fieldnames.h"
......
/**************************************************************/
/* class_sch_component.cpp : handle the class SCH_COMPONENT */
/**************************************************************/
/*******************************************************/
/* sch_component.cpp : handle the class SCH_COMPONENT */
/*******************************************************/
#include "fctsys.h"
#include "appl_wxstruct.h"
......@@ -19,9 +19,9 @@
#include "lib_rectangle.h"
#include "lib_pin.h"
#include "lib_text.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "sch_component.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include "template_fieldnames.h"
#include "dialogs/dialog_schematic_find.h"
......
......@@ -6,7 +6,7 @@
#define COMPONENT_CLASS_H
#include "class_sch_cmp_field.h"
#include "sch_field.h"
#include "transform.h"
#include "general.h"
......
/**************************************************************/
/* class_sch_cmp_field.cpp : handle the class SCH_FIELD */
/**************************************************************/
/***********************************************/
/* sch_field.cpp : handle the class SCH_FIELD */
/***********************************************/
/* Fields are texts attached to a component, having a special meaning
* Fields 0 and 1 are very important: reference and value
......@@ -24,8 +24,8 @@
#include "general.h"
#include "protos.h"
#include "class_library.h"
#include "class_sch_component.h"
#include "class_sch_cmp_field.h"
#include "sch_component.h"
#include "sch_field.h"
#include "template_fieldnames.h"
......
......@@ -12,7 +12,7 @@
#include "general.h"
#include "protos.h"
#include "class_schematic_items.h"
#include "sch_items.h"
#include <boost/foreach.hpp>
......
......@@ -9,7 +9,7 @@
#include "trigo.h"
#include "general.h"
#include "class_marker_sch.h"
#include "sch_marker.h"
#include "erc.h"
......
......@@ -13,8 +13,8 @@
#include "general.h"
#include "protos.h"
#include "class_library.h"
#include "class_schematic_items.h"
#include "class_drawsheet.h"
#include "sch_items.h"
#include "sch_sheet.h"
#include <boost/foreach.hpp>
......
/////////////////////////////////////////////////////////////////////////////
// Name: class_drawsheet.cpp
// Name: sch_sheet.cpp
// Purpose: member functions for SCH_SHEET
// header = class_drawsheet.h
// header = sch_sheet.h
// Author: jean-pierre Charras
// Modified by:
// Created: 08/02/2006 18:37:02
......@@ -24,9 +24,9 @@
#include "general.h"
#include "protos.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "class_sch_component.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include "sch_component.h"
SCH_SHEET::SCH_SHEET( const wxPoint& pos ) : SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE )
......
......@@ -7,7 +7,7 @@
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/foreach.hpp>
#include "class_text-label.h"
#include "sch_text.h"
class LINE_READER;
......
/////////////////////////////////////////////////////////////////////////////
// Name: class_drawsheet.cpp
// Purpose: member functions for SCH_SHEET
// header = class_drawsheet.h
// Name: sch_sheet_path.cpp
// Purpose: member functions for SCH_SHEET_PATH
// header = sch_sheet_path.h
// Author: jean-pierre Charras
// Modified by:
// License: License GNU
......@@ -15,9 +15,9 @@
#include "class_sch_screen.h"
#include "sch_item_struct.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "class_sch_component.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include "sch_component.h"
#include "template_fieldnames.h"
#include "dialogs/dialog_schematic_find.h"
......
/////////////////////////////////////////////////////////////////////////////
// Name: class_hierarchical_PIN_sheet.cpp
// Name: sch_sheet_pin.cpp
// Purpose: member functions SCH_SHEET_PIN
// header = class_drawsheet.h
// header = sch_sheet.h
// Author: jean-pierre Charras
// Modified by:
// Created: 08/02/2006 18:37:02
......@@ -23,7 +22,7 @@
#include "general.h"
#include "protos.h"
#include "class_drawsheet.h"
#include "sch_sheet.h"
/* m_Edge define on which edge the pin is positionned:
......
......@@ -14,7 +14,7 @@
#include "general.h"
#include "protos.h"
#include "class_text-label.h"
#include "sch_text.h"
/************************/
......
......@@ -13,14 +13,14 @@
#include "class_sch_screen.h"
#include "kicad_device_context.h"
#include "class_marker_sch.h"
#include "general.h"
#include "eeschema_id.h"
#include "protos.h"
#include "class_library.h"
#include "class_sch_component.h"
#include "class_schematic_items.h"
#include "class_drawsheet.h"
#include "sch_marker.h"
#include "sch_component.h"
#include "sch_items.h"
#include "sch_sheet.h"
void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
......
......@@ -10,10 +10,10 @@
#include "general.h"
#include "protos.h"
#include "class_marker_sch.h"
#include "class_schematic_items.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_component.h"
#include "sch_sheet.h"
/* Functions to undo and redo edit commands.
......
......@@ -22,16 +22,17 @@
#include "wxEeschemaStruct.h"
#include "class_sch_screen.h"
#include "annotate_dialog.h"
#include "dialog_build_BOM.h"
#include "dialog_erc.h"
#include "netlist_control.h"
#include "dialog_erc.h"
#include "libeditframe.h"
#include "viewlib_frame.h"
#include "hotkeys.h"
#include "class_drawsheet.h"
#include "eeschema_config.h"
#include "sch_sheet.h"
#include "dialogs/annotate_dialog.h"
#include "dialogs/dialog_erc.h"
#include "dialogs/dialog_print_using_printer.h"
#include "dialogs/dialog_schematic_find.h"
......@@ -759,3 +760,21 @@ void WinEDA_SchematicFrame::SetLanguage( wxCommandEvent& event )
m_LibeditFrame->WinEDA_BasicFrame::SetLanguage( event );
}
void WinEDA_SchematicFrame::OnPrint( wxCommandEvent& event )
{
wxFileName fn;
DIALOG_PRINT_USING_PRINTER dlg( this );
dlg.ShowModal();
fn = g_RootSheet->m_AssociatedScreen->m_FileName;
wxString default_name = NAMELESS_PROJECT;
default_name += wxT( ".sch" );
if( fn.GetFullName() != default_name )
{
fn.SetExt( ProjectFileExtension );
wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
}
}
......@@ -21,7 +21,7 @@
#include "general.h"
#include "protos.h"
#include "class_drawsheet.h"
#include "sch_sheet.h"
#include "dialog_sch_sheet_props.h"
......
......@@ -13,7 +13,7 @@
#include "general.h"
#include "protos.h"
#include "class_drawsheet.h"
#include "sch_sheet.h"
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
......
#include "template_fieldnames.h"
//#include "class_sch_component.h"
#include "dsnlexer.h"
#include "macros.h"
......
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