eeschema: Added: option to print ALL (more than 8) users fields in B.O.M.

pcbnew: added 5 metric grids and fixed a very minor bug when creating drill map.
This commit is contained in:
charras 2009-03-12 15:24:52 +00:00
parent 3bd6aa1dd1
commit 2a9a799f01
18 changed files with 1674 additions and 540 deletions

View File

@ -5,6 +5,16 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2009-mar-12 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++eeschema:
Added: option to print ALL users fields in B.O.M.,
so if more than 8 fields, they are printed. (issue 2680640)
++pcbnew:
Added 5 metric grids (1mm, 0.5mm 0.25mm 0.2mm and 0.1mm) in default grid list.
Minor bug in drill map creation (PS format) fixed
2009-mar-11 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++pcbnew:

View File

@ -285,15 +285,19 @@ ReturnValueFromString( int Units,
}
/*
* Convert in inch or mm the variable "val" given in internal units
*/
/******************************************************************/
double
To_User_Unit( bool is_metric,
double To_User_Unit( bool is_metric,
int val,
int internal_unit_value )
/******************************************************************/
/**
* Function To_User_Unit
* Convert in inch or mm the variable "val" (double)given in internal units
* @return the converted value, in double
* @param is_metric : true if the result must be returned in mm , false if inches
* @param val : integer : the given value
* @param internal_unit_value = internal units per inch
*/
{
double value;
@ -305,6 +309,31 @@ To_User_Unit( bool is_metric,
return value;
}
/******************************************************************/
double To_User_Unit( bool is_metric,
double val,
int internal_unit_value )
/******************************************************************/
/**
* Function To_User_Unit
* Convert in inch or mm the variable "val" (double)given in internal units
* @return the converted value, in double
* @param is_metric : true if the result must be returned in mm , false if inches
* @param val : double : the given value
* @param internal_unit_value = internal units per inch
*/
{
double value;
if( is_metric )
value = val * 25.4 / internal_unit_value;
else
value = val / internal_unit_value;
return value;
}
/*
* Return in internal units the value "val" given in inch or mm

View File

@ -247,7 +247,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{
tmp = GetScreen()->m_GridList[i];
gridValue = To_User_Unit( g_UnitMetric, (int) round(tmp.m_Size.x),
gridValue = To_User_Unit( g_UnitMetric, tmp.m_Size.x,
( (WinEDA_DrawFrame*)m_Parent )->m_InternalUnits );
if( tmp.m_Id == ID_POPUP_GRID_USER )
{
@ -256,9 +256,9 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
else
{
if ( g_UnitMetric == 0 ) // inches
msg.Printf( wxT( "%g mils" ), gridValue * 1000 );
msg.Printf( wxT( "%.1f mils" ), gridValue * 1000 );
else
msg.Printf( wxT( "%g mm" ), gridValue );
msg.Printf( wxT( "%.3f mm" ), gridValue );
msg = _( "Grid: " ) + msg;
}
gridMenu->Append( tmp.m_Id, msg, wxEmptyString, true );

View File

@ -37,6 +37,7 @@ set(EESCHEMA_SRCS
# dialog_backanno.cpp
dialog_bodygraphictext_properties_base.cpp
dialog_build_BOM.cpp
dialog_build_BOM_base.cpp
# dialog_cmp_graphic_properties.cpp
dialog_create_component.cpp
# dialog_edit_component_in_lib.cpp

View File

@ -74,7 +74,7 @@ static char s_ExportSeparatorSymbol;
/**************************************************************************/
void WinEDA_Build_BOM_Frame::Create_BOM_Lists( bool aTypeFileIsExport,
void DIALOG_BUILD_BOM::Create_BOM_Lists( bool aTypeFileIsExport,
bool aIncludeSubComponents,
char aExportSeparatorSymbol,
bool aRunBrowser )
@ -125,7 +125,7 @@ void WinEDA_Build_BOM_Frame::Create_BOM_Lists( bool aTypeFileIsExport,
/****************************************************************************/
void WinEDA_Build_BOM_Frame::CreateExportList( const wxString& aFullFileName,
void DIALOG_BUILD_BOM::CreateExportList( const wxString& aFullFileName,
bool aIncludeSubComponents )
/****************************************************************************/
@ -164,7 +164,7 @@ void WinEDA_Build_BOM_Frame::CreateExportList( const wxString& aFullFileName,
/****************************************************************************/
void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& aFullFileName,
void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
bool aIncludeSubComponents )
/****************************************************************************/
@ -515,7 +515,7 @@ static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList )
/*******************************************************************************************/
void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
bool CompactForm )
/*******************************************************************************************/
{
@ -546,13 +546,20 @@ void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem
}
for( ii = FIELD1; ii < DrawLibItem->GetFieldCount(); ii++ )
{
if ( ii <= FIELD8 ) // see users fields 1 to 8
{
FieldCtrl = FieldListCtrl[ii - FIELD1];
if( FieldCtrl == NULL )
continue;
if( !FieldCtrl->IsChecked() )
if( !FieldCtrl->IsChecked() && !m_AddAllFields->IsChecked() )
continue;
}
if( ! m_AddAllFields->IsChecked() )
break;
if( CompactForm )
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
@ -564,7 +571,7 @@ void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem
/*********************************************************************************************/
int WinEDA_Build_BOM_Frame::PrintComponentsListByRef(
int DIALOG_BUILD_BOM::PrintComponentsListByRef(
FILE* f,
std::vector <OBJ_CMP_TO_LIST>& aList,
bool CompactForm,
@ -706,7 +713,7 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef(
/*********************************************************************************************/
int WinEDA_Build_BOM_Frame::PrintComponentsListByVal(
int DIALOG_BUILD_BOM::PrintComponentsListByVal(
FILE* f,
std::vector <OBJ_CMP_TO_LIST>& aList,
bool

View File

@ -1,41 +1,28 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_build_BOM.cpp
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 01/15/06 18:18:44
// RCS-ID:
// Copyright: GNU license
// Licence:
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 01/15/06 18:18:44
#if defined (__GNUG__) && !defined (__APPLE__)
#pragma implementation "dialog_build_BOM.h"
#endif
#include "fctsys.h"
#include "appl_wxstruct.h"
////@begin includes
////@end includes
#include "common.h"
#include "program.h"
#include "libcmp.h"
#include "general.h"
#include "netlist.h"
#include "wx/valgen.h"
#include "dialog_build_BOM.h"
#include "protos.h"
////@begin XPM images
////@end XPM images
/* Local variables */
static bool s_ListByRef = TRUE;
@ -43,7 +30,7 @@ static bool s_ListByValue = TRUE;
static bool s_ListWithSubCmponents;
static bool s_ListHierarchicalPinByName;
static bool s_ListBySheet;
static bool s_BrowsList;
static bool s_BrowseCreatedList;
static int s_OutputFormOpt;
static int s_OutputSeparatorOpt;
static bool s_Add_FpField_state;
@ -55,6 +42,8 @@ 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,
@ -65,11 +54,13 @@ static bool* s_AddFieldList[] = {
&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" )
@ -79,58 +70,43 @@ static bool* s_AddFieldList[] = {
static char s_ExportSeparator[] = ("\t;,.");
/*!
* WinEDA_Build_BOM_Frame type definition
* DIALOG_BUILD_BOM dialog type definition
*/
IMPLEMENT_DYNAMIC_CLASS( WinEDA_Build_BOM_Frame, wxDialog )
/*!
* WinEDA_Build_BOM_Frame event table definition
*/
BEGIN_EVENT_TABLE( WinEDA_Build_BOM_Frame, wxDialog )
////@begin WinEDA_Build_BOM_Frame event table entries
EVT_RADIOBOX( ID_RADIOBOX_SELECT_FORMAT, WinEDA_Build_BOM_Frame::OnRadioboxSelectFormatSelected )
EVT_BUTTON( ID_CREATE_LIST, WinEDA_Build_BOM_Frame::OnCreateListClick )
EVT_BUTTON( wxID_OK, WinEDA_Build_BOM_Frame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_Build_BOM_Frame::OnCancelClick )
EVT_BUTTON( wxID_APPLY, WinEDA_Build_BOM_Frame::OnApplyClick )
////@end WinEDA_Build_BOM_Frame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_Build_BOM_Frame constructors
*/
WinEDA_Build_BOM_Frame::WinEDA_Build_BOM_Frame()
DIALOG_BUILD_BOM::DIALOG_BUILD_BOM( WinEDA_DrawFrame* parent ):
DIALOG_BUILD_BOM_BASE(parent)
{
}
WinEDA_Build_BOM_Frame::WinEDA_Build_BOM_Frame( WinEDA_DrawFrame* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{
wxConfig* config = wxGetApp().m_EDA_Config;
m_Config = wxGetApp().m_EDA_Config;
wxASSERT( config != NULL );
m_Parent = parent;
Init( );
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
Centre();
}
/*!
* Init Controls for DIALOG_BUILD_BOM
*/
void DIALOG_BUILD_BOM::Init()
{
SetFont( *g_DialogFont );
SetFocus();
/* Get options */
s_OutputFormOpt = config->Read( OPTION_BOM_FORMAT, (long) 0 );
s_OutputSeparatorOpt = config->Read( OPTION_BOM_SEPARATOR, (long) 0 );
long addfields = config->Read( OPTION_BOM_ADD_FIELD, (long) 0 );
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) )
@ -141,210 +117,6 @@ WinEDA_Build_BOM_Frame::WinEDA_Build_BOM_Frame( WinEDA_DrawFrame* parent,
bitmask <<= 1;
}
Create( parent, id, caption, pos, size, style );
m_OutputFormCtrl->SetSelection( s_OutputFormOpt );
m_OutputSeparatorCtrl->SetSelection( s_OutputSeparatorOpt );
// Enable/disable options:
if( s_OutputFormOpt == 1 )
{
m_OutputSeparatorCtrl->Enable( true );
m_ListCmpbyValItems->Enable( false );
m_GenListLabelsbyVal->Enable( false );
m_GenListLabelsbySheet->Enable( false );
}
else
{
m_OutputSeparatorCtrl->Enable( false );
m_ListCmpbyValItems->Enable( true );
m_GenListLabelsbyVal->Enable( true );
m_GenListLabelsbySheet->Enable( true );
}
}
/*!
* WinEDA_Build_BOM_Frame creator
*/
bool WinEDA_Build_BOM_Frame::Create( wxWindow* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{
////@begin WinEDA_Build_BOM_Frame member initialisation
m_ListCmpbyRefItems = NULL;
m_ListSubCmpItems = NULL;
m_ListCmpbyValItems = NULL;
m_GenListLabelsbyVal = NULL;
m_GenListLabelsbySheet = NULL;
m_OutputFormCtrl = NULL;
m_OutputSeparatorCtrl = NULL;
m_GetListBrowser = NULL;
m_FieldsToAppendListSizer = NULL;
m_AddFootprintField = NULL;
m_AddField1 = NULL;
m_AddField2 = NULL;
m_AddField3 = NULL;
m_AddField4 = NULL;
m_AddField5 = NULL;
m_AddField6 = NULL;
m_AddField7 = NULL;
m_AddField8 = NULL;
m_btClose = NULL;
////@end WinEDA_Build_BOM_Frame member initialisation
////@begin WinEDA_Build_BOM_Frame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
Centre();
////@end WinEDA_Build_BOM_Frame creation
return TRUE;
}
/*!
* Control creation for WinEDA_Build_BOM_Frame
*/
void WinEDA_Build_BOM_Frame::CreateControls()
{
SetFont( *g_DialogFont );
////@begin WinEDA_Build_BOM_Frame content construction
// Generated by DialogBlocks, 29/04/2008 20:58:26 (unregistered)
WinEDA_Build_BOM_Frame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, 5);
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
wxStaticBox* itemStaticBoxSizer5Static = new wxStaticBox(itemDialog1, wxID_ANY, _("List items:"));
wxStaticBoxSizer* itemStaticBoxSizer5 = new wxStaticBoxSizer(itemStaticBoxSizer5Static, wxVERTICAL);
itemBoxSizer4->Add(itemStaticBoxSizer5, 0, wxGROW|wxALL, 5);
m_ListCmpbyRefItems = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Components by reference"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_ListCmpbyRefItems->SetValue(true);
itemStaticBoxSizer5->Add(m_ListCmpbyRefItems, 0, wxALIGN_LEFT|wxALL, 5);
m_ListSubCmpItems = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("Sub Components (i.e. U2A, U2B ...)"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_ListSubCmpItems->SetValue(false);
itemStaticBoxSizer5->Add(m_ListSubCmpItems, 0, wxALIGN_LEFT|wxALL, 5);
m_ListCmpbyValItems = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _("Components by value"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_ListCmpbyValItems->SetValue(true);
itemStaticBoxSizer5->Add(m_ListCmpbyValItems, 0, wxALIGN_LEFT|wxALL, 5);
m_GenListLabelsbyVal = new wxCheckBox( itemDialog1, ID_CHECKBOX4, _("Hierachy Pins by Name"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_GenListLabelsbyVal->SetValue(false);
itemStaticBoxSizer5->Add(m_GenListLabelsbyVal, 0, wxALIGN_LEFT|wxALL, 5);
m_GenListLabelsbySheet = new wxCheckBox( itemDialog1, ID_CHECKBOX5, _("Hierachy Pins by Sheets"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_GenListLabelsbySheet->SetValue(false);
itemStaticBoxSizer5->Add(m_GenListLabelsbySheet, 0, wxALIGN_LEFT|wxALL, 5);
wxArrayString m_OutputFormCtrlStrings;
m_OutputFormCtrlStrings.Add(_("List"));
m_OutputFormCtrlStrings.Add(_("Text for spreadsheet import"));
m_OutputFormCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX_SELECT_FORMAT, _("Output format:"), wxDefaultPosition, wxDefaultSize, m_OutputFormCtrlStrings, 1, wxRA_SPECIFY_COLS );
m_OutputFormCtrl->SetSelection(0);
itemBoxSizer4->Add(m_OutputFormCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5);
wxArrayString m_OutputSeparatorCtrlStrings;
m_OutputSeparatorCtrlStrings.Add(_("Tab"));
m_OutputSeparatorCtrlStrings.Add(_(";"));
m_OutputSeparatorCtrlStrings.Add(_(","));
m_OutputSeparatorCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX_SEPARATOR, _("Field separator for spreadsheet import:"), wxDefaultPosition, wxDefaultSize, m_OutputSeparatorCtrlStrings, 1, wxRA_SPECIFY_ROWS );
m_OutputSeparatorCtrl->SetSelection(0);
itemBoxSizer4->Add(m_OutputSeparatorCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxStaticBox* itemStaticBoxSizer13Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options:"));
wxStaticBoxSizer* itemStaticBoxSizer13 = new wxStaticBoxSizer(itemStaticBoxSizer13Static, wxHORIZONTAL);
itemBoxSizer4->Add(itemStaticBoxSizer13, 0, wxGROW|wxALL, 5);
m_GetListBrowser = new wxCheckBox( itemDialog1, ID_CHECKBOX6, _("Launch list browser"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_GetListBrowser->SetValue(false);
itemStaticBoxSizer13->Add(m_GetListBrowser, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer3->Add(itemBoxSizer15, 0, wxALIGN_TOP|wxLEFT|wxTOP|wxBOTTOM, 5);
wxStaticBox* itemStaticBoxSizer16Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Fields to add:"));
m_FieldsToAppendListSizer = new wxStaticBoxSizer(itemStaticBoxSizer16Static, wxVERTICAL);
itemBoxSizer15->Add(m_FieldsToAppendListSizer, 0, wxALIGN_LEFT|wxALL, 5);
m_AddFootprintField = new wxCheckBox( itemDialog1, ID_CHECKBOX_FOOTPRINT_FIELD, _("Footprint"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddFootprintField->SetValue(false);
m_FieldsToAppendListSizer->Add(m_AddFootprintField, 0, wxGROW|wxALL, 5);
m_AddField1 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD1, _("Field 1"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField1->SetValue(false);
m_FieldsToAppendListSizer->Add(m_AddField1, 0, wxGROW|wxALL, 5);
m_AddField2 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD2, _("Field 2"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField2->SetValue(false);
m_FieldsToAppendListSizer->Add(m_AddField2, 0, wxGROW|wxALL, 5);
m_AddField3 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD3, _("Field 3"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField3->SetValue(false);
m_FieldsToAppendListSizer->Add(m_AddField3, 0, wxGROW|wxALL, 5);
m_AddField4 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD4, _("Field 4"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField4->SetValue(false);
m_FieldsToAppendListSizer->Add(m_AddField4, 0, wxGROW|wxALL, 5);
m_AddField5 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD5, _("Field 5"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField5->SetValue(false);
m_FieldsToAppendListSizer->Add(m_AddField5, 0, wxGROW|wxALL, 5);
m_AddField6 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD6, _("Field 6"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField6->SetValue(false);
m_FieldsToAppendListSizer->Add(m_AddField6, 0, wxGROW|wxALL, 5);
m_AddField7 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD7, _("Field 7"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField7->SetValue(false);
m_FieldsToAppendListSizer->Add(m_AddField7, 0, wxGROW|wxALL, 5);
m_AddField8 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD8, _("Field 8"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField8->SetValue(false);
m_FieldsToAppendListSizer->Add(m_AddField8, 0, wxGROW|wxALL, 5);
itemBoxSizer15->Add(5, 5, 0, wxGROW|wxALL, 10);
wxButton* itemButton27 = new wxButton( itemDialog1, ID_CREATE_LIST, _("Create &List"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton27->SetDefault();
itemButton27->SetForegroundColour(wxColour(166, 0, 0));
itemBoxSizer15->Add(itemButton27, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxBoxSizer* itemBoxSizer28 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer28, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxButton* itemButton29 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton29->SetForegroundColour(wxColour(255, 0, 0));
itemBoxSizer28->Add(itemButton29, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 );
m_btClose->SetForegroundColour(wxColour(0, 0, 255));
itemBoxSizer28->Add(m_btClose, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxButton* itemButton31 = new wxButton( itemDialog1, wxID_APPLY, _("&Apply"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer28->Add(itemButton31, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
// Set validators
m_ListCmpbyRefItems->SetValidator( wxGenericValidator(& s_ListByRef) );
m_ListSubCmpItems->SetValidator( wxGenericValidator(& s_ListWithSubCmponents) );
@ -353,7 +125,7 @@ void WinEDA_Build_BOM_Frame::CreateControls()
m_GenListLabelsbySheet->SetValidator( wxGenericValidator(& s_ListBySheet) );
m_OutputFormCtrl->SetValidator( wxGenericValidator(& s_OutputFormOpt) );
m_OutputSeparatorCtrl->SetValidator( wxGenericValidator(& s_OutputSeparatorOpt) );
m_GetListBrowser->SetValidator( wxGenericValidator(& s_BrowsList) );
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) );
@ -363,47 +135,14 @@ void WinEDA_Build_BOM_Frame::CreateControls()
m_AddField6->SetValidator( wxGenericValidator(& s_Add_F6_state) );
m_AddField7->SetValidator( wxGenericValidator(& s_Add_F7_state) );
m_AddField8->SetValidator( wxGenericValidator(& s_Add_F8_state) );
////@end WinEDA_Build_BOM_Frame content construction
m_AddAllFields->SetValidator( wxGenericValidator(& s_Add_Alls_state) );
m_btClose->SetFocus();
}
m_OutputFormCtrl->SetSelection( s_OutputFormOpt );
m_OutputSeparatorCtrl->SetSelection( s_OutputSeparatorOpt );
/*!
* Should we show tooltips?
*/
bool WinEDA_Build_BOM_Frame::ShowToolTips()
{
return TRUE;
}
/*!
* Get bitmap resources
*/
wxBitmap WinEDA_Build_BOM_Frame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_Build_BOM_Frame bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
////@end WinEDA_Build_BOM_Frame bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon WinEDA_Build_BOM_Frame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_Build_BOM_Frame icon retrieval
wxUnusedVar(name);
return wxNullIcon;
////@end WinEDA_Build_BOM_Frame icon retrieval
// Enable/disable options:
wxCommandEvent dummy;
OnRadioboxSelectFormatSelected( dummy );
}
@ -411,7 +150,7 @@ wxIcon WinEDA_Build_BOM_Frame::GetIconResource( const wxString& name )
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX_SELECT_FORMAT
*/
void WinEDA_Build_BOM_Frame::OnRadioboxSelectFormatSelected( wxCommandEvent& event )
void DIALOG_BUILD_BOM::OnRadioboxSelectFormatSelected( wxCommandEvent& event )
{
if( m_OutputFormCtrl->GetSelection() == 1 )
{
@ -431,10 +170,10 @@ void WinEDA_Build_BOM_Frame::OnRadioboxSelectFormatSelected( wxCommandEvent& eve
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CREATE_LIST
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
void WinEDA_Build_BOM_Frame::OnCreateListClick( wxCommandEvent& event )
void DIALOG_BUILD_BOM::OnOkClick( wxCommandEvent& event )
{
char ExportSeparatorSymbol = s_ExportSeparator[0];
if( m_OutputSeparatorCtrl->GetSelection() > 0 )
@ -449,44 +188,21 @@ void WinEDA_Build_BOM_Frame::OnCreateListClick( wxCommandEvent& event )
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
void WinEDA_Build_BOM_Frame::OnOkClick( wxCommandEvent& event )
{
SavePreferences();
EndModal( 0 );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void WinEDA_Build_BOM_Frame::OnCancelClick( wxCommandEvent& event )
void DIALOG_BUILD_BOM::OnCancelClick( wxCommandEvent& event )
{
EndModal( -1 );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY
*/
void WinEDA_Build_BOM_Frame::OnApplyClick( wxCommandEvent& event )
{
SavePreferences();
}
/**************************************************/
void WinEDA_Build_BOM_Frame::SavePreferences()
void DIALOG_BUILD_BOM::SavePreferences()
/**************************************************/
{
wxConfig* config = wxGetApp().m_EDA_Config;
wxASSERT( 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.)
@ -495,7 +211,9 @@ void WinEDA_Build_BOM_Frame::SavePreferences()
s_ListByValue = m_ListCmpbyValItems->GetValue();
s_ListHierarchicalPinByName = m_GenListLabelsbyVal->GetValue();
s_ListBySheet = m_GenListLabelsbySheet->GetValue();
s_BrowsList = m_GetListBrowser->GetValue();
s_BrowseCreatedList = m_GetListBrowser->GetValue();
// (aved in config ):
// Determine current settings of both radiobutton groups
s_OutputFormOpt = m_OutputFormCtrl->GetSelection();
@ -513,10 +231,12 @@ void WinEDA_Build_BOM_Frame::SavePreferences()
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
config->Write( OPTION_BOM_FORMAT, (long) s_OutputFormOpt );
config->Write( OPTION_BOM_SEPARATOR, (long) s_OutputSeparatorOpt );
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;
@ -527,5 +247,5 @@ void WinEDA_Build_BOM_Frame::SavePreferences()
bitmask <<= 1;
}
config->Write( OPTION_BOM_ADD_FIELD, addfields );
m_Config->Write( OPTION_BOM_ADD_FIELD, addfields );
}

View File

@ -1,133 +1,28 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_build_BOM.h
// Purpose:
// Author: jean-pieere Charras
// Modified by:
// Created: 01/15/06 18:18:44
// RCS-ID:
// Copyright: GNU license
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 01/15/06 18:18:44
#ifndef _DIALOG_BUILD_BOM_H_
#define _DIALOG_BUILD_BOM_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "dialog_build_BOM.cpp"
#endif
#include "dialog_build_BOM_base.h"
/*!
* Includes
*/
////@begin includes
#include "wx/valgen.h"
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define ID_CHECKBOX1 10001
#define ID_CHECKBOX2 10002
#define ID_CHECKBOX3 10003
#define ID_CHECKBOX4 10004
#define ID_CHECKBOX5 10005
#define ID_RADIOBOX_SELECT_FORMAT 10006
#define ID_RADIOBOX_SEPARATOR 10007
#define ID_CHECKBOX6 10008
#define ID_CHECKBOX_FOOTPRINT_FIELD 10018
#define ID_CHECKBOX_FIELD1 10009
#define ID_CHECKBOX_FIELD2 10010
#define ID_CHECKBOX_FIELD3 10011
#define ID_CHECKBOX_FIELD4 10012
#define ID_CHECKBOX_FIELD5 10013
#define ID_CHECKBOX_FIELD6 10014
#define ID_CHECKBOX_FIELD7 10015
#define ID_CHECKBOX_FIELD8 10016
#define ID_CREATE_LIST 10017
#define SYMBOL_WINEDA_BUILD_BOM_FRAME_STYLE wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_BUILD_BOM_FRAME_TITLE _("List of Material")
#define SYMBOL_WINEDA_BUILD_BOM_FRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_BUILD_BOM_FRAME_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_BUILD_BOM_FRAME_POSITION wxDefaultPosition
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
#ifndef wxFIXED_MINSIZE
#define wxFIXED_MINSIZE 0
#endif
/*!
* WinEDA_Build_BOM_Frame class declaration
*/
class WinEDA_Build_BOM_Frame: public wxDialog
class DIALOG_BUILD_BOM : public DIALOG_BUILD_BOM_BASE
{
DECLARE_DYNAMIC_CLASS( WinEDA_Build_BOM_Frame )
DECLARE_EVENT_TABLE()
private:
WinEDA_DrawFrame * m_Parent;
wxConfig* m_Config;
wxString m_ListFileName;
public:
/// Constructors
WinEDA_Build_BOM_Frame( );
WinEDA_Build_BOM_Frame( WinEDA_DrawFrame* parent,
wxWindowID id = SYMBOL_WINEDA_BUILD_BOM_FRAME_IDNAME,
const wxString& caption = SYMBOL_WINEDA_BUILD_BOM_FRAME_TITLE,
const wxPoint& pos = SYMBOL_WINEDA_BUILD_BOM_FRAME_POSITION,
const wxSize& size = SYMBOL_WINEDA_BUILD_BOM_FRAME_SIZE,
long style = SYMBOL_WINEDA_BUILD_BOM_FRAME_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_BUILD_BOM_FRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_BUILD_BOM_FRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_BUILD_BOM_FRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_BUILD_BOM_FRAME_SIZE, long style = SYMBOL_WINEDA_BUILD_BOM_FRAME_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin WinEDA_Build_BOM_Frame event handler declarations
/// wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX_SELECT_FORMAT
private:
void OnRadioboxSelectFormatSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CREATE_LIST
void OnCreateListClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY
void OnApplyClick( wxCommandEvent& event );
////@end WinEDA_Build_BOM_Frame event handler declarations
////@begin WinEDA_Build_BOM_Frame member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end WinEDA_Build_BOM_Frame member function declarations
void SavePreferences();
void Init( );
void Create_BOM_Lists(bool aTypeFileIsExport,
bool aIncludeSubComponents,
char aExportSeparatorSymbol,
@ -139,38 +34,14 @@ public:
int PrintComponentsListByVal( FILE *f, std::vector <OBJ_CMP_TO_LIST>& aList,
bool aIncludeSubComponents);
void PrintFieldData(FILE * f, SCH_COMPONENT * DrawLibItem, bool CompactForm = FALSE);
void SavePreferences();
/// Should we show tooltips?
static bool ShowToolTips();
public:
DIALOG_BUILD_BOM( WinEDA_DrawFrame* parent );
~DIALOG_BUILD_BOM() {};
////@begin WinEDA_Build_BOM_Frame member variables
wxCheckBox* m_ListCmpbyRefItems;
wxCheckBox* m_ListSubCmpItems;
wxCheckBox* m_ListCmpbyValItems;
wxCheckBox* m_GenListLabelsbyVal;
wxCheckBox* m_GenListLabelsbySheet;
wxRadioBox* m_OutputFormCtrl;
wxRadioBox* m_OutputSeparatorCtrl;
wxCheckBox* m_GetListBrowser;
wxStaticBoxSizer* m_FieldsToAppendListSizer;
wxCheckBox* m_AddFootprintField;
wxCheckBox* m_AddField1;
wxCheckBox* m_AddField2;
wxCheckBox* m_AddField3;
wxCheckBox* m_AddField4;
wxCheckBox* m_AddField5;
wxCheckBox* m_AddField6;
wxCheckBox* m_AddField7;
wxCheckBox* m_AddField8;
wxButton* m_btClose;
////@end WinEDA_Build_BOM_Frame member variables
WinEDA_DrawFrame * m_Parent;
wxString m_LibArchiveFileName;
wxString m_ListFileName;
};
#endif
// _DIALOG_BUILD_BOM_H_

View File

@ -0,0 +1,159 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_build_BOM_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_BUILD_BOM_BASE::DIALOG_BUILD_BOM_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 );
wxStaticBoxSizer* sbOptionsSizer;
sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL );
wxStaticBoxSizer* sbListOptionsSizer;
sbListOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("List items:") ), wxVERTICAL );
m_ListCmpbyRefItems = new wxCheckBox( this, wxID_ANY, _("Components by reference"), wxDefaultPosition, wxDefaultSize, 0 );
sbListOptionsSizer->Add( m_ListCmpbyRefItems, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ListSubCmpItems = new wxCheckBox( this, wxID_ANY, _("Sub components (i.e. U2A, U2B ...)"), wxDefaultPosition, wxDefaultSize, 0 );
sbListOptionsSizer->Add( m_ListSubCmpItems, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ListCmpbyValItems = new wxCheckBox( this, wxID_ANY, _("Components by value"), wxDefaultPosition, wxDefaultSize, 0 );
sbListOptionsSizer->Add( m_ListCmpbyValItems, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_GenListLabelsbyVal = new wxCheckBox( this, wxID_ANY, _("Hierachy pins by name"), wxDefaultPosition, wxDefaultSize, 0 );
sbListOptionsSizer->Add( m_GenListLabelsbyVal, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_GenListLabelsbySheet = new wxCheckBox( this, wxID_ANY, _("Hierachy pins by sheets"), wxDefaultPosition, wxDefaultSize, 0 );
sbListOptionsSizer->Add( m_GenListLabelsbySheet, 0, wxALL, 5 );
sbOptionsSizer->Add( sbListOptionsSizer, 0, wxEXPAND, 5 );
wxString m_OutputFormCtrlChoices[] = { _("List"), _("Text for spreadsheet import") };
int m_OutputFormCtrlNChoices = sizeof( m_OutputFormCtrlChoices ) / sizeof( wxString );
m_OutputFormCtrl = new wxRadioBox( this, ID_RADIOBOX_SELECT_FORMAT, _("Output format:"), wxDefaultPosition, wxDefaultSize, m_OutputFormCtrlNChoices, m_OutputFormCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_OutputFormCtrl->SetSelection( 0 );
sbOptionsSizer->Add( m_OutputFormCtrl, 0, wxALL|wxEXPAND, 5 );
wxString m_OutputSeparatorCtrlChoices[] = { _("Tab"), _(";"), _(",") };
int m_OutputSeparatorCtrlNChoices = sizeof( m_OutputSeparatorCtrlChoices ) / sizeof( wxString );
m_OutputSeparatorCtrl = new wxRadioBox( this, wxID_ANY, _("Field separator for spreadsheet import:"), wxDefaultPosition, wxDefaultSize, m_OutputSeparatorCtrlNChoices, m_OutputSeparatorCtrlChoices, 1, wxRA_SPECIFY_COLS|wxRA_SPECIFY_ROWS );
m_OutputSeparatorCtrl->SetSelection( 0 );
sbOptionsSizer->Add( m_OutputSeparatorCtrl, 1, wxALL, 5 );
wxStaticBoxSizer* sbBrowseOptSizer;
sbBrowseOptSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL );
m_GetListBrowser = new wxCheckBox( this, wxID_ANY, _("Launch list browser"), wxDefaultPosition, wxDefaultSize, 0 );
sbBrowseOptSizer->Add( m_GetListBrowser, 0, wxALL|wxEXPAND, 5 );
sbOptionsSizer->Add( sbBrowseOptSizer, 0, wxEXPAND, 5 );
bMainSizer->Add( sbOptionsSizer, 0, 0, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbFieldsSelectionSizer;
sbFieldsSelectionSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields to add:") ), wxVERTICAL );
wxStaticBoxSizer* sbFixedFieldsSizer;
sbFixedFieldsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("System Fields:") ), wxVERTICAL );
m_AddFootprintField = new wxCheckBox( this, wxID_ANY, _("Footprint"), wxDefaultPosition, wxDefaultSize, 0 );
sbFixedFieldsSizer->Add( m_AddFootprintField, 0, wxALL|wxEXPAND, 5 );
sbFieldsSelectionSizer->Add( sbFixedFieldsSizer, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbUsersFiledsSizer;
sbUsersFiledsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Users Fields:") ), wxVERTICAL );
m_AddField1 = new wxCheckBox( this, wxID_ANY, _("Field 1"), wxDefaultPosition, wxDefaultSize, 0 );
sbUsersFiledsSizer->Add( m_AddField1, 0, wxEXPAND|wxALL, 5 );
m_AddField2 = new wxCheckBox( this, wxID_ANY, _("Field 2"), wxDefaultPosition, wxDefaultSize, 0 );
sbUsersFiledsSizer->Add( m_AddField2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_AddField3 = new wxCheckBox( this, wxID_ANY, _("Field 3"), wxDefaultPosition, wxDefaultSize, 0 );
sbUsersFiledsSizer->Add( m_AddField3, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_AddField4 = new wxCheckBox( this, wxID_ANY, _("Field 4"), wxDefaultPosition, wxDefaultSize, 0 );
sbUsersFiledsSizer->Add( m_AddField4, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_AddField5 = new wxCheckBox( this, wxID_ANY, _("Field 5"), wxDefaultPosition, wxDefaultSize, 0 );
sbUsersFiledsSizer->Add( m_AddField5, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_AddField6 = new wxCheckBox( this, wxID_ANY, _("Field 6"), wxDefaultPosition, wxDefaultSize, 0 );
sbUsersFiledsSizer->Add( m_AddField6, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_AddField7 = new wxCheckBox( this, wxID_ANY, _("Field 7"), wxDefaultPosition, wxDefaultSize, 0 );
sbUsersFiledsSizer->Add( m_AddField7, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_AddField8 = new wxCheckBox( this, wxID_ANY, _("Field 8"), wxDefaultPosition, wxDefaultSize, 0 );
sbUsersFiledsSizer->Add( m_AddField8, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_AddAllFields = new wxCheckBox( this, wxID_ANY, _("All existing users fields"), wxDefaultPosition, wxDefaultSize, 0 );
sbUsersFiledsSizer->Add( m_AddAllFields, 0, wxALL, 5 );
sbFieldsSelectionSizer->Add( sbUsersFiledsSizer, 0, wxEXPAND, 5 );
bRightSizer->Add( sbFieldsSelectionSizer, 1, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 5 );
bRightSizer->Add( 10, 10, 0, 0, 5 );
m_buttonOK = new wxButton( this, wxID_OK, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonOK->SetDefault();
m_buttonOK->SetForegroundColour( wxColour( 170, 0, 0 ) );
bRightSizer->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonCANCEL->SetForegroundColour( wxColour( 11, 0, 202 ) );
bRightSizer->Add( m_buttonCANCEL, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
bMainSizer->Add( bRightSizer, 1, wxRIGHT|wxLEFT, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
m_OutputFormCtrl->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_BUILD_BOM_BASE::OnRadioboxSelectFormatSelected ), NULL, this );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BUILD_BOM_BASE::OnOkClick ), NULL, this );
m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BUILD_BOM_BASE::OnCancelClick ), NULL, this );
}
DIALOG_BUILD_BOM_BASE::~DIALOG_BUILD_BOM_BASE()
{
// Disconnect Events
m_OutputFormCtrl->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_BUILD_BOM_BASE::OnRadioboxSelectFormatSelected ), NULL, this );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BUILD_BOM_BASE::OnOkClick ), NULL, this );
m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BUILD_BOM_BASE::OnCancelClick ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,74 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_build_BOM_base__
#define __dialog_build_BOM_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_BUILD_BOM_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_BUILD_BOM_BASE : public wxDialog
{
private:
protected:
enum
{
ID_RADIOBOX_SELECT_FORMAT = 1000,
};
wxCheckBox* m_ListCmpbyRefItems;
wxCheckBox* m_ListSubCmpItems;
wxCheckBox* m_ListCmpbyValItems;
wxCheckBox* m_GenListLabelsbyVal;
wxCheckBox* m_GenListLabelsbySheet;
wxRadioBox* m_OutputFormCtrl;
wxRadioBox* m_OutputSeparatorCtrl;
wxCheckBox* m_GetListBrowser;
wxCheckBox* m_AddFootprintField;
wxCheckBox* m_AddField1;
wxCheckBox* m_AddField2;
wxCheckBox* m_AddField3;
wxCheckBox* m_AddField4;
wxCheckBox* m_AddField5;
wxCheckBox* m_AddField6;
wxCheckBox* m_AddField7;
wxCheckBox* m_AddField8;
wxCheckBox* m_AddAllFields;
wxButton* m_buttonOK;
wxButton* m_buttonCANCEL;
// Virtual event handlers, overide them in your derived class
virtual void OnRadioboxSelectFormatSelected( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
public:
DIALOG_BUILD_BOM_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("List of Material"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 415,382 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_BUILD_BOM_BASE();
};
#endif //__dialog_build_BOM_base__

View File

@ -89,6 +89,7 @@ OBJECTS = eeschema.o\
delete.o\
build_BOM.o \
dialog_build_BOM.o \
dialog_build_BOM_base.o \
erc.o\
dialog_erc.o\
selpart.o \

View File

@ -539,7 +539,7 @@ void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event )
void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent& )
/**********************************************************************/
{
WinEDA_Build_BOM_Frame* dlg = new WinEDA_Build_BOM_Frame( this );
DIALOG_BUILD_BOM* dlg = new DIALOG_BUILD_BOM( this );
dlg->ShowModal();
dlg->Destroy();

View File

@ -495,20 +495,38 @@ int ReturnValueFromString( int Units, const wxString& TextValue, int
*/
wxString ReturnStringFromValue( int aUnits, int aValue, int aInternal_Unit, bool aAdd_unit_symbol = false );
void AddUnitSymbol( wxStaticText& Stext, int Units = g_UnitMetric );
/* Add string " (mm):" or " ("):" to the static text Stext.
* Used in dialog boxes for entering values depending on selected units */
void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value, int Internal_Unit );
void AddUnitSymbol( wxStaticText& Stext, int Units = g_UnitMetric );
/* Convert the number Value in a string according to the internal units
* and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl */
int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit );
void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value, int Internal_Unit );
/* Convert the Value in the wxTextCtrl TextCtrl in an integer,
* according to the internal units and the selected unit (g_UnitMetric) */
int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit );
/**
* Function To_User_Unit
* Convert in inch or mm the variable "val" (double)given in internal units
* @return the converted value, in double
* @param is_metric : true if the result must be returned in mm , false if inches
* @param val : double : the given value
* @param internal_unit_value = internal units per inch
*/
double To_User_Unit( bool is_metric, double val, int internal_unit_value );
/**
* Function To_User_Unit
* Convert in inch or mm the variable "val" (double)given in internal units
* @return the converted value, in double
* @param is_metric : true if the result must be returned in mm , false if inches
* @param val : integer : the given value
* @param internal_unit_value = internal units per inch
*/
double To_User_Unit( bool is_metric, int val, int internal_unit_value );
int From_User_Unit( bool is_metric, double val, int internal_unit_value );
wxString GenDate();
void MyFree( void* pt_mem );

View File

@ -228,7 +228,7 @@ enum main_id {
ID_POPUP_GRID_PLUS,
ID_POPUP_GRID_MOINS,
ID_POPUP_GRID_SELECT,
ID_POPUP_GRID_LEVEL_1000,
ID_POPUP_GRID_LEVEL_1000, // id for first predefined grid in inches (1000 * 0.0001 inch)
ID_POPUP_GRID_LEVEL_500,
ID_POPUP_GRID_LEVEL_250,
ID_POPUP_GRID_LEVEL_200,
@ -239,7 +239,12 @@ enum main_id {
ID_POPUP_GRID_LEVEL_10,
ID_POPUP_GRID_LEVEL_5,
ID_POPUP_GRID_LEVEL_2,
ID_POPUP_GRID_LEVEL_1,
ID_POPUP_GRID_LEVEL_1, // id for last predefined grid in inches ( 0.0001 inch)
ID_POPUP_GRID_LEVEL_1MM, // id for first predefined grid in mm (1mm)
ID_POPUP_GRID_LEVEL_0_5MM,
ID_POPUP_GRID_LEVEL_0_25MM,
ID_POPUP_GRID_LEVEL_0_2MM,
ID_POPUP_GRID_LEVEL_0_1MM,
ID_POPUP_GRID_USER,

View File

@ -351,7 +351,7 @@ void WinEDA_BasePcbFrame::Affiche_Status_Box()
ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
Line.Printf( g_UnitMetric ? wxT( "Ro %.3f Th %.1f" ) : wxT( "Ro %.4f Th %.1f" ),
To_User_Unit( g_UnitMetric, (int) round( ro ), m_InternalUnits ),
To_User_Unit( g_UnitMetric, ro, m_InternalUnits ),
theta );
}

View File

@ -21,14 +21,18 @@
* Also useful in Gerbview for this reason.
* Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic functions )
*/
static const int PcbZoomList[] = { 5, 10, 15, 22, 30, 45, 70, 100, 150, 220, 350, 500, 800, 1200,
2000, 3500, 5000, 10000, 20000 };
static const int PcbZoomList[] = {
5, 10, 15, 22, 30, 45, 70, 100, 150, 220, 350, 500, 800, 1200,
2000, 3500, 5000, 10000, 20000
};
#define PCB_ZOOM_LIST_CNT ( sizeof( PcbZoomList ) / sizeof( int ) )
/* Default grid sizes for PCB editor screens. */
#define MM_TO_PCB_UNITS 10000.0 / 25.4
static GRID_TYPE PcbGridList[] = {
// predefined grid list in 0.0001 inches
{ ID_POPUP_GRID_LEVEL_1000, wxRealPoint( 1000, 1000 ) },
{ ID_POPUP_GRID_LEVEL_500, wxRealPoint( 500, 500 ) },
{ ID_POPUP_GRID_LEVEL_250, wxRealPoint( 250, 250 ) },
@ -40,7 +44,14 @@ static GRID_TYPE PcbGridList[] = {
{ ID_POPUP_GRID_LEVEL_10, wxRealPoint( 10, 10 ) },
{ ID_POPUP_GRID_LEVEL_5, wxRealPoint( 5, 5 ) },
{ ID_POPUP_GRID_LEVEL_2, wxRealPoint( 2, 2 ) },
{ ID_POPUP_GRID_LEVEL_1, wxRealPoint( 1, 1 ) }
{ ID_POPUP_GRID_LEVEL_1, wxRealPoint( 1, 1 ) },
// predefined grid list in mm
{ ID_POPUP_GRID_LEVEL_1MM, wxRealPoint( MM_TO_PCB_UNITS, MM_TO_PCB_UNITS ) },
{ ID_POPUP_GRID_LEVEL_0_5MM, wxRealPoint( MM_TO_PCB_UNITS * 0.5, MM_TO_PCB_UNITS * 0.5 ) },
{ ID_POPUP_GRID_LEVEL_0_25MM, wxRealPoint( MM_TO_PCB_UNITS * 0.25, MM_TO_PCB_UNITS * 0.25 ) },
{ ID_POPUP_GRID_LEVEL_0_2MM, wxRealPoint( MM_TO_PCB_UNITS * 0.2, MM_TO_PCB_UNITS * 0.2 ) },
{ ID_POPUP_GRID_LEVEL_0_1MM, wxRealPoint( MM_TO_PCB_UNITS * 0.1, MM_TO_PCB_UNITS * 0.1 ) }
};
#define PCB_GRID_LIST_CNT ( sizeof( PcbGridList ) / sizeof( GRID_TYPE ) )

View File

@ -240,7 +240,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, w
PlotGraphicText( format, wxPoint(x,y), BLACK,
Text,
0, wxSize((int)(CharSize * CharScale), (int)(CharSize * CharScale)),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
TextWidth );
break;
}
@ -344,7 +344,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, w
PlotGraphicText( format, wxPoint(x,y), BLACK,
msg,
0, wxSize((int)(CharSize * CharScale), (int)(CharSize * CharScale)),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
TextWidth );
break;
}

View File

@ -620,9 +620,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{
GRID_TYPE grid = GetScreen()->m_GridList[i];
double value = To_User_Unit( g_UnitMetric,
(int)grid.m_Size.x,
PCB_INTERNAL_UNIT );
double value = To_User_Unit( g_UnitMetric, grid.m_Size.x, m_InternalUnits );
if( grid.m_Id != ID_POPUP_GRID_USER )
{
if( g_UnitMetric == INCHES )