Commit afdf5258 authored by brian.'s avatar brian. Committed by jean-pierre charras

Commit patch from Brian Sidebotham (Bus width value option)

parent 76765f22
......@@ -37,6 +37,15 @@ DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( wxWindow* parent ) :
{
m_choiceUnits->SetFocus();
m_sdbSizer1OK->SetDefault();
#if defined (KICAD_GOST)
/* The GOST standard pre-defines certain schematic attributes that cannot be changed */
m_spinBusWidth->Enable(false);
#endif
}
......
......@@ -41,44 +41,43 @@ public:
void SetUnits( const wxArrayString& units, int select = 0 );
int GetUnitsSelection( void ) { return m_choiceUnits->GetSelection(); }
void SetGridSelection( int select )
{
m_choiceGridSize->SetSelection( select );
}
void SetGridSelection( int select ) { m_choiceGridSize->SetSelection( select ); }
int GetGridSelection( void ) { return m_choiceGridSize->GetSelection(); }
void SetGridSizes( const GRIDS& grid_sizes, int grid_id );
void SetLineWidth( int line_width )
void SetBusWidth( int aWidth )
{
m_spinLineWidth->SetValue( line_width );
#if defined( KICAD_GOST )
m_spinBusWidth->SetValue( GOST_BUS_WIDTH );
#else
m_spinBusWidth->SetValue( aWidth );
#endif
}
int GetLineWidth( void ) { return m_spinLineWidth->GetValue(); }
void SetTextSize( int text_size )
int GetBusWidth( void )
{
m_spinTextSize->SetValue( text_size );
#if defined( KICAD_GOST )
return GOST_BUS_WIDTH;
#else
return m_spinBusWidth->GetValue();
#endif
}
void SetLineWidth( int aWidth ) { m_spinLineWidth->SetValue( aWidth ); }
int GetLineWidth( void ) { return m_spinLineWidth->GetValue(); }
void SetTextSize( int text_size ) { m_spinTextSize->SetValue( text_size ); }
int GetTextSize( void ) { return m_spinTextSize->GetValue(); }
void SetRepeatHorizontal( int displacement )
{
m_spinRepeatHorizontal->SetValue( displacement );
}
int GetRepeatHorizontal( void )
{
return m_spinRepeatHorizontal->GetValue();
}
int GetRepeatHorizontal( void ) { return m_spinRepeatHorizontal->GetValue(); }
void SetRepeatVertical( int displacement ) { m_spinRepeatVertical->SetValue( displacement ); }
void SetRepeatVertical( int displacement )
{
m_spinRepeatVertical->SetValue( displacement );
}
int GetRepeatVertical( void ) { return m_spinRepeatVertical->GetValue(); }
void SetRepeatLabel( int increment )
{
m_spinRepeatLabel->SetValue( increment );
}
void SetRepeatLabel( int increment ) { m_spinRepeatLabel->SetValue( increment ); }
int GetRepeatLabel( void ) { return m_spinRepeatLabel->GetValue(); }
void SetAutoSaveInterval( int aInterval ) { m_spinAutoSaveInterval->SetValue( aInterval ); }
......@@ -87,14 +86,8 @@ public:
void SetShowGrid( bool show ) { m_checkShowGrid->SetValue( show ); }
bool GetShowGrid( void ) { return m_checkShowGrid->GetValue(); }
void SetShowHiddenPins( bool show )
{
m_checkShowHiddenPins->SetValue( show );
}
bool GetShowHiddenPins( void )
{
return m_checkShowHiddenPins->GetValue();
}
void SetShowHiddenPins( bool show ) { m_checkShowHiddenPins->SetValue( show ); }
bool GetShowHiddenPins( void ) { return m_checkShowHiddenPins->GetValue(); }
void SetEnableMiddleButtonPan( bool enable )
{
......@@ -106,7 +99,6 @@ public:
{
return m_checkEnableMiddleButtonPan->GetValue();
}
void SetMiddleButtonPanLimited( bool enable )
{
m_checkMiddleButtonPanLimited->SetValue( enable );
......@@ -116,30 +108,14 @@ public:
return m_checkMiddleButtonPanLimited->GetValue();
}
void SetEnableAutoPan( bool enable )
{
m_checkAutoPan->SetValue( enable );
}
void SetEnableAutoPan( bool enable ) { m_checkAutoPan->SetValue( enable ); }
bool GetEnableAutoPan( void ) { return m_checkAutoPan->GetValue(); }
void SetEnableHVBusOrientation( bool enable )
{
m_checkHVOrientation->SetValue( enable );
}
bool GetEnableHVBusOrientation( void )
{
return m_checkHVOrientation->GetValue();
}
void SetShowPageLimits( bool show )
{
m_checkPageLimits->SetValue( show );
}
bool GetShowPageLimits( void )
{
return m_checkPageLimits->GetValue();
}
void SetEnableHVBusOrientation( bool enable ) { m_checkHVOrientation->SetValue( enable ); }
bool GetEnableHVBusOrientation( void ) { return m_checkHVOrientation->GetValue(); }
void SetShowPageLimits( bool show ) { m_checkPageLimits->SetValue( show ); }
bool GetShowPageLimits( void ) { return m_checkPageLimits->GetValue(); }
/** Set the field \a aNdx textctrl to \a aName */
void SetFieldName( int aNdx, wxString aName );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 17 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EESCHEMA_OPTIONS_BASE_H__
#define __DIALOG_EESCHEMA_OPTIONS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/spinctrl.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/textctrl.h>
#include <wx/notebook.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EESCHEMA_OPTIONS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); }
void _wxFB_OnMiddleBtnPanEnbl( wxCommandEvent& event ){ OnMiddleBtnPanEnbl( event ); }
protected:
enum
{
ID_M_SPINAUTOSAVEINTERVAL = 1000,
xwID_ANY
};
wxNotebook* m_notebook1;
wxPanel* m_panel1;
wxStaticText* m_staticText2;
wxChoice* m_choiceUnits;
wxStaticText* m_staticText3;
wxChoice* m_choiceGridSize;
wxStaticText* m_staticGridUnits;
wxStaticText* m_staticText5;
wxSpinCtrl* m_spinLineWidth;
wxStaticText* m_staticLineWidthUnits;
wxStaticText* m_staticText7;
wxSpinCtrl* m_spinTextSize;
wxStaticText* m_staticTextSizeUnits;
wxStaticText* m_staticText9;
wxSpinCtrl* m_spinRepeatHorizontal;
wxStaticText* m_staticRepeatXUnits;
wxStaticText* m_staticText12;
wxSpinCtrl* m_spinRepeatVertical;
wxStaticText* m_staticRepeatYUnits;
wxStaticText* m_staticText16;
wxSpinCtrl* m_spinRepeatLabel;
wxStaticText* m_staticText221;
wxSpinCtrl* m_spinAutoSaveInterval;
wxStaticText* m_staticText23;
wxCheckBox* m_checkShowGrid;
wxCheckBox* m_checkShowHiddenPins;
wxCheckBox* m_checkEnableMiddleButtonPan;
wxCheckBox* m_checkMiddleButtonPanLimited;
wxCheckBox* m_checkAutoPan;
wxCheckBox* m_checkHVOrientation;
wxCheckBox* m_checkPageLimits;
wxPanel* m_panel2;
wxStaticText* m_staticText211;
wxStaticText* m_staticText15;
wxTextCtrl* m_fieldName1;
wxStaticText* m_staticText161;
wxTextCtrl* m_fieldName2;
wxStaticText* m_staticText17;
wxTextCtrl* m_fieldName3;
wxStaticText* m_staticText18;
wxTextCtrl* m_fieldName4;
wxStaticText* m_staticText19;
wxTextCtrl* m_fieldName5;
wxStaticText* m_staticText20;
wxTextCtrl* m_fieldName6;
wxStaticText* m_staticText21;
wxTextCtrl* m_fieldName7;
wxStaticText* m_staticText22;
wxTextCtrl* m_fieldName8;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnChooseUnits( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMiddleBtnPanEnbl( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EESCHEMA_OPTIONS_BASE();
};
#endif //__DIALOG_EESCHEMA_OPTIONS_BASE_H__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 17 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EESCHEMA_OPTIONS_BASE_H__
#define __DIALOG_EESCHEMA_OPTIONS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/spinctrl.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/textctrl.h>
#include <wx/notebook.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EESCHEMA_OPTIONS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); }
void _wxFB_OnMiddleBtnPanEnbl( wxCommandEvent& event ){ OnMiddleBtnPanEnbl( event ); }
protected:
enum
{
ID_M_SPINAUTOSAVEINTERVAL = 1000,
xwID_ANY
};
wxNotebook* m_notebook1;
wxPanel* m_panel1;
wxStaticText* m_staticText2;
wxChoice* m_choiceUnits;
wxStaticText* m_staticText3;
wxChoice* m_choiceGridSize;
wxStaticText* m_staticGridUnits;
wxStaticText* m_staticText51;
wxSpinCtrl* m_spinBusWidth;
wxStaticText* m_staticBusWidthUnits;
wxStaticText* m_staticText5;
wxSpinCtrl* m_spinLineWidth;
wxStaticText* m_staticLineWidthUnits;
wxStaticText* m_staticText7;
wxSpinCtrl* m_spinTextSize;
wxStaticText* m_staticTextSizeUnits;
wxStaticText* m_staticText9;
wxSpinCtrl* m_spinRepeatHorizontal;
wxStaticText* m_staticRepeatXUnits;
wxStaticText* m_staticText12;
wxSpinCtrl* m_spinRepeatVertical;
wxStaticText* m_staticRepeatYUnits;
wxStaticText* m_staticText16;
wxSpinCtrl* m_spinRepeatLabel;
wxStaticText* m_staticText221;
wxSpinCtrl* m_spinAutoSaveInterval;
wxStaticText* m_staticText23;
wxCheckBox* m_checkShowGrid;
wxCheckBox* m_checkShowHiddenPins;
wxCheckBox* m_checkEnableMiddleButtonPan;
wxCheckBox* m_checkMiddleButtonPanLimited;
wxCheckBox* m_checkAutoPan;
wxCheckBox* m_checkHVOrientation;
wxCheckBox* m_checkPageLimits;
wxPanel* m_panel2;
wxStaticText* m_staticText211;
wxStaticText* m_staticText15;
wxTextCtrl* m_fieldName1;
wxStaticText* m_staticText161;
wxTextCtrl* m_fieldName2;
wxStaticText* m_staticText17;
wxTextCtrl* m_fieldName3;
wxStaticText* m_staticText18;
wxTextCtrl* m_fieldName4;
wxStaticText* m_staticText19;
wxTextCtrl* m_fieldName5;
wxStaticText* m_staticText20;
wxTextCtrl* m_fieldName6;
wxStaticText* m_staticText21;
wxTextCtrl* m_fieldName7;
wxStaticText* m_staticText22;
wxTextCtrl* m_fieldName8;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnChooseUnits( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMiddleBtnPanEnbl( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EESCHEMA_OPTIONS_BASE();
};
#endif //__DIALOG_EESCHEMA_OPTIONS_BASE_H__
......@@ -55,6 +55,7 @@
#define FR_HISTORY_LIST_CNT 10 ///< Maximum number of find and replace strings.
int g_DefaultBusWidth = 9;
void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
{
......@@ -207,6 +208,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
dlg.SetUnits( units, g_UserUnit );
dlg.SetGridSizes( grid_list, GetScreen()->GetGridId() );
dlg.SetBusWidth( g_DefaultBusWidth );
dlg.SetLineWidth( g_DrawDefaultLineThickness );
dlg.SetTextSize( g_DefaultTextLabelSize );
dlg.SetRepeatHorizontal( g_RepeatStep.x );
......@@ -240,6 +242,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
GetScreen()->SetGrid( grid_list[ (size_t) dlg.GetGridSelection() ].m_Size );
g_DefaultBusWidth = dlg.GetBusWidth();
g_DrawDefaultLineThickness = dlg.GetLineWidth();
g_DefaultTextLabelSize = dlg.GetTextSize();
g_RepeatStep.x = dlg.GetRepeatHorizontal();
......@@ -420,7 +423,7 @@ void SCH_EDIT_FRAME::SaveProjectFile()
wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
}
static const wxString DefaultBusWidthEntry( wxT( "DefaultBusWidth" ) );
static const wxString DefaultDrawLineWidthEntry( wxT( "DefaultDrawLineWidth" ) );
static const wxString ShowHiddenPinsEntry( wxT( "ShowHiddenPins" ) );
static const wxString HorzVertLinesOnlyEntry( wxT( "HorizVertLinesOnly" ) );
......@@ -553,6 +556,7 @@ void SCH_EDIT_FRAME::LoadSettings()
// This is required until someone gets rid of the global variable g_LayerDescription().
m_GridColor = g_LayerDescr.LayerColor[LAYER_GRID];
g_DefaultBusWidth = cfg->Read( DefaultBusWidthEntry, (long) 8 );
g_DrawDefaultLineThickness = cfg->Read( DefaultDrawLineWidthEntry,(long) 6 );
cfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false );
cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true );
......@@ -644,6 +648,7 @@ void SCH_EDIT_FRAME::SaveSettings()
wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
cfg->Write( DefaultBusWidthEntry, (long) g_DefaultBusWidth );
cfg->Write( DefaultDrawLineWidthEntry, (long) g_DrawDefaultLineThickness );
cfg->Write( ShowHiddenPinsEntry, m_showAllPins );
cfg->Write( HorzVertLinesOnlyEntry, g_HVLines );
......
......@@ -8,7 +8,17 @@
#define GROUPCOMMON wxT( "/common" )
#define GROUPLIB wxT( "libraries" )
extern int g_PenMinWidth;
/**
* The width given to bus drawings that do not have a specific width
*/
extern int g_DefaultBusWidth;
#if defined(KICAD_GOST)
/** In a GOST build, the bus width is set and cannot be changed */
#define GOST_BUS_WIDTH 22
#endif
/* saving parameters option : */
#define INSETUP true /* used when the parameter is saved in general config
......
......@@ -36,6 +36,7 @@
#include <richio.h>
#include <plot_common.h>
#include <eeschema_config.h>
#include <general.h>
#include <protos.h>
#include <sch_bus_entry.h>
......@@ -167,10 +168,9 @@ int SCH_BUS_ENTRY::GetPenSize() const
{
int pensize = ( m_width == 0 ) ? g_DrawDefaultLineThickness : m_width;
if( m_Layer == LAYER_BUS && m_width == 0 )
if( m_Layer == LAYER_BUS )
{
pensize = KiROUND( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND );
pensize = MAX( pensize, 3 );
pensize = ( m_width == 0 ) ? g_DefaultBusWidth : m_width;
}
return pensize;
......
......@@ -35,7 +35,7 @@
#include <richio.h>
#include <plot_common.h>
#include <base_units.h>
#include <eeschema_config.h>
#include <general.h>
#include <protos.h>
#include <sch_line.h>
......@@ -212,10 +212,13 @@ int SCH_LINE::GetPenSize() const
{
int pensize = ( m_width == 0 ) ? g_DrawDefaultLineThickness : m_width;
if( m_Layer == LAYER_BUS && m_width == 0 )
if( m_Layer == LAYER_BUS )
{
pensize = KiROUND( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND );
pensize = MAX( pensize, 3 );
#if defined(KICAD_GOST)
pensize = GOST_BUS_WIDTH;
#else
pensize = ( m_width == 0 ) ? g_DefaultBusWidth : m_width;
#endif
}
return pensize;
......
......@@ -50,16 +50,6 @@ typedef SCH_ITEMS::iterator SCH_ITEMS_ITR;
typedef vector< SCH_ITEMS_ITR > SCH_ITEMS_ITRS;
/* used to calculate the pen size from default value
* the actual pen size is default value * BUS_WIDTH_EXPAND
*/
#if defined(KICAD_GOST)
#define BUS_WIDTH_EXPAND 3.6
#else
#define BUS_WIDTH_EXPAND 1.4
#endif
#define FMT_IU SCH_ITEM::FormatInternalUnits
#define FMT_ANGLE SCH_ITEM::FormatAngle
......
......@@ -986,11 +986,8 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
int minUViaDia = ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl );
int minUViaDrill = ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl );
int minTrackWidth = ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl );
#if defined( USE_PCBNEW_NANOMETRES )
int maxval = 25400000;
#else
int maxval = 10000;
#endif
int maxval = 1000 * IU_PER_MILS; // a max value for tracks and vias sizes (1 inch)
for( int row = 0; row < m_grid->GetNumberRows(); row++ )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment