More EESchema dialog file housekeeping

This commit is contained in:
Wayne Stambaugh 2010-11-17 16:47:27 -05:00
parent fdb18547a6
commit e3b4eeb160
36 changed files with 2333 additions and 2316 deletions

View File

@ -4,6 +4,18 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.
2010-nov-17 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++EESchema
* Move library text edit, library draw item edit, SVG print, and BOM dialogs
to dialogs folder.
* Rename library text edit dialog file and object names to comply with
coding policy.
* Set default button in library text edit, library draw item edit, SVG print,
and BOM dialogs.
* Move BOM dialog code into BOM dialog object source file.
2010-nov-11 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++EESchema

View File

@ -35,9 +35,10 @@ set(EESCHEMA_SRCS
dialogs/dialog_plot_schematic_PS_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
dialogs/dialog_lib_edit_text.cpp
dialogs/dialog_lib_edit_text_base.cpp
dialogs/dialog_build_BOM.cpp
dialogs/dialog_build_BOM_base.cpp
dialog_edit_component_in_lib.cpp
dialog_edit_component_in_lib_base.cpp
dialog_edit_component_in_schematic_fbp.cpp
@ -54,8 +55,8 @@ set(EESCHEMA_SRCS
dialogs/dialog_erc_base.cpp
dialog_libedit_dimensions.cpp
dialog_libedit_dimensions_base.cpp
dialog_lib_edit_draw_item.cpp
dialog_lib_edit_draw_item_base.cpp
dialogs/dialog_lib_edit_draw_item.cpp
dialogs/dialog_lib_edit_draw_item_base.cpp
dialogs/dialog_lib_edit_pin.cpp
dialogs/dialog_lib_edit_pin_base.cpp
dialog_lib_new_component.cpp
@ -66,8 +67,8 @@ set(EESCHEMA_SRCS
dialog_sch_sheet_props_base.cpp
dialogs/dialog_schematic_find.cpp
dialogs/dialog_schematic_find_base.cpp
dialog_SVG_print.cpp
dialog_SVG_print_base.cpp
dialogs/dialog_SVG_print.cpp
dialogs/dialog_SVG_print_base.cpp
edit_component_in_lib.cpp
edit_component_in_schematic.cpp
edit_label.cpp
@ -130,7 +131,6 @@ set(EESCHEMA_SRCS
sheetlab.cpp
symbdraw.cpp
symbedit.cpp
edit_graphic_bodyitem_text.cpp
template_fieldnames_keywords.cpp
template_fieldnames.cpp
tool_lib.cpp

View File

@ -1,5 +1,4 @@
/////////////////////////////////////////////////////////////////////////////
// Name: build_BOM.cpp
// Purpose:
// Author: jean-pierre Charras
@ -11,23 +10,15 @@
#include "fctsys.h"
#include "common.h"
#include "confirm.h"
#include "kicad_string.h"
#include "gestfich.h"
#include "appl_wxstruct.h"
#include "class_sch_screen.h"
#include "kicad_string.h"
#include "general.h"
#include "class_library.h"
#include "netlist.h"
#include "protos.h"
#include "sch_sheet.h"
#include "template_fieldnames.h"
#include "sch_component.h"
#include "build_version.h"
#include "dialog_build_BOM.h"
#include "template_fieldnames.h"
/**
@ -36,322 +27,6 @@
*/
/**
* 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 LABEL_OBJECT
{
public:
int m_LabelType;
SCH_ITEM* m_Label;
//have to store it here since the object references will be duplicated.
SCH_SHEET_PATH m_SheetPath; //composed of UIDs
public: LABEL_OBJECT()
{
m_Label = NULL;
m_LabelType = 0;
}
};
static void BuildComponentsListFromSchematic(
std::vector <OBJ_CMP_TO_LIST>& aList );
static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList );
static bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1,
const OBJ_CMP_TO_LIST& obj2 );
static bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1,
const OBJ_CMP_TO_LIST& obj2 );
static bool SortLabelsByValue( const LABEL_OBJECT& obj1,
const LABEL_OBJECT& obj2 );
static bool SortLabelsBySheet( const LABEL_OBJECT& obj1,
const LABEL_OBJECT& obj2 );
static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList );
static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList );
// separator used in bom export to spreadsheet
static char s_ExportSeparatorSymbol;
void DIALOG_BUILD_BOM::Create_BOM_Lists( int aTypeFile,
bool aIncludeSubComponents,
char aExportSeparatorSymbol,
bool aRunBrowser )
{
wxString wildcard;
static wxFileName fn;
wxFileName current = g_RootSheet->m_AssociatedScreen->m_FileName;
s_ExportSeparatorSymbol = aExportSeparatorSymbol;
if( !fn.HasName() || fn.GetName()==NAMELESS_PROJECT )
{
fn.SetName( current.GetName() );
}
// else use a previous run's name, because fn was set before and user
// is probably just iteratively refining the BOM.
if( fn.GetPath().IsEmpty() )
{
fn.SetPath( current.GetPath() );
}
// else use a previous run's path, because fn was set before and user
// is probably just iteratively refining the BOM.
wxString bomDesc = _( "Bill of Materials" ); // translate once, use twice.
if( aTypeFile == 0 )
{
fn.SetExt( wxT( "lst" ) );
wildcard = bomDesc + wxT( " (*.lst)|*.lst" );
}
else
{
fn.SetExt( wxT( "csv" ) );
wildcard = bomDesc + wxT( " (*.csv)|*.csv" );
}
wxFileDialog dlg( this, bomDesc, fn.GetPath(),
fn.GetFullName(), wildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return;
fn = dlg.GetPath(); // remember path+filename+ext for subsequent runs.
m_ListFileName = dlg.GetPath();
// Close dialog, then show the list (if so requested)
switch( aTypeFile )
{
case 0: // list
GenereListeOfItems( m_ListFileName, aIncludeSubComponents );
break;
case 1: // speadsheet
CreateExportList( m_ListFileName, aIncludeSubComponents );
break;
case 2: // Single Part per line
CreatePartsList( m_ListFileName, aIncludeSubComponents );
break;
}
EndModal( 1 );
if( aRunBrowser )
{
wxString editorname = wxGetApp().GetEditorName();
wxString filename = m_ListFileName;
AddDelimiterString( filename );
ExecuteFile( this, editorname, filename );
}
}
/** Helper function IsFieldChecked
* return the state of the wxCheckbox corresponding to the
* field aFieldId (FOOTPRINT and FIELD1 to FIELD8
* if the option "All user fields" is checked, return always true
* for fileds ids >= FIELD1
* @param aFieldId = the field id : FOOTPRINT to FIELD8
*/
bool DIALOG_BUILD_BOM::IsFieldChecked(int aFieldId)
{
if( m_AddAllFields->IsChecked() && (aFieldId>= FIELD1) )
return true;
switch ( aFieldId )
{
case FIELD1:
return m_AddField1->IsChecked();
case FIELD2:
return m_AddField2->IsChecked();
case FIELD3:
return m_AddField3->IsChecked();
case FIELD4:
return m_AddField4->IsChecked();
case FIELD5:
return m_AddField5->IsChecked();
case FIELD6:
return m_AddField6->IsChecked();
case FIELD7:
return m_AddField7->IsChecked();
case FIELD8:
return m_AddField8->IsChecked();
case FOOTPRINT:
return m_AddFootprintField->IsChecked();
}
return false;
}
void DIALOG_BUILD_BOM::CreatePartsList( const wxString& aFullFileName, bool aIncludeSubComponents )
{
FILE* f;
wxString msg;
if( ( f = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL )
{
msg = _( "Failed to open file " );
msg << aFullFileName;
DisplayError( this, msg );
return;
}
std::vector <OBJ_CMP_TO_LIST> cmplist;
BuildComponentsListFromSchematic( cmplist );
// sort component list by ref and remove sub components
if( !aIncludeSubComponents )
{
sort( cmplist.begin(), cmplist.end(), SortComponentsByReference );
DeleteSubCmp( cmplist );
}
// sort component list by value
sort( cmplist.begin(), cmplist.end(), SortComponentsByValue );
PrintComponentsListByPart( f, cmplist,aIncludeSubComponents );
fclose( f );
}
/*
* Print a list of components, in a form which can be imported by a spreadsheet
* form is:
* cmp name; cmp val; fields;
*/
void DIALOG_BUILD_BOM::CreateExportList( const wxString& aFullFileName,
bool aIncludeSubComponents )
{
FILE* f;
wxString msg;
if( ( f = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL )
{
msg = _( "Failed to open file " );
msg << aFullFileName;
DisplayError( this, msg );
return;
}
std::vector <OBJ_CMP_TO_LIST> cmplist;
BuildComponentsListFromSchematic( cmplist );
// sort component list
sort( cmplist.begin(), cmplist.end(), SortComponentsByReference );
if( !aIncludeSubComponents )
DeleteSubCmp( cmplist );
// create the file
PrintComponentsListByRef( f, cmplist, TRUE, aIncludeSubComponents );
fclose( f );
}
/** GenereListeOfItems()
* Main function to create the list of components and/or labels
* (global labels and pin sheets" )
*/
void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
bool aIncludeSubComponents )
{
FILE* f;
int itemCount;
char Line[1024];
wxString msg;
if( ( f = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL )
{
msg = _( "Failed to open file " );
msg << aFullFileName;
DisplayError( this, msg );
return;
}
std::vector <OBJ_CMP_TO_LIST> cmplist;
BuildComponentsListFromSchematic( cmplist );
itemCount = cmplist.size();
if( itemCount )
{
// creates the list file
DateAndTime( Line );
wxString Title = wxGetApp().GetAppName() + wxT( " " ) +
GetBuildVersion();
fprintf( f, "%s >> Creation date: %s\n", CONV_TO_UTF8( Title ), Line );
// sort component list
sort( cmplist.begin(), cmplist.end(), SortComponentsByReference );
if( !aIncludeSubComponents )
DeleteSubCmp( cmplist );
if( m_ListCmpbyRefItems->GetValue() )
PrintComponentsListByRef( f, cmplist, false, aIncludeSubComponents );
if( m_ListCmpbyValItems->GetValue() )
{
sort( cmplist.begin(), cmplist.end(), SortComponentsByValue );
PrintComponentsListByVal( f, cmplist, aIncludeSubComponents );
}
}
/*************************************************/
/* Create list of global labels and pins sheets */
/*************************************************/
std::vector <LABEL_OBJECT> listOfLabels;
GenListeGLabels( listOfLabels );
if( ( itemCount = listOfLabels.size() ) > 0 )
{
if( m_GenListLabelsbySheet->GetValue() )
{
sort( listOfLabels.begin(), listOfLabels.end(), SortLabelsBySheet );
msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets \
( order = Sheet Number ) count = %d\n" ),
itemCount );
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
PrintListeGLabel( f, listOfLabels );
}
if( m_GenListLabelsbyVal->GetValue() )
{
sort( listOfLabels.begin(), listOfLabels.end(), SortLabelsByValue );
msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets ( \
order = Alphab. ) count = %d\n\n" ),
itemCount );
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
PrintListeGLabel( f, listOfLabels );
}
}
msg = _( "\n#End List\n" );
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
fclose( f );
}
/**
* Function BuildComponentsListFromSchematic
* creates the list of components found in the whole schematic.
@ -397,7 +72,7 @@ void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
/* Fill aList with Glabel info
*/
static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
{
// Build the sheet list
SCH_SHEET_LIST sheetList;
@ -479,8 +154,7 @@ bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST&
* if same reference: by value
* if same value: by unit number
*/
bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1,
const OBJ_CMP_TO_LIST& obj2 )
bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST& obj2 )
{
int ii;
const wxString* Text1, * Text2;
@ -568,7 +242,7 @@ bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
* found in this list
* The component list **MUST** be sorted by reference and by unit number
*/
static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList )
void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList )
{
SCH_COMPONENT* libItem;
wxString oldName;
@ -597,398 +271,7 @@ static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList )
}
void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
bool CompactForm )
{
int ii;
if( IsFieldChecked( FOOTPRINT ) )
{
if( CompactForm )
{
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
}
else
{
fprintf( f, "; %-12s",
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
}
}
for( ii = FIELD1; ii < DrawLibItem->GetFieldCount(); ii++ )
{
if( ! IsFieldChecked( ii ) )
continue;
if( CompactForm )
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
else
fprintf( f, "; %-12s",
CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
}
}
/* Print the B.O.M sorted by reference
*/
int DIALOG_BUILD_BOM::PrintComponentsListByRef(
FILE* f,
std::vector <OBJ_CMP_TO_LIST>& aList,
bool CompactForm,
bool aIncludeSubComponents )
{
wxString msg;
if( CompactForm )
{
// Print comment line:
#if defined(KICAD_GOST)
fprintf( f, "ref%cvalue%cdatasheet", s_ExportSeparatorSymbol, s_ExportSeparatorSymbol );
#else
fprintf( f, "ref%cvalue", s_ExportSeparatorSymbol );
#endif
if( aIncludeSubComponents )
{
fprintf( f, "%csheet path", s_ExportSeparatorSymbol );
fprintf( f, "%clocation", s_ExportSeparatorSymbol );
}
if( IsFieldChecked( FOOTPRINT ) )
fprintf( f, "%cfootprint", s_ExportSeparatorSymbol );
for( int ii = FIELD1; ii <= FIELD8; ii++ )
{
if( !IsFieldChecked( ii ) )
continue;
msg = _( "Field" );
fprintf( f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ), ii - FIELD1 + 1 );
}
fprintf( f, "\n" );
}
else
{
msg = _( "\n#Cmp ( order = Reference )" );
if( aIncludeSubComponents )
msg << _( " (with SubCmp)" );
fprintf( f, "%s\n", CONV_TO_UTF8( msg ) );
}
std::string CmpName;
wxString subRef;
// Print list of items
for( unsigned ii = 0; ii < aList.size(); ii++ )
{
EDA_BaseStruct* item = aList[ii].m_RootCmp;
if( item == NULL )
continue;
if( item->Type() != TYPE_SCH_COMPONENT )
continue;
SCH_COMPONENT* comp = (SCH_COMPONENT*) item;
bool isMulti = false;
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( comp->m_ChipName );
if( entry )
isMulti = entry->IsMulti();
if( isMulti && aIncludeSubComponents )
subRef = LIB_COMPONENT::ReturnSubReference( aList[ii].m_Unit );
else
subRef.Empty();
CmpName = aList[ii].GetRefStr();
if( !CompactForm )
CmpName += CONV_TO_UTF8(subRef);
if( CompactForm )
#if defined(KICAD_GOST)
fprintf( f, "%s%c%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol,
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ), s_ExportSeparatorSymbol,
CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
#else
fprintf( f, "%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol,
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ) );
#endif
else
#if defined(KICAD_GOST)
fprintf( f, "| %-10s %-12s %-20s", CmpName.c_str(),
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ),
CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
#else
fprintf( f, "| %-10s %-12s", CmpName.c_str(),
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ) );
#endif
if( aIncludeSubComponents )
{
msg = aList[ii].m_SheetPath.PathHumanReadable();
if( CompactForm )
{
fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) comp->GetParent(),
comp->m_Pos );
fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
CONV_TO_UTF8( msg ) );
}
else
{
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) comp->GetParent(),
comp->m_Pos );
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
}
}
PrintFieldData( f, comp, CompactForm );
fprintf( f, "\n" );
}
if( !CompactForm )
{
msg = _( "#End Cmp\n" );
fputs( CONV_TO_UTF8( msg ), f );
}
return 0;
}
/* Bom Output format option - single part per line
* a common part being defined as have a common value.
* This is true for most designs but will produce an
* incorrect output if two or more parts with the same
* value have different footprints, tolerances, voltage
* rating, etc. Also usefull if the following fields
* are edited:
* FIELD1 - manufacture
* FIELD2 - manufacture part number
* FIELD3 - distributor part number
*/
int DIALOG_BUILD_BOM::PrintComponentsListByPart(
FILE* f,
std::vector <OBJ_CMP_TO_LIST>& aList,
bool aIncludeSubComponents)
{
int qty = 0;
wxString refName;
wxString fullRefName; // reference + part Id (for multiple parts per package
wxString valName;
#if defined(KICAD_GOST)
wxString footName;
wxString datsName;
#endif
wxString refNames;
wxString lastRef;
wxString unitId;
SCH_COMPONENT* currCmp;
SCH_COMPONENT* nextCmp;
SCH_COMPONENT dummyCmp; // A dummy component, to store fields
for( unsigned ii = 0; ii < aList.size(); ii++ )
{
currCmp = (SCH_COMPONENT*) aList[ii].m_RootCmp;
if( ii < aList.size() -1 )
nextCmp = aList[ii+1].m_RootCmp;
else
nextCmp = NULL;
// Store fields. Store non empty fields only.
for( int jj = FOOTPRINT; jj < currCmp->GetFieldCount(); jj++ )
{
// Ensure fields exists in dummy component
if( dummyCmp.GetFieldCount() <= jj )
dummyCmp.AddField( *currCmp->GetField( jj ) );
// store useful data
if( !currCmp->GetField( jj )->m_Text.IsEmpty() )
dummyCmp.GetField( jj )->m_Text = currCmp->GetField( jj )->m_Text;
}
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;
#endif
int multi = 0;
if( aIncludeSubComponents )
{
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( currCmp->m_ChipName );
if( entry )
multi = entry->GetPartCount();
if ( multi <= 1 )
multi = 0;
}
if ( multi && aList[ii].m_Unit > 0 )
unitId.Printf( wxT("%c"), 'A' -1 + aList[ii].m_Unit );
else
unitId.Empty();
fullRefName = refName + unitId;
if( refNames.IsEmpty() )
refNames = fullRefName;
else
refNames << wxT( ", " ) << fullRefName;
// In multi parts per package, we have the reference more than once
// but we must count only one package
if( lastRef != refName )
qty++;
lastRef = refName;
// if the next cmoponent has same value the line will be printed after.
#if defined(KICAD_GOST)
if( nextCmp && nextCmp->GetField( VALUE )->m_Text.CmpNoCase( valName ) == 0
&& nextCmp->GetField( FOOTPRINT )->m_Text.CmpNoCase( footName ) == 0
&& nextCmp->GetField( DATASHEET )->m_Text.CmpNoCase( datsName ) == 0 )
#else
if( nextCmp && nextCmp->GetField( VALUE )->m_Text.CmpNoCase( valName ) == 0 )
#endif
continue;
// Print line for the current component value:
fprintf( f, "%15s%c%3d", CONV_TO_UTF8( valName ), s_ExportSeparatorSymbol, qty );
if( IsFieldChecked(FOOTPRINT ) )
fprintf( f, "%c%15s", s_ExportSeparatorSymbol,
#if defined(KICAD_GOST)
CONV_TO_UTF8( footName ) );
#else
CONV_TO_UTF8( currCmp->GetField( FOOTPRINT )->m_Text ) );
#endif
#if defined(KICAD_GOST)
fprintf( f, "%c%20s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( datsName ) );
#endif
// wrap the field in quotes, since it has commas in it.
fprintf( f, "%c\"%s\"", s_ExportSeparatorSymbol,
CONV_TO_UTF8( refNames ) );
// print fields, on demand
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++ )
{
if ( IsFieldChecked( jj ) )
fprintf( f, "%c%4s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( dummyCmp.GetField( jj )->m_Text ) );
}
fprintf( f, "\n" );
// Clear strings and values, to prepare next component
qty = 0;
refNames.Empty();
for( int jj = FOOTPRINT; jj < dummyCmp.GetFieldCount(); jj++ )
dummyCmp.GetField( jj )->m_Text.Empty();
}
return 0;
}
int DIALOG_BUILD_BOM::PrintComponentsListByVal(
FILE* f,
std::vector <OBJ_CMP_TO_LIST>& aList,
bool aIncludeSubComponents )
{
EDA_BaseStruct* schItem;
SCH_COMPONENT* DrawLibItem;
LIB_COMPONENT* entry;
std::string CmpName;
wxString msg;
msg = _( "\n#Cmp ( order = Value )" );
if( aIncludeSubComponents )
msg << _( " (with SubCmp)" );
msg << wxT( "\n" );
fputs( CONV_TO_UTF8( msg ), f );
for( unsigned ii = 0; ii < aList.size(); ii++ )
{
schItem = aList[ii].m_RootCmp;
if( schItem == NULL )
continue;
if( schItem->Type() != TYPE_SCH_COMPONENT )
continue;
DrawLibItem = (SCH_COMPONENT*) schItem;
bool isMulti = false;
entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
if( entry )
isMulti = entry->IsMulti();
wxString subRef;
if( isMulti && aIncludeSubComponents )
subRef = LIB_COMPONENT::ReturnSubReference( aList[ii].m_Unit );
else
subRef.Empty();
CmpName = aList[ii].GetRefStr();
CmpName += CONV_TO_UTF8(subRef);
fprintf( f, "| %-12s %-10s",
CONV_TO_UTF8( DrawLibItem->GetField( VALUE )->m_Text ),
CmpName.c_str() );
// print the sheet path
if( aIncludeSubComponents )
{
msg = aList[ii].m_SheetPath.PathHumanReadable();
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) DrawLibItem->GetParent(),
DrawLibItem->m_Pos );
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
}
PrintFieldData( f, DrawLibItem );
fputs( "\n", f );
}
msg = _( "#End Cmp\n" );
fputs( CONV_TO_UTF8( msg ), f );
return 0;
}
static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
{
SCH_LABEL* DrawTextItem;
SCH_SHEET_PIN* DrawSheetLabel;
@ -1052,5 +335,3 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
fputs( CONV_TO_UTF8( msg ), f );
return 0;
}

View File

@ -1,248 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_build_BOM.cpp
// Author: jean-pierre Charras
// Modified by:
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
#include "wxstruct.h"
#include "general.h"
#include "netlist.h"
#include "wx/valgen.h"
#include "dialog_build_BOM.h"
#include "protos.h"
/* Local variables */
static bool s_ListByRef = TRUE;
static bool s_ListByValue = TRUE;
static bool s_ListWithSubCmponents;
static bool s_ListHierarchicalPinByName;
static bool s_ListBySheet;
static bool s_BrowseCreatedList;
static int s_OutputFormOpt;
static int s_OutputSeparatorOpt;
static bool s_Add_FpField_state;
static bool s_Add_F1_state;
static bool s_Add_F2_state;
static bool s_Add_F3_state;
static bool s_Add_F4_state;
static bool s_Add_F5_state;
static bool s_Add_F6_state;
static bool s_Add_F7_state;
static bool s_Add_F8_state;
static bool s_Add_Alls_state;
static bool* s_AddFieldList[] = {
&s_Add_FpField_state,
&s_Add_F1_state,
&s_Add_F2_state,
&s_Add_F3_state,
&s_Add_F4_state,
&s_Add_F5_state,
&s_Add_F6_state,
&s_Add_F7_state,
&s_Add_F8_state,
&s_Add_Alls_state,
NULL
};
#define OPTION_BOM_FORMAT wxT( "BomFormat" )
#define OPTION_BOM_LAUNCH_BROWSER wxT( "BomLaunchBrowser" )
#define OPTION_BOM_SEPARATOR wxT( "BomExportSeparator" )
#define OPTION_BOM_ADD_FIELD wxT( "BomAddField" )
/* list of separators used in bom export to spreadsheet
* (selected by s_OutputSeparatorOpt, and s_OutputSeparatorOpt radiobox)
*/
static char s_ExportSeparator[] = ("\t;,.");
/*!
* DIALOG_BUILD_BOM dialog type definition
*/
DIALOG_BUILD_BOM::DIALOG_BUILD_BOM( WinEDA_DrawFrame* parent ):
DIALOG_BUILD_BOM_BASE(parent)
{
m_Config = wxGetApp().m_EDA_Config;
wxASSERT( m_Config != NULL );
m_Parent = parent;
Init( );
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
Centre();
}
/*!
* Init Controls for DIALOG_BUILD_BOM
*/
void DIALOG_BUILD_BOM::Init()
{
SetFocus();
/* Get options */
s_OutputFormOpt = m_Config->Read( OPTION_BOM_FORMAT, (long) 0 );
s_BrowseCreatedList = m_Config->Read( OPTION_BOM_LAUNCH_BROWSER, (long) 0 );
s_OutputSeparatorOpt = m_Config->Read( OPTION_BOM_SEPARATOR, (long) 0 );
long addfields = m_Config->Read( OPTION_BOM_ADD_FIELD, (long) 0 );
for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ )
{
if( (addfields & bitmask) )
*s_AddFieldList[ii] = true;
else
*s_AddFieldList[ii] = false;
bitmask <<= 1;
}
// Set validators
m_ListCmpbyRefItems->SetValidator( wxGenericValidator(& s_ListByRef) );
m_ListSubCmpItems->SetValidator( wxGenericValidator(& s_ListWithSubCmponents) );
m_ListCmpbyValItems->SetValidator( wxGenericValidator(& s_ListByValue) );
m_GenListLabelsbyVal->SetValidator( wxGenericValidator(& s_ListHierarchicalPinByName) );
m_GenListLabelsbySheet->SetValidator( wxGenericValidator(& s_ListBySheet) );
m_OutputFormCtrl->SetValidator( wxGenericValidator(& s_OutputFormOpt) );
m_OutputSeparatorCtrl->SetValidator( wxGenericValidator(& s_OutputSeparatorOpt) );
m_GetListBrowser->SetValidator( wxGenericValidator(& s_BrowseCreatedList) );
m_AddFootprintField->SetValidator( wxGenericValidator(& s_Add_FpField_state) );
m_AddField1->SetValidator( wxGenericValidator(& s_Add_F1_state) );
m_AddField2->SetValidator( wxGenericValidator(& s_Add_F2_state) );
m_AddField3->SetValidator( wxGenericValidator(& s_Add_F3_state) );
m_AddField4->SetValidator( wxGenericValidator(& s_Add_F4_state) );
m_AddField5->SetValidator( wxGenericValidator(& s_Add_F5_state) );
m_AddField6->SetValidator( wxGenericValidator(& s_Add_F6_state) );
m_AddField7->SetValidator( wxGenericValidator(& s_Add_F7_state) );
m_AddField8->SetValidator( wxGenericValidator(& s_Add_F8_state) );
m_AddAllFields->SetValidator( wxGenericValidator(& s_Add_Alls_state) );
m_OutputFormCtrl->SetSelection( s_OutputFormOpt );
m_OutputSeparatorCtrl->SetSelection( s_OutputSeparatorOpt );
// Enable/disable options:
wxCommandEvent dummy;
OnRadioboxSelectFormatSelected( dummy );
}
/*!
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX_SELECT_FORMAT
*/
void DIALOG_BUILD_BOM::OnRadioboxSelectFormatSelected( wxCommandEvent& event )
{
if( m_OutputFormCtrl->GetSelection() == 0 )
{
m_OutputSeparatorCtrl->Enable( false );
m_ListCmpbyValItems->Enable( true );
m_GenListLabelsbyVal->Enable( true );
m_GenListLabelsbySheet->Enable( true );
} else {
m_OutputSeparatorCtrl->Enable( true );
m_ListCmpbyValItems->Enable( false );
m_GenListLabelsbyVal->Enable( false );
m_GenListLabelsbySheet->Enable( false );
}
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
void DIALOG_BUILD_BOM::OnOkClick( wxCommandEvent& event )
{
char ExportSeparatorSymbol = s_ExportSeparator[0];
if( m_OutputSeparatorCtrl->GetSelection() > 0 )
ExportSeparatorSymbol = s_ExportSeparator[m_OutputSeparatorCtrl->GetSelection()];
int ExportFileType = m_OutputFormCtrl->GetSelection();
SavePreferences();
Create_BOM_Lists( ExportFileType, m_ListSubCmpItems->GetValue(),
ExportSeparatorSymbol, m_GetListBrowser->GetValue());
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void DIALOG_BUILD_BOM::OnCancelClick( wxCommandEvent& event )
{
EndModal( -1 );
}
/**************************************************/
void DIALOG_BUILD_BOM::SavePreferences()
/**************************************************/
{
wxASSERT( m_Config != NULL );
// Determine current settings of "List items" and "Options" checkboxes
// (NOTE: These 6 settings are restored when the dialog box is next
// invoked, but are *not* still saved after EESchema is next shut down.)
s_ListByRef = m_ListCmpbyRefItems->GetValue();
s_ListWithSubCmponents = m_ListSubCmpItems->GetValue();
s_ListByValue = m_ListCmpbyValItems->GetValue();
s_ListHierarchicalPinByName = m_GenListLabelsbyVal->GetValue();
s_ListBySheet = m_GenListLabelsbySheet->GetValue();
s_BrowseCreatedList = m_GetListBrowser->GetValue();
// (aved in config ):
// Determine current settings of both radiobutton groups
s_OutputFormOpt = m_OutputFormCtrl->GetSelection();
s_OutputSeparatorOpt = m_OutputSeparatorCtrl->GetSelection();
if( s_OutputSeparatorOpt < 0 )
s_OutputSeparatorOpt = 0;
// Determine current settings of all "Fields to add" checkboxes
s_Add_FpField_state = m_AddFootprintField->GetValue();
s_Add_F1_state = m_AddField1->GetValue();
s_Add_F2_state = m_AddField2->GetValue();
s_Add_F3_state = m_AddField3->GetValue();
s_Add_F4_state = m_AddField4->GetValue();
s_Add_F5_state = m_AddField5->GetValue();
s_Add_F6_state = m_AddField6->GetValue();
s_Add_F7_state = m_AddField7->GetValue();
s_Add_F8_state = m_AddField8->GetValue();
s_Add_Alls_state = m_AddAllFields->GetValue();
// Now save current settings of both radiobutton groups
m_Config->Write( OPTION_BOM_FORMAT, (long) s_OutputFormOpt );
m_Config->Write( OPTION_BOM_SEPARATOR, (long) s_OutputSeparatorOpt );
m_Config->Write( OPTION_BOM_LAUNCH_BROWSER, (long) s_BrowseCreatedList );
// Now save current settings of all "Fields to add" checkboxes
long addfields = 0;
for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ )
{
if( *s_AddFieldList[ii] )
addfields |= bitmask;
bitmask <<= 1;
}
m_Config->Write( OPTION_BOM_ADD_FIELD, addfields );
}

View File

@ -1,68 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_build_BOM.h
// Copyright: GNU license
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _DIALOG_BUILD_BOM_H_
#define _DIALOG_BUILD_BOM_H_
#include "dialog_build_BOM_base.h"
class WinEDA_DrawFrame;
class SCH_COMPONENT;
class wxConfig;
class DIALOG_BUILD_BOM : public DIALOG_BUILD_BOM_BASE
{
private:
WinEDA_DrawFrame * m_Parent;
wxConfig* m_Config;
wxString m_ListFileName;
private:
void OnRadioboxSelectFormatSelected( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void SavePreferences();
void Init();
void Create_BOM_Lists(int aTypeFile,
bool aIncludeSubComponents,
char aExportSeparatorSymbol,
bool aRunBrowser);
void GenereListeOfItems(const wxString & FullFileName, bool aIncludeSubComponents );
void CreateExportList(const wxString & FullFileName, bool aIncludeSubComponents);
/**
* Function CreateParstList
* prints a list of components, in a form which can be imported by a
* spreadsheet. Form is:
* cmp value; number of components; <footprint>; <field1>; ...;
* list of references having the same value
*/
void CreatePartsList( const wxString& aFullFileName, bool aIncludeSubComponents );
int PrintComponentsListByRef( FILE * f, std::vector <OBJ_CMP_TO_LIST>& aList,
bool CompactForm, bool aIncludeSubComponents );
int PrintComponentsListByVal( FILE *f, std::vector <OBJ_CMP_TO_LIST>& aList,
bool aIncludeSubComponents);
int PrintComponentsListByPart( FILE *f, std::vector <OBJ_CMP_TO_LIST>& aList,
bool aIncludeSubComponents);
void PrintFieldData(FILE * f, SCH_COMPONENT * DrawLibItem, bool CompactForm = FALSE);
bool IsFieldChecked(int aFieldId);
public:
DIALOG_BUILD_BOM( WinEDA_DrawFrame* parent );
// ~DIALOG_BUILD_BOM() {};
};
#endif // _DIALOG_BUILD_BOM_H_

View File

@ -15,13 +15,14 @@
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "dialog_SVG_print_base.h"
#include "dcsvg.h"
#include "general.h"
#include "libeditframe.h"
#include "sch_sheet_path.h"
#include "dialog_SVG_print.h"
// Keys for configuration
#define PLOTSVGMODECOLOR_KEY wxT( "PlotSVGModeColor" )
@ -34,58 +35,12 @@ extern BASE_SCREEN* ActiveScreen;
static bool s_Print_Frame_Ref = true;
static int s_PlotBlackAndWhite = 0;
class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base
{
private:
WinEDA_DrawFrame * m_Parent;
wxConfig* m_Config;
public:
DIALOG_SVG_PRINT( WinEDA_DrawFrame* parent );
~DIALOG_SVG_PRINT( ) {}
private:
void OnCloseWindow( wxCloseEvent& event );
void OnInitDialog( wxInitDialogEvent& event );
void OnButtonPlotCurrentClick( wxCommandEvent& event );
void OnButtonPlotAllClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event );
void OnSetColorModeSelected( wxCommandEvent& event );
void SetPenWidth();
void PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref );
public:
static bool DrawSVGPage( WinEDA_DrawFrame * frame,
const wxString& FullFileName, BASE_SCREEN* screen,
bool aPrintBlackAndWhite = false,
bool aPrint_Sheet_Ref = false);
};
/* Prepare the data structures of print management and display the dialog
* window for printing sheets.
*/
void WinEDA_DrawFrame::SVG_Print( wxCommandEvent& event )
{
DIALOG_SVG_PRINT frame( this );
frame.ShowModal();
}
/* Creates the SVG print file for the current edited component.
*/
void WinEDA_LibeditFrame::SVG_Print_Component( const wxString& FullFileName )
{
DIALOG_SVG_PRINT::DrawSVGPage( this, FullFileName, GetScreen() );
}
/*!
* DIALOG_SVG_PRINT functions
*/
DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( WinEDA_DrawFrame* parent )
: DIALOG_SVG_PRINT_base( parent )
DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( WinEDA_DrawFrame* parent ) :
DIALOG_SVG_PRINT_base( parent )
{
m_Parent = parent;
m_Config = wxGetApp().m_EDA_Config;
@ -108,6 +63,7 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event )
ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness,
m_Parent->m_InternalUnits ) );
m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref );
if( GetSizer() )
{
GetSizer()->SetSizeHints( this );
@ -164,6 +120,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
if( sheetpath == NULL )
break;
list.Clear();
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
schframe->m_CurrentSheet = &list;
@ -174,6 +131,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
}
else // Should not happen
return;
sheetpath = SheetList.GetNext();
fn = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".svg" );
@ -187,6 +145,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
msg += wxT( "\n" );
m_MessagesBox->AppendText( msg );
}
schframe->m_CurrentSheet = oldsheetpath;
schframe->m_CurrentSheet->UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
@ -216,6 +175,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
ActiveScreen = oldscreen;
}
bool DIALOG_SVG_PRINT::DrawSVGPage( WinEDA_DrawFrame* frame,
const wxString& FullFileName,
BASE_SCREEN* screen,
@ -233,6 +193,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( WinEDA_DrawFrame * frame,
old_org = screen->m_DrawOrg;
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
SheetSize = screen->ReturnPageSize(); // page size in 1/1000 inch, ie in internal units
screen->SetScalingFactor( 1.0 );
@ -276,6 +237,7 @@ void DIALOG_SVG_PRINT::OnButtonPlotAllClick( wxCommandEvent& event )
PrintSVGDoc( true, m_Print_Sheet_Ref->GetValue() );
}
void DIALOG_SVG_PRINT::OnButtonPlotCurrentClick( wxCommandEvent& event )
{
PrintSVGDoc( false, m_Print_Sheet_Ref->GetValue() );

View File

@ -0,0 +1,41 @@
#ifndef _DIALOG_SVG_PRINT_H_
#define _DIALOG_SVG_PRINT_H_
class WinEDA_DrawFrame;
class BASE_SCREEN;
#include "dialog_SVG_print_base.h"
class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base
{
private:
WinEDA_DrawFrame* m_Parent;
wxConfig* m_Config;
public:
DIALOG_SVG_PRINT( WinEDA_DrawFrame* parent );
~DIALOG_SVG_PRINT() {}
private:
void OnCloseWindow( wxCloseEvent& event );
void OnInitDialog( wxInitDialogEvent& event );
void OnButtonPlotCurrentClick( wxCommandEvent& event );
void OnButtonPlotAllClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event );
void OnSetColorModeSelected( wxCommandEvent& event );
void SetPenWidth();
void PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref );
public:
static bool DrawSVGPage( WinEDA_DrawFrame* frame,
const wxString& FullFileName, BASE_SCREEN* screen,
bool aPrintBlackAndWhite = false,
bool aPrint_Sheet_Ref = false );
};
#endif // _DIALOG_SVG_PRINT_H_

View File

@ -0,0 +1,926 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_build_BOM.cpp
// Author: jean-pierre Charras
// Modified by:
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
#include "confirm.h"
#include "gestfich.h"
#include "kicad_string.h"
#include "class_sch_screen.h"
#include "wxstruct.h"
#include "build_version.h"
#include "general.h"
#include "netlist.h"
#include "template_fieldnames.h"
#include "sch_component.h"
#include "sch_sheet.h"
#include "class_library.h"
#include "wx/valgen.h"
#include "dialog_build_BOM.h"
#include "protos.h"
/* Local variables */
static bool s_ListByRef = TRUE;
static bool s_ListByValue = TRUE;
static bool s_ListWithSubCmponents;
static bool s_ListHierarchicalPinByName;
static bool s_ListBySheet;
static bool s_BrowseCreatedList;
static int s_OutputFormOpt;
static int s_OutputSeparatorOpt;
static bool s_Add_FpField_state;
static bool s_Add_F1_state;
static bool s_Add_F2_state;
static bool s_Add_F3_state;
static bool s_Add_F4_state;
static bool s_Add_F5_state;
static bool s_Add_F6_state;
static bool s_Add_F7_state;
static bool s_Add_F8_state;
static bool s_Add_Alls_state;
static char s_ExportSeparatorSymbol;
static bool* s_AddFieldList[] =
{
&s_Add_FpField_state,
&s_Add_F1_state,
&s_Add_F2_state,
&s_Add_F3_state,
&s_Add_F4_state,
&s_Add_F5_state,
&s_Add_F6_state,
&s_Add_F7_state,
&s_Add_F8_state,
&s_Add_Alls_state,
NULL
};
#define OPTION_BOM_FORMAT wxT( "BomFormat" )
#define OPTION_BOM_LAUNCH_BROWSER wxT( "BomLaunchBrowser" )
#define OPTION_BOM_SEPARATOR wxT( "BomExportSeparator" )
#define OPTION_BOM_ADD_FIELD wxT( "BomAddField" )
/* list of separators used in bom export to spreadsheet
* (selected by s_OutputSeparatorOpt, and s_OutputSeparatorOpt radiobox)
*/
static char s_ExportSeparator[] = ("\t;,.");
/*!
* DIALOG_BUILD_BOM dialog type definition
*/
DIALOG_BUILD_BOM::DIALOG_BUILD_BOM( WinEDA_DrawFrame* parent ) :
DIALOG_BUILD_BOM_BASE( parent )
{
m_Config = wxGetApp().m_EDA_Config;
wxASSERT( m_Config != NULL );
m_Parent = parent;
Init();
if( GetSizer() )
{
GetSizer()->SetSizeHints( this );
}
Centre();
}
/*!
* Init Controls for DIALOG_BUILD_BOM
*/
void DIALOG_BUILD_BOM::Init()
{
SetFocus();
/* Get options */
s_OutputFormOpt = m_Config->Read( OPTION_BOM_FORMAT, (long) 0 );
s_BrowseCreatedList = m_Config->Read( OPTION_BOM_LAUNCH_BROWSER, (long) 0 );
s_OutputSeparatorOpt = m_Config->Read( OPTION_BOM_SEPARATOR, (long) 0 );
long addfields = m_Config->Read( OPTION_BOM_ADD_FIELD, (long) 0 );
for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ )
{
if( (addfields & bitmask) )
*s_AddFieldList[ii] = true;
else
*s_AddFieldList[ii] = false;
bitmask <<= 1;
}
// Set validators
m_ListCmpbyRefItems->SetValidator( wxGenericValidator( &s_ListByRef ) );
m_ListSubCmpItems->SetValidator( wxGenericValidator( &s_ListWithSubCmponents ) );
m_ListCmpbyValItems->SetValidator( wxGenericValidator( &s_ListByValue ) );
m_GenListLabelsbyVal->SetValidator( wxGenericValidator( &s_ListHierarchicalPinByName ) );
m_GenListLabelsbySheet->SetValidator( wxGenericValidator( &s_ListBySheet ) );
m_OutputFormCtrl->SetValidator( wxGenericValidator( &s_OutputFormOpt ) );
m_OutputSeparatorCtrl->SetValidator( wxGenericValidator( &s_OutputSeparatorOpt ) );
m_GetListBrowser->SetValidator( wxGenericValidator( &s_BrowseCreatedList ) );
m_AddFootprintField->SetValidator( wxGenericValidator( &s_Add_FpField_state ) );
m_AddField1->SetValidator( wxGenericValidator( &s_Add_F1_state ) );
m_AddField2->SetValidator( wxGenericValidator( &s_Add_F2_state ) );
m_AddField3->SetValidator( wxGenericValidator( &s_Add_F3_state ) );
m_AddField4->SetValidator( wxGenericValidator( &s_Add_F4_state ) );
m_AddField5->SetValidator( wxGenericValidator( &s_Add_F5_state ) );
m_AddField6->SetValidator( wxGenericValidator( &s_Add_F6_state ) );
m_AddField7->SetValidator( wxGenericValidator( &s_Add_F7_state ) );
m_AddField8->SetValidator( wxGenericValidator( &s_Add_F8_state ) );
m_AddAllFields->SetValidator( wxGenericValidator( &s_Add_Alls_state ) );
m_OutputFormCtrl->SetSelection( s_OutputFormOpt );
m_OutputSeparatorCtrl->SetSelection( s_OutputSeparatorOpt );
// Enable/disable options:
wxCommandEvent dummy;
OnRadioboxSelectFormatSelected( dummy );
}
/*!
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX_SELECT_FORMAT
*/
void DIALOG_BUILD_BOM::OnRadioboxSelectFormatSelected( wxCommandEvent& event )
{
if( m_OutputFormCtrl->GetSelection() == 0 )
{
m_OutputSeparatorCtrl->Enable( false );
m_ListCmpbyValItems->Enable( true );
m_GenListLabelsbyVal->Enable( true );
m_GenListLabelsbySheet->Enable( true );
}
else
{
m_OutputSeparatorCtrl->Enable( true );
m_ListCmpbyValItems->Enable( false );
m_GenListLabelsbyVal->Enable( false );
m_GenListLabelsbySheet->Enable( false );
}
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
void DIALOG_BUILD_BOM::OnOkClick( wxCommandEvent& event )
{
char ExportSeparatorSymbol = s_ExportSeparator[0];
if( m_OutputSeparatorCtrl->GetSelection() > 0 )
ExportSeparatorSymbol = s_ExportSeparator[m_OutputSeparatorCtrl->GetSelection()];
int ExportFileType = m_OutputFormCtrl->GetSelection();
SavePreferences();
Create_BOM_Lists( ExportFileType, m_ListSubCmpItems->GetValue(),
ExportSeparatorSymbol, m_GetListBrowser->GetValue() );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void DIALOG_BUILD_BOM::OnCancelClick( wxCommandEvent& event )
{
EndModal( -1 );
}
void DIALOG_BUILD_BOM::SavePreferences()
{
wxASSERT( m_Config != NULL );
// Determine current settings of "List items" and "Options" checkboxes
// (NOTE: These 6 settings are restored when the dialog box is next
// invoked, but are *not* still saved after EESchema is next shut down.)
s_ListByRef = m_ListCmpbyRefItems->GetValue();
s_ListWithSubCmponents = m_ListSubCmpItems->GetValue();
s_ListByValue = m_ListCmpbyValItems->GetValue();
s_ListHierarchicalPinByName = m_GenListLabelsbyVal->GetValue();
s_ListBySheet = m_GenListLabelsbySheet->GetValue();
s_BrowseCreatedList = m_GetListBrowser->GetValue();
// (aved in config ):
// Determine current settings of both radiobutton groups
s_OutputFormOpt = m_OutputFormCtrl->GetSelection();
s_OutputSeparatorOpt = m_OutputSeparatorCtrl->GetSelection();
if( s_OutputSeparatorOpt < 0 )
s_OutputSeparatorOpt = 0;
// Determine current settings of all "Fields to add" checkboxes
s_Add_FpField_state = m_AddFootprintField->GetValue();
s_Add_F1_state = m_AddField1->GetValue();
s_Add_F2_state = m_AddField2->GetValue();
s_Add_F3_state = m_AddField3->GetValue();
s_Add_F4_state = m_AddField4->GetValue();
s_Add_F5_state = m_AddField5->GetValue();
s_Add_F6_state = m_AddField6->GetValue();
s_Add_F7_state = m_AddField7->GetValue();
s_Add_F8_state = m_AddField8->GetValue();
s_Add_Alls_state = m_AddAllFields->GetValue();
// Now save current settings of both radiobutton groups
m_Config->Write( OPTION_BOM_FORMAT, (long) s_OutputFormOpt );
m_Config->Write( OPTION_BOM_SEPARATOR, (long) s_OutputSeparatorOpt );
m_Config->Write( OPTION_BOM_LAUNCH_BROWSER, (long) s_BrowseCreatedList );
// Now save current settings of all "Fields to add" checkboxes
long addfields = 0;
for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ )
{
if( *s_AddFieldList[ii] )
addfields |= bitmask;
bitmask <<= 1;
}
m_Config->Write( OPTION_BOM_ADD_FIELD, addfields );
}
void DIALOG_BUILD_BOM::Create_BOM_Lists( int aTypeFile,
bool aIncludeSubComponents,
char aExportSeparatorSymbol,
bool aRunBrowser )
{
wxString wildcard;
static wxFileName fn;
wxFileName current = g_RootSheet->m_AssociatedScreen->m_FileName;
s_ExportSeparatorSymbol = aExportSeparatorSymbol;
if( !fn.HasName() || fn.GetName()==NAMELESS_PROJECT )
{
fn.SetName( current.GetName() );
}
// else use a previous run's name, because fn was set before and user
// is probably just iteratively refining the BOM.
if( fn.GetPath().IsEmpty() )
{
fn.SetPath( current.GetPath() );
}
// else use a previous run's path, because fn was set before and user
// is probably just iteratively refining the BOM.
wxString bomDesc = _( "Bill of Materials" ); // translate once, use twice.
if( aTypeFile == 0 )
{
fn.SetExt( wxT( "lst" ) );
wildcard = bomDesc + wxT( " (*.lst)|*.lst" );
}
else
{
fn.SetExt( wxT( "csv" ) );
wildcard = bomDesc + wxT( " (*.csv)|*.csv" );
}
wxFileDialog dlg( this, bomDesc, fn.GetPath(),
fn.GetFullName(), wildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return;
fn = dlg.GetPath(); // remember path+filename+ext for subsequent runs.
m_ListFileName = dlg.GetPath();
// Close dialog, then show the list (if so requested)
switch( aTypeFile )
{
case 0: // list
GenereListeOfItems( m_ListFileName, aIncludeSubComponents );
break;
case 1: // speadsheet
CreateExportList( m_ListFileName, aIncludeSubComponents );
break;
case 2: // Single Part per line
CreatePartsList( m_ListFileName, aIncludeSubComponents );
break;
}
EndModal( 1 );
if( aRunBrowser )
{
wxString editorname = wxGetApp().GetEditorName();
wxString filename = m_ListFileName;
AddDelimiterString( filename );
ExecuteFile( this, editorname, filename );
}
}
/** Helper function IsFieldChecked
* return the state of the wxCheckbox corresponding to the
* field aFieldId (FOOTPRINT and FIELD1 to FIELD8
* if the option "All user fields" is checked, return always true
* for fileds ids >= FIELD1
* @param aFieldId = the field id : FOOTPRINT to FIELD8
*/
bool DIALOG_BUILD_BOM::IsFieldChecked(int aFieldId)
{
if( m_AddAllFields->IsChecked() && (aFieldId>= FIELD1) )
return true;
switch ( aFieldId )
{
case FIELD1:
return m_AddField1->IsChecked();
case FIELD2:
return m_AddField2->IsChecked();
case FIELD3:
return m_AddField3->IsChecked();
case FIELD4:
return m_AddField4->IsChecked();
case FIELD5:
return m_AddField5->IsChecked();
case FIELD6:
return m_AddField6->IsChecked();
case FIELD7:
return m_AddField7->IsChecked();
case FIELD8:
return m_AddField8->IsChecked();
case FOOTPRINT:
return m_AddFootprintField->IsChecked();
}
return false;
}
void DIALOG_BUILD_BOM::CreatePartsList( const wxString& aFullFileName, bool aIncludeSubComponents )
{
FILE* f;
wxString msg;
if( ( f = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL )
{
msg = _( "Failed to open file " );
msg << aFullFileName;
DisplayError( this, msg );
return;
}
std::vector <OBJ_CMP_TO_LIST> cmplist;
BuildComponentsListFromSchematic( cmplist );
// sort component list by ref and remove sub components
if( !aIncludeSubComponents )
{
sort( cmplist.begin(), cmplist.end(), SortComponentsByReference );
DeleteSubCmp( cmplist );
}
// sort component list by value
sort( cmplist.begin(), cmplist.end(), SortComponentsByValue );
PrintComponentsListByPart( f, cmplist,aIncludeSubComponents );
fclose( f );
}
/*
* Print a list of components, in a form which can be imported by a spreadsheet
* form is:
* cmp name; cmp val; fields;
*/
void DIALOG_BUILD_BOM::CreateExportList( const wxString& aFullFileName,
bool aIncludeSubComponents )
{
FILE* f;
wxString msg;
if( ( f = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL )
{
msg = _( "Failed to open file " );
msg << aFullFileName;
DisplayError( this, msg );
return;
}
std::vector <OBJ_CMP_TO_LIST> cmplist;
BuildComponentsListFromSchematic( cmplist );
// sort component list
sort( cmplist.begin(), cmplist.end(), SortComponentsByReference );
if( !aIncludeSubComponents )
DeleteSubCmp( cmplist );
// create the file
PrintComponentsListByRef( f, cmplist, TRUE, aIncludeSubComponents );
fclose( f );
}
/** GenereListeOfItems()
* Main function to create the list of components and/or labels
* (global labels and pin sheets" )
*/
void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
bool aIncludeSubComponents )
{
FILE* f;
int itemCount;
char Line[1024];
wxString msg;
if( ( f = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL )
{
msg = _( "Failed to open file " );
msg << aFullFileName;
DisplayError( this, msg );
return;
}
std::vector <OBJ_CMP_TO_LIST> cmplist;
BuildComponentsListFromSchematic( cmplist );
itemCount = cmplist.size();
if( itemCount )
{
// creates the list file
DateAndTime( Line );
wxString Title = wxGetApp().GetAppName() + wxT( " " ) +
GetBuildVersion();
fprintf( f, "%s >> Creation date: %s\n", CONV_TO_UTF8( Title ), Line );
// sort component list
sort( cmplist.begin(), cmplist.end(), SortComponentsByReference );
if( !aIncludeSubComponents )
DeleteSubCmp( cmplist );
if( m_ListCmpbyRefItems->GetValue() )
PrintComponentsListByRef( f, cmplist, false, aIncludeSubComponents );
if( m_ListCmpbyValItems->GetValue() )
{
sort( cmplist.begin(), cmplist.end(), SortComponentsByValue );
PrintComponentsListByVal( f, cmplist, aIncludeSubComponents );
}
}
/*************************************************/
/* Create list of global labels and pins sheets */
/*************************************************/
std::vector <LABEL_OBJECT> listOfLabels;
GenListeGLabels( listOfLabels );
if( ( itemCount = listOfLabels.size() ) > 0 )
{
if( m_GenListLabelsbySheet->GetValue() )
{
sort( listOfLabels.begin(), listOfLabels.end(), SortLabelsBySheet );
msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets \
( order = Sheet Number ) count = %d\n" ),
itemCount );
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
PrintListeGLabel( f, listOfLabels );
}
if( m_GenListLabelsbyVal->GetValue() )
{
sort( listOfLabels.begin(), listOfLabels.end(), SortLabelsByValue );
msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets ( \
order = Alphab. ) count = %d\n\n" ),
itemCount );
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
PrintListeGLabel( f, listOfLabels );
}
}
msg = _( "\n#End List\n" );
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
fclose( f );
}
void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
bool CompactForm )
{
int ii;
if( IsFieldChecked( FOOTPRINT ) )
{
if( CompactForm )
{
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
}
else
{
fprintf( f, "; %-12s",
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
}
}
for( ii = FIELD1; ii < DrawLibItem->GetFieldCount(); ii++ )
{
if( ! IsFieldChecked( ii ) )
continue;
if( CompactForm )
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
else
fprintf( f, "; %-12s",
CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
}
}
/* Print the B.O.M sorted by reference
*/
int DIALOG_BUILD_BOM::PrintComponentsListByRef(
FILE* f,
std::vector <OBJ_CMP_TO_LIST>& aList,
bool CompactForm,
bool aIncludeSubComponents )
{
wxString msg;
if( CompactForm )
{
// Print comment line:
#if defined(KICAD_GOST)
fprintf( f, "ref%cvalue%cdatasheet", s_ExportSeparatorSymbol, s_ExportSeparatorSymbol );
#else
fprintf( f, "ref%cvalue", s_ExportSeparatorSymbol );
#endif
if( aIncludeSubComponents )
{
fprintf( f, "%csheet path", s_ExportSeparatorSymbol );
fprintf( f, "%clocation", s_ExportSeparatorSymbol );
}
if( IsFieldChecked( FOOTPRINT ) )
fprintf( f, "%cfootprint", s_ExportSeparatorSymbol );
for( int ii = FIELD1; ii <= FIELD8; ii++ )
{
if( !IsFieldChecked( ii ) )
continue;
msg = _( "Field" );
fprintf( f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ), ii - FIELD1 + 1 );
}
fprintf( f, "\n" );
}
else
{
msg = _( "\n#Cmp ( order = Reference )" );
if( aIncludeSubComponents )
msg << _( " (with SubCmp)" );
fprintf( f, "%s\n", CONV_TO_UTF8( msg ) );
}
std::string CmpName;
wxString subRef;
// Print list of items
for( unsigned ii = 0; ii < aList.size(); ii++ )
{
EDA_BaseStruct* item = aList[ii].m_RootCmp;
if( item == NULL )
continue;
if( item->Type() != TYPE_SCH_COMPONENT )
continue;
SCH_COMPONENT* comp = (SCH_COMPONENT*) item;
bool isMulti = false;
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( comp->m_ChipName );
if( entry )
isMulti = entry->IsMulti();
if( isMulti && aIncludeSubComponents )
subRef = LIB_COMPONENT::ReturnSubReference( aList[ii].m_Unit );
else
subRef.Empty();
CmpName = aList[ii].GetRefStr();
if( !CompactForm )
CmpName += CONV_TO_UTF8(subRef);
if( CompactForm )
#if defined(KICAD_GOST)
fprintf( f, "%s%c%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol,
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ), s_ExportSeparatorSymbol,
CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
#else
fprintf( f, "%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol,
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ) );
#endif
else
#if defined(KICAD_GOST)
fprintf( f, "| %-10s %-12s %-20s", CmpName.c_str(),
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ),
CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
#else
fprintf( f, "| %-10s %-12s", CmpName.c_str(),
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ) );
#endif
if( aIncludeSubComponents )
{
msg = aList[ii].m_SheetPath.PathHumanReadable();
if( CompactForm )
{
fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) comp->GetParent(),
comp->m_Pos );
fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
CONV_TO_UTF8( msg ) );
}
else
{
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) comp->GetParent(),
comp->m_Pos );
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
}
}
PrintFieldData( f, comp, CompactForm );
fprintf( f, "\n" );
}
if( !CompactForm )
{
msg = _( "#End Cmp\n" );
fputs( CONV_TO_UTF8( msg ), f );
}
return 0;
}
/* Bom Output format option - single part per line
* a common part being defined as have a common value.
* This is true for most designs but will produce an
* incorrect output if two or more parts with the same
* value have different footprints, tolerances, voltage
* rating, etc. Also usefull if the following fields
* are edited:
* FIELD1 - manufacture
* FIELD2 - manufacture part number
* FIELD3 - distributor part number
*/
int DIALOG_BUILD_BOM::PrintComponentsListByPart(
FILE* f,
std::vector <OBJ_CMP_TO_LIST>& aList,
bool aIncludeSubComponents)
{
int qty = 0;
wxString refName;
wxString fullRefName; // reference + part Id (for multiple parts per package
wxString valName;
#if defined(KICAD_GOST)
wxString footName;
wxString datsName;
#endif
wxString refNames;
wxString lastRef;
wxString unitId;
SCH_COMPONENT* currCmp;
SCH_COMPONENT* nextCmp;
SCH_COMPONENT dummyCmp; // A dummy component, to store fields
for( unsigned ii = 0; ii < aList.size(); ii++ )
{
currCmp = (SCH_COMPONENT*) aList[ii].m_RootCmp;
if( ii < aList.size() -1 )
nextCmp = aList[ii+1].m_RootCmp;
else
nextCmp = NULL;
// Store fields. Store non empty fields only.
for( int jj = FOOTPRINT; jj < currCmp->GetFieldCount(); jj++ )
{
// Ensure fields exists in dummy component
if( dummyCmp.GetFieldCount() <= jj )
dummyCmp.AddField( *currCmp->GetField( jj ) );
// store useful data
if( !currCmp->GetField( jj )->m_Text.IsEmpty() )
dummyCmp.GetField( jj )->m_Text = currCmp->GetField( jj )->m_Text;
}
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;
#endif
int multi = 0;
if( aIncludeSubComponents )
{
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( currCmp->m_ChipName );
if( entry )
multi = entry->GetPartCount();
if ( multi <= 1 )
multi = 0;
}
if ( multi && aList[ii].m_Unit > 0 )
unitId.Printf( wxT("%c"), 'A' -1 + aList[ii].m_Unit );
else
unitId.Empty();
fullRefName = refName + unitId;
if( refNames.IsEmpty() )
refNames = fullRefName;
else
refNames << wxT( ", " ) << fullRefName;
// In multi parts per package, we have the reference more than once
// but we must count only one package
if( lastRef != refName )
qty++;
lastRef = refName;
// if the next cmoponent has same value the line will be printed after.
#if defined(KICAD_GOST)
if( nextCmp && nextCmp->GetField( VALUE )->m_Text.CmpNoCase( valName ) == 0
&& nextCmp->GetField( FOOTPRINT )->m_Text.CmpNoCase( footName ) == 0
&& nextCmp->GetField( DATASHEET )->m_Text.CmpNoCase( datsName ) == 0 )
#else
if( nextCmp && nextCmp->GetField( VALUE )->m_Text.CmpNoCase( valName ) == 0 )
#endif
continue;
// Print line for the current component value:
fprintf( f, "%15s%c%3d", CONV_TO_UTF8( valName ), s_ExportSeparatorSymbol, qty );
if( IsFieldChecked(FOOTPRINT ) )
fprintf( f, "%c%15s", s_ExportSeparatorSymbol,
#if defined(KICAD_GOST)
CONV_TO_UTF8( footName ) );
#else
CONV_TO_UTF8( currCmp->GetField( FOOTPRINT )->m_Text ) );
#endif
#if defined(KICAD_GOST)
fprintf( f, "%c%20s", s_ExportSeparatorSymbol,CONV_TO_UTF8( datsName ) );
#endif
// wrap the field in quotes, since it has commas in it.
fprintf( f, "%c\"%s\"", s_ExportSeparatorSymbol, CONV_TO_UTF8( refNames ) );
// print fields, on demand
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++ )
{
if ( IsFieldChecked( jj ) )
fprintf( f, "%c%4s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( dummyCmp.GetField( jj )->m_Text ) );
}
fprintf( f, "\n" );
// Clear strings and values, to prepare next component
qty = 0;
refNames.Empty();
for( int jj = FOOTPRINT; jj < dummyCmp.GetFieldCount(); jj++ )
dummyCmp.GetField( jj )->m_Text.Empty();
}
return 0;
}
int DIALOG_BUILD_BOM::PrintComponentsListByVal(
FILE* f,
std::vector <OBJ_CMP_TO_LIST>& aList,
bool aIncludeSubComponents )
{
EDA_BaseStruct* schItem;
SCH_COMPONENT* DrawLibItem;
LIB_COMPONENT* entry;
std::string CmpName;
wxString msg;
msg = _( "\n#Cmp ( order = Value )" );
if( aIncludeSubComponents )
msg << _( " (with SubCmp)" );
msg << wxT( "\n" );
fputs( CONV_TO_UTF8( msg ), f );
for( unsigned ii = 0; ii < aList.size(); ii++ )
{
schItem = aList[ii].m_RootCmp;
if( schItem == NULL )
continue;
if( schItem->Type() != TYPE_SCH_COMPONENT )
continue;
DrawLibItem = (SCH_COMPONENT*) schItem;
bool isMulti = false;
entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
if( entry )
isMulti = entry->IsMulti();
wxString subRef;
if( isMulti && aIncludeSubComponents )
subRef = LIB_COMPONENT::ReturnSubReference( aList[ii].m_Unit );
else
subRef.Empty();
CmpName = aList[ii].GetRefStr();
CmpName += CONV_TO_UTF8(subRef);
fprintf( f, "| %-12s %-10s",
CONV_TO_UTF8( DrawLibItem->GetField( VALUE )->m_Text ),
CmpName.c_str() );
// print the sheet path
if( aIncludeSubComponents )
{
msg = aList[ii].m_SheetPath.PathHumanReadable();
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) DrawLibItem->GetParent(),
DrawLibItem->m_Pos );
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
}
PrintFieldData( f, DrawLibItem );
fputs( "\n", f );
}
msg = _( "#End Cmp\n" );
fputs( CONV_TO_UTF8( msg ), f );
return 0;
}

View File

@ -0,0 +1,68 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_build_BOM.h
// Copyright: GNU license
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _DIALOG_BUILD_BOM_H_
#define _DIALOG_BUILD_BOM_H_
#include "dialog_build_BOM_base.h"
class WinEDA_DrawFrame;
class SCH_COMPONENT;
class wxConfig;
class DIALOG_BUILD_BOM : public DIALOG_BUILD_BOM_BASE
{
private:
WinEDA_DrawFrame* m_Parent;
wxConfig* m_Config;
wxString m_ListFileName;
private:
void OnRadioboxSelectFormatSelected( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void SavePreferences();
void Init();
void Create_BOM_Lists( int aTypeFile,
bool aIncludeSubComponents,
char aExportSeparatorSymbol,
bool aRunBrowser );
void GenereListeOfItems( const wxString& FullFileName, bool aIncludeSubComponents );
void CreateExportList( const wxString& FullFileName, bool aIncludeSubComponents );
/**
* Function CreateParstList
* prints a list of components, in a form which can be imported by a
* spreadsheet. Form is:
* cmp value; number of components; <footprint>; <field1>; ...;
* list of references having the same value
*/
void CreatePartsList( const wxString& aFullFileName, bool aIncludeSubComponents );
int PrintComponentsListByRef( FILE* f, std::vector <OBJ_CMP_TO_LIST>& aList,
bool CompactForm, bool aIncludeSubComponents );
int PrintComponentsListByVal( FILE* f, std::vector <OBJ_CMP_TO_LIST>& aList,
bool aIncludeSubComponents );
int PrintComponentsListByPart( FILE* f, std::vector <OBJ_CMP_TO_LIST>& aList,
bool aIncludeSubComponents );
void PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem, bool CompactForm = FALSE );
bool IsFieldChecked( int aFieldId );
public:
DIALOG_BUILD_BOM( WinEDA_DrawFrame* parent );
// ~DIALOG_BUILD_BOM() {};
};
#endif // _DIALOG_BUILD_BOM_H_

View File

@ -7,8 +7,9 @@ DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM( wxWindow* parent,
{
SetTitle( itemName + wxT( " " ) + GetTitle() );
// Required under wxGTK if we want to demiss the dialog with the ESC key
// Required under wxGTK if we want to dismiss the dialog with the ESC key
SetFocus();
m_sdbSizer1OK->SetDefault();
}

View File

@ -10,45 +10,23 @@
#include "class_drawpanel.h"
#include "general.h"
#include "protos.h"
#include "libeditframe.h"
#include "class_libentry.h"
#include "lib_text.h"
#include "dialog_bodygraphictext_properties_base.h"
#include "dialog_lib_edit_text.h"
class Dialog_BodyGraphicText_Properties : public Dialog_BodyGraphicText_Properties_base
{
private:
WinEDA_LibeditFrame * m_Parent;
LIB_TEXT* m_GraphicText;
public:
Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent,
LIB_TEXT* aGraphicText );
~Dialog_BodyGraphicText_Properties() {};
private:
void InitDialog( );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
};
Dialog_BodyGraphicText_Properties::Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent,
LIB_TEXT* aGraphicText ) :
Dialog_BodyGraphicText_Properties_base( aParent )
DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT( WinEDA_LibeditFrame* aParent, LIB_TEXT* aText ) :
DIALOG_LIB_EDIT_TEXT_BASE( aParent )
{
m_Parent = aParent;
m_GraphicText = aGraphicText;
m_GraphicText = aText;
InitDialog();
}
/*****************************************************/
void Dialog_BodyGraphicText_Properties::InitDialog( )
/*****************************************************/
void DIALOG_LIB_EDIT_TEXT::InitDialog( )
{
wxString msg;
@ -128,19 +106,19 @@ void Dialog_BodyGraphicText_Properties::InitDialog( )
{
GetSizer()->SetSizeHints(this);
}
m_sdbSizer1OK->SetDefault();
}
void Dialog_BodyGraphicText_Properties::OnCancelClick( wxCommandEvent& event )
void DIALOG_LIB_EDIT_TEXT::OnCancelClick( wxCommandEvent& event )
{
event.Skip();
}
/***************************************************************************/
void Dialog_BodyGraphicText_Properties::OnOkClick( wxCommandEvent& event )
/***************************************************************************/
/* Updates the different parameters for the component being edited */
void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event )
{
wxString Line;
@ -211,33 +189,9 @@ void Dialog_BodyGraphicText_Properties::OnOkClick( wxCommandEvent& event )
break;
}
}
Close();
if( m_Parent->GetDrawItem() )
m_Parent->GetDrawItem()->DisplayInfo( m_Parent );
Close();
}
void WinEDA_LibeditFrame::EditSymbolText( wxDC* DC, LIB_DRAW_ITEM* DrawItem )
{
if ( ( DrawItem == NULL ) || ( DrawItem->Type() != COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) )
return;
/* Deleting old text. */
if( DC && !DrawItem->InEditMode() )
DrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform );
Dialog_BodyGraphicText_Properties * frame =
new Dialog_BodyGraphicText_Properties( this, (LIB_TEXT*) DrawItem );
frame->ShowModal();
frame->Destroy();
OnModify();
/* Display new text. */
if( DC && !DrawItem->InEditMode() )
DrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE, NULL,
DefaultTransform );
}

View File

@ -0,0 +1,30 @@
#ifndef _DIALOG_LIB_EDIT_TEXT_H_
#define _DIALOG_LIB_EDIT_TEXT_H_
#include "dialog_lib_edit_text_base.h"
class WinEDA_LibeditFrame;
class LIB_TEXT;
class DIALOG_LIB_EDIT_TEXT : public DIALOG_LIB_EDIT_TEXT_BASE
{
private:
WinEDA_LibeditFrame* m_Parent;
LIB_TEXT* m_GraphicText;
public:
DIALOG_LIB_EDIT_TEXT( WinEDA_LibeditFrame* aParent, LIB_TEXT* aText );
~DIALOG_LIB_EDIT_TEXT() {};
private:
void InitDialog( );
void OnOkClick( wxCommandEvent& aEvent );
void OnCancelClick( wxCommandEvent& aEvent );
};
#endif // _DIALOG_LIB_EDIT_TEXT_H_

View File

@ -1,20 +1,20 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_bodygraphictext_properties_base.h"
#include "dialog_lib_edit_text_base.h"
///////////////////////////////////////////////////////////////////////////
Dialog_BodyGraphicText_Properties_base::Dialog_BodyGraphicText_Properties_base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bPropertiesSizer;
bPropertiesSizer = new wxBoxSizer( wxVERTICAL );
@ -57,21 +57,18 @@ Dialog_BodyGraphicText_Properties_base::Dialog_BodyGraphicText_Properties_base(
sOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _(" Text Options : ") ), wxVERTICAL );
m_Orient = new wxCheckBox( this, wxID_ANY, _("Vertical"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_Orient, 0, wxALL, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
sOptionsSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_CommonUnit = new wxCheckBox( this, wxID_ANY, _("Common to Units"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_CommonUnit, 0, wxALL, 5 );
m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to convert"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_CommonConvert, 0, wxALL|wxEXPAND, 5 );
bBottomtBoxSizer->Add( sOptionsSizer, 0, 0, 5 );
bBottomtBoxSizer->Add( sOptionsSizer, 0, wxALL|wxEXPAND, 5 );
wxString m_TextShapeOptChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_TextShapeOptNChoices = sizeof( m_TextShapeOptChoices ) / sizeof( wxString );
@ -98,30 +95,21 @@ Dialog_BodyGraphicText_Properties_base::Dialog_BodyGraphicText_Properties_base(
bPropertiesSizer->Add( bRightSizer, 0, wxEXPAND, 5 );
bMainSizer->Add( bPropertiesSizer, 1, wxEXPAND, 5 );
bMainSizer->Add( bPropertiesSizer, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 6 );
wxBoxSizer* bButtonsBoxSizer;
bButtonsBoxSizer = new wxBoxSizer( wxVERTICAL );
m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsBoxSizer->Add( m_buttonOK, 0, wxALL, 5 );
m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsBoxSizer->Add( m_buttonCANCEL, 0, wxALL, 5 );
bMainSizer->Add( bButtonsBoxSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnOkClick ), NULL, this );
m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnCancelClick ), NULL, this );
bMainSizer->Fit( this );
}
Dialog_BodyGraphicText_Properties_base::~Dialog_BodyGraphicText_Properties_base()
DIALOG_LIB_EDIT_TEXT_BASE::~DIALOG_LIB_EDIT_TEXT_BASE()
{
// Disconnect Events
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnOkClick ), NULL, this );
m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnCancelClick ), NULL, this );
}

View File

@ -1,28 +1,33 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="9" />
<FileVersion major="1" minor="10" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_python_events">0</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_bodygraphictext_properties_base</property>
<property name="file">dialog_lib_edit_text_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">Dialog_BodyGraphicText_Properties_base</property>
<property name="name">DIALOG_LIB_EDIT_TEXT_BASE</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_python_events">1</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="bg"></property>
<property name="center"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
@ -30,13 +35,17 @@
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">Dialog_BodyGraphicText_Properties_base</property>
<property name="name">DIALOG_LIB_EDIT_TEXT_BASE</property>
<property name="pos"></property>
<property name="size">511,193</property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Graphic text properties:</property>
<property name="title">Library Text Properties</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -73,42 +82,43 @@
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bMainSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="border">6</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bPropertiesSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bUpperBoxSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bTextValueBoxSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<object class="wxStaticText" expanded="0">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
@ -124,6 +134,10 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -153,13 +167,14 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="1">
<object class="wxTextCtrl" expanded="0">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
@ -175,6 +190,10 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
@ -210,22 +229,23 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bTextSizeSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<object class="wxStaticText" expanded="0">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
@ -241,6 +261,10 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -270,13 +294,14 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<object class="wxTextCtrl" expanded="0">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
@ -292,6 +317,10 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
@ -340,9 +369,9 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property>
<property name="label"> Text Options : </property>
<property name="minimum_size"></property>
@ -350,14 +379,15 @@
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<object class="wxCheckBox" expanded="0">
<property name="bg"></property>
<property name="checked">0</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
@ -373,6 +403,10 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -402,13 +436,14 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<object class="wxStaticLine" expanded="0">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
@ -423,6 +458,10 @@
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -451,14 +490,15 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<object class="wxCheckBox" expanded="0">
<property name="bg"></property>
<property name="checked">0</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
@ -474,6 +514,10 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -503,14 +547,15 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<object class="wxCheckBox" expanded="0">
<property name="bg"></property>
<property name="checked">0</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
@ -526,6 +571,10 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -557,14 +606,15 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<object class="wxRadioBox" expanded="0">
<property name="bg"></property>
<property name="choices">&quot;Normal&quot; &quot;Italic&quot; &quot;Bold&quot; &quot;Bold Italic&quot;</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
@ -582,6 +632,10 @@
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -611,14 +665,15 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<object class="wxRadioBox" expanded="0">
<property name="bg"></property>
<property name="choices">&quot;Align left&quot; &quot;Align center&quot; &quot;Align right&quot;</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
@ -636,6 +691,10 @@
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -665,14 +724,15 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<object class="wxRadioBox" expanded="0">
<property name="bg"></property>
<property name="choices">&quot;Align bottom&quot; &quot;Align center&quot; &quot;Align top&quot;</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
@ -690,6 +750,10 @@
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -721,11 +785,11 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bRightSizer</property>
<property name="orient">wxVERTICAL</property>
@ -734,119 +798,30 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<object class="sizeritem" expanded="0">
<property name="border">12</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxStdDialogButtonSizer" expanded="0">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">bButtonsBoxSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">OK</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_buttonOK</property>
<property name="name">m_sdbSizer1</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOkClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">Cancel</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_buttonCANCEL</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnCancelClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick"></event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
</object>

View File

@ -1,12 +1,12 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_bodygraphictext_properties_base__
#define __dialog_bodygraphictext_properties_base__
#ifndef __dialog_lib_edit_text_base__
#define __dialog_lib_edit_text_base__
#include <wx/intl.h>
@ -28,9 +28,9 @@
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class Dialog_BodyGraphicText_Properties_base
/// Class DIALOG_LIB_EDIT_TEXT_BASE
///////////////////////////////////////////////////////////////////////////////
class Dialog_BodyGraphicText_Properties_base : public wxDialog
class DIALOG_LIB_EDIT_TEXT_BASE : public wxDialog
{
private:
@ -46,18 +46,15 @@ class Dialog_BodyGraphicText_Properties_base : public wxDialog
wxRadioBox* m_TextShapeOpt;
wxRadioBox* m_TextHJustificationOpt;
wxRadioBox* m_TextVJustificationOpt;
wxButton* m_buttonOK;
wxButton* m_buttonCANCEL;
// Virtual event handlers, overide them in your derived class
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
public:
Dialog_BodyGraphicText_Properties_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Graphic text properties:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 511,193 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~Dialog_BodyGraphicText_Properties_base();
DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Library Text Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_EDIT_TEXT_BASE();
};
#endif //__dialog_bodygraphictext_properties_base__
#endif //__dialog_lib_edit_text_base__

View File

@ -26,6 +26,9 @@
#include "kicad_device_context.h"
#include "hotkeys.h"
#include "dialogs/dialog_lib_edit_text.h"
#include "dialogs/dialog_SVG_print.h"
#include <boost/foreach.hpp>
@ -990,3 +993,33 @@ void WinEDA_LibeditFrame::ClearTempCopyComponent()
delete m_tempCopyComponent;
m_tempCopyComponent = NULL;
}
/* Creates the SVG print file for the current edited component.
*/
void WinEDA_LibeditFrame::SVG_Print_Component( const wxString& FullFileName )
{
DIALOG_SVG_PRINT::DrawSVGPage( this, FullFileName, GetScreen() );
}
void WinEDA_LibeditFrame::EditSymbolText( wxDC* DC, LIB_DRAW_ITEM* DrawItem )
{
if ( ( DrawItem == NULL ) || ( DrawItem->Type() != COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) )
return;
/* Deleting old text. */
if( DC && !DrawItem->InEditMode() )
DrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform );
DIALOG_LIB_EDIT_TEXT* frame = new DIALOG_LIB_EDIT_TEXT( this, (LIB_TEXT*) DrawItem );
frame->ShowModal();
frame->Destroy();
OnModify();
/* Display new text. */
if( DC && !DrawItem->InEditMode() )
DrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE, NULL,
DefaultTransform );
}

View File

@ -16,8 +16,7 @@ class CMP_LIBRARY;
class LIB_COMPONENT;
class LIB_ALIAS;
class LIB_FIELD;
class WinEDA_bodygraphics_PropertiesFrame;
class Dialog_BodyGraphicText_Properties;
class DIALOG_LIB_EDIT_TEXT;
/**
@ -317,7 +316,7 @@ protected:
static wxSize m_clientSize;
friend class Dialog_BodyGraphicText_Properties;
friend class DIALOG_LIB_EDIT_TEXT;
/**
* Function CreatePNGorJPEGFile
@ -342,7 +341,7 @@ protected:
bool aPrintMirrorMode, void* aData = NULL );
/**
* Function SVG_Print_component
* Function SVG_Print_Component
* Creates the SVG print file for the current edited component.
* @param aFullFileName = the full filename of the file
*/

View File

@ -4,6 +4,7 @@
#include "block_commande.h"
#include "colors.h"
#include "sch_sheet_path.h"
#include <wx/wx.h>
@ -24,6 +25,8 @@ class SCH_SHEET_PIN;
class PLOTTER;
class SCH_SHEET;
class LIB_PIN;
class LABEL_OBJECT;
class OBJ_CMP_TO_LIST;
wxString ReturnDefaultFieldName( int aFieldNdx );
@ -62,6 +65,40 @@ bool LibItemInBox( int x1, int y1, int x2, int y2, SCH_COMPONENT* Draw
/************/
void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct );
// build_BOM.cpp
/**
* 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 LABEL_OBJECT
{
public:
int m_LabelType;
SCH_ITEM* m_Label;
//have to store it here since the object references will be duplicated.
SCH_SHEET_PATH m_SheetPath; //composed of UIDs
public: LABEL_OBJECT()
{
m_Label = NULL;
m_LabelType = 0;
}
};
void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList );
void GenListeGLabels( std::vector <LABEL_OBJECT>& aList );
bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST& obj2 );
bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST& obj2 );
bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 );
bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 );
void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList );
int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList );
// operations_on_item_lists.cpp
/**
* Function DuplicateStruct

View File

@ -22,7 +22,6 @@
#include "wxEeschemaStruct.h"
#include "class_sch_screen.h"
#include "dialog_build_BOM.h"
#include "netlist_control.h"
#include "libeditframe.h"
#include "viewlib_frame.h"
@ -31,9 +30,11 @@
#include "sch_sheet.h"
#include "dialogs/annotate_dialog.h"
#include "dialogs/dialog_build_BOM.h"
#include "dialogs/dialog_erc.h"
#include "dialogs/dialog_print_using_printer.h"
#include "dialogs/dialog_schematic_find.h"
#include "dialogs/dialog_SVG_print.h"
BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
@ -58,7 +59,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
EVT_MENU( wxID_PRINT, WinEDA_SchematicFrame::OnPrint )
EVT_MENU( ID_GEN_PLOT_PS, WinEDA_SchematicFrame::ToPlot_PS )
EVT_MENU( ID_GEN_PLOT_HPGL, WinEDA_SchematicFrame::ToPlot_HPGL )
EVT_MENU( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print )
EVT_MENU( ID_GEN_PLOT_SVG, WinEDA_SchematicFrame::SVG_Print )
EVT_MENU( ID_GEN_PLOT_DXF, WinEDA_SchematicFrame::ToPlot_DXF )
EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard )
EVT_MENU( ID_GEN_COPY_BLOCK_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard )
@ -782,3 +783,13 @@ void WinEDA_SchematicFrame::OnPrint( wxCommandEvent& event )
wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
}
}
/* Creates the SVG print file for the current edited component.
*/
void WinEDA_SchematicFrame::SVG_Print( wxCommandEvent& event )
{
DIALOG_SVG_PRINT frame( this );
frame.ShowModal();
}

View File

@ -14,13 +14,14 @@
#include "general.h"
#include "libeditframe.h"
#include "class_libentry.h"
#include "dialog_lib_edit_draw_item.h"
#include "lib_arc.h"
#include "lib_circle.h"
#include "lib_polyline.h"
#include "lib_rectangle.h"
#include "lib_text.h"
#include "dialogs/dialog_lib_edit_draw_item.h"
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );

View File

@ -345,6 +345,7 @@ public:
void SetPrintMonochrome( bool aMonochrome ) { m_printMonochrome = aMonochrome; }
bool GetShowSheetReference() { return m_showSheetReference; }
void SetShowSheetReference( bool aShow ) { m_showSheetReference = aShow; }
void SVG_Print( wxCommandEvent& event );
// Plot functions:
void ToPlot_PS( wxCommandEvent& event );

View File

@ -154,7 +154,10 @@ public:
*/
void ToPrinter( wxCommandEvent& event );
/** Virtual function PrintPage
void SVG_Print( wxCommandEvent& event );
/**
* Function PrintPage , virtual
* used to print a page
* Print the page pointed by ActiveScreen, set by the calling print function
* @param aDC = wxDC given by the calling print function

View File

@ -392,8 +392,6 @@ public:
/* Return the current zoom level */
int GetZoom( void );
void SVG_Print( wxCommandEvent& event );
void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width );
void PlotWorkSheet( PLOTTER *plotter, BASE_SCREEN* screen );

View File

@ -12,14 +12,15 @@
#include "confirm.h"
#include "gestfich.h"
#include "dialog_SVG_print_base.h"
#include "dcsvg.h"
#include "pcbnew.h"
#include "pcbplot.h"
#include "printout_controler.h"
#include "dialog_SVG_print.h"
// Keys for configuration
#define PLOTSVGMODECOLOR_KEY wxT( "PlotSVGModeColor" )
@ -34,42 +35,6 @@ static PRINT_PARAMETERS s_Parameters;
static long s_SelectedLayers = LAYER_BACK | LAYER_FRONT |
SILKSCREEN_LAYER_FRONT | SILKSCREEN_LAYER_BACK;
class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base
{
private:
WinEDA_BasePcbFrame* m_Parent;
wxConfig* m_Config;
long m_PrintMaskLayer;
wxCheckBox* m_BoxSelectLayer[32];
public:
DIALOG_SVG_PRINT( WinEDA_DrawFrame* parent );
~DIALOG_SVG_PRINT() {}
private:
void OnCloseWindow( wxCloseEvent& event );
void initDialog( );
void OnButtonPrintSelectedClick( wxCommandEvent& event );
void OnButtonPrintBoardClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event );
void OnSetColorModeSelected( wxCommandEvent& event );
void SetPenWidth();
void PrintSVGDoc( bool aPrintAll, bool aPrint_Frame_Ref );
bool DrawPage( const wxString& FullFileName, BASE_SCREEN* screen,
bool aPrint_Frame_Ref );
};
/* Prepare the data structures of print management
* And displays the dialog window management of printing sheets
*/
void WinEDA_DrawFrame::SVG_Print( wxCommandEvent& event )
{
DIALOG_SVG_PRINT frame( this );
frame.ShowModal();
}
/*!
* DIALOG_SVG_PRINT functions

39
pcbnew/dialog_SVG_print.h Normal file
View File

@ -0,0 +1,39 @@
#ifndef _DIALOG_SVG_PRINT_H_
#define _DIALOG_SVG_PRINT_H_
#include "dialog_SVG_print_base.h"
class BASE_SCREEN;
class WinEDA_BasePcbFrame;
class wxConfig;
class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base
{
private:
WinEDA_BasePcbFrame* m_Parent;
wxConfig* m_Config;
long m_PrintMaskLayer;
wxCheckBox* m_BoxSelectLayer[32];
public:
DIALOG_SVG_PRINT( WinEDA_DrawFrame* parent );
~DIALOG_SVG_PRINT() {}
private:
void OnCloseWindow( wxCloseEvent& event );
void initDialog( );
void OnButtonPrintSelectedClick( wxCommandEvent& event );
void OnButtonPrintBoardClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event );
void OnSetColorModeSelected( wxCommandEvent& event );
void SetPenWidth();
void PrintSVGDoc( bool aPrintAll, bool aPrint_Frame_Ref );
bool DrawPage( const wxString& FullFileName, BASE_SCREEN* screen, bool aPrint_Frame_Ref );
};
#endif // _DIALOG_SVG_PRINT_H_

View File

@ -49,6 +49,7 @@
#include "hotkeys.h"
#include "pcbnew_config.h"
#include "module_editor_frame.h"
#include "dialog_SVG_print.h"
extern int g_DrawDefaultLineThickness;
@ -168,7 +169,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_TOOL( wxID_UNDO, WinEDA_PcbFrame::GetBoardFromUndoList )
EVT_TOOL( wxID_REDO, WinEDA_PcbFrame::GetBoardFromRedoList )
EVT_TOOL( wxID_PRINT, WinEDA_PcbFrame::ToPrinter )
EVT_TOOL( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print )
EVT_TOOL( ID_GEN_PLOT_SVG, WinEDA_PcbFrame::SVG_Print )
EVT_TOOL( ID_GEN_PLOT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_GET_NETLIST, WinEDA_PcbFrame::Process_Special_Functions )
@ -721,3 +722,13 @@ void WinEDA_PcbFrame::OnModify( )
m_Draw3DFrame->ReloadRequest( );
}
/* Prepare the data structures of print management
* And displays the dialog window management of printing sheets
*/
void WinEDA_PcbFrame::SVG_Print( wxCommandEvent& event )
{
DIALOG_SVG_PRINT frame( this );
frame.ShowModal();
}