Commit 018292a8 authored by Wayne Stambaugh's avatar Wayne Stambaugh

PCBNew auxiliary tool bar changes and other minor improvements.

* Remove clearance and net class name read only text boxes from PCBNew
  auxiliary tool bar.
* Display full net class information in message panel when an object that
  supports net classes is selected.
* Move coordinate string conversion function to EDA_DRAW_FRAME object and
  made it more versatile.
* Refresh message panel text when units change.
parent 2f47b3f4
......@@ -138,6 +138,17 @@ EDA_DRAW_FRAME::~EDA_DRAW_FRAME()
}
void EDA_DRAW_FRAME::unitsChangeRefresh()
{
UpdateStatusBar();
EDA_ITEM* item = GetScreen()->GetCurItem();
if( item )
item->DisplayInfo( this );
}
void EDA_DRAW_FRAME::EraseMsgBox()
{
if( MsgPanel )
......@@ -793,3 +804,37 @@ void EDA_DRAW_FRAME::ClearMsgPanel( void )
MsgPanel->EraseMsgBox();
}
wxString EDA_DRAW_FRAME::CoordinateToString( int aValue, bool aConvertToMils )
{
wxString text;
const wxChar* format;
double value = To_User_Unit( g_UserUnit, aValue, m_InternalUnits );
if( g_UserUnit == INCHES )
{
if( aConvertToMils )
{
format = ( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) ? wxT( "%.0f" ) : wxT( "%.1f" );
value *= 1000;
}
else
{
format = ( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) ? wxT( "%.3f" ) : wxT( "%.4f" );
}
}
else
{
format = ( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) ? wxT( "%.2f" ) : wxT( "%.3f" );
}
text.Printf( format, value );
if( g_UserUnit == INCHES )
text += ( aConvertToMils ) ? _( " mils" ) : _( " in" );
else
text += _( " mm" );
return text;
}
......@@ -55,7 +55,6 @@ class PCB_EDIT_FRAME : public PCB_BASE_FRAME
void updateTraceWidthSelectBox();
void updateViaSizeSelectBox();
void updateDesignRulesSelectBoxes();
protected:
......@@ -120,12 +119,6 @@ public:
// select current track width
WinEDAChoiceBox* m_SelViaSizeBox; // a combo box to display and
// select current via diameter
wxTextCtrl* m_ClearanceBox; // a text ctrl to display the
// current tracks and vias
// clearance
wxTextCtrl* m_NetClassSelectedBox; // a text ctrl to display the
// current NetClass
bool m_TrackAndViasSizesList_Changed;
bool m_show_microwave_tools;
bool m_show_layer_manager_tools;
......@@ -1148,7 +1141,6 @@ public:
*/
virtual void SetLanguage( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
};
......
......@@ -258,7 +258,7 @@ protected:
* default version only updates the status bar. Don't forget to call the default
* in your derived class or the status bar will not get updated properly.
*/
virtual void unitsChangeRefresh() { UpdateStatusBar(); }
virtual void unitsChangeRefresh();
public:
EDA_DRAW_FRAME( wxWindow* father, int idtype,
......@@ -557,6 +557,17 @@ public:
*/
virtual void PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
/**
* Function CoordinateToString
* is a helper to convert the integer coordinate \a aValue to a string in inches or mm
* according to the current user units setting.
* @param aValue The coordinate to convert.
* @param aConvertToMils Convert inch values to mils if true. This setting has no effect if
* the current user unit is millimeters.
* @return The converted string for display in user interface elements.
*/
wxString CoordinateToString( int aValue, bool aConvertToMils = false );
DECLARE_EVENT_TABLE()
};
......
......@@ -951,9 +951,28 @@ void TRACK::DisplayInfo( EDA_DRAW_FRAME* frame )
{
int trackLen = 0;
Marque_Une_Piste( board, this, NULL, &trackLen, false );
valeur_param( trackLen, msg );
msg = frame->CoordinateToString( trackLen );
frame->AppendMsgPanel( _( "Track Length" ), msg, DARKCYAN );
}
NETCLASS* netclass = GetNetClass();
if( netclass )
{
frame->AppendMsgPanel( _( "NC Name" ), netclass->GetName(), DARKMAGENTA );
frame->AppendMsgPanel( _( "NC Clearance" ),
frame->CoordinateToString( netclass->GetClearance(), true ),
DARKMAGENTA );
frame->AppendMsgPanel( _( "NC Width" ),
frame->CoordinateToString( netclass->GetTrackWidth(), true ),
DARKMAGENTA );
frame->AppendMsgPanel( _( "NC Via Size"),
frame->CoordinateToString( netclass->GetViaDiameter(), true ),
DARKMAGENTA );
frame->AppendMsgPanel( _( "NC Via Drill"),
frame->CoordinateToString( netclass->GetViaDrill(), true ),
DARKMAGENTA );
}
}
......@@ -1041,7 +1060,7 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( _( "Layer" ), msg, BROWN );
/* Display width */
valeur_param( (unsigned) m_Width, msg );
msg = frame->CoordinateToString( (unsigned) m_Width );
if( Type() == TYPE_VIA ) // Display Diam and Drill values
{
......@@ -1051,7 +1070,7 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
// Display drill value
int drill_value = GetDrillValue();
valeur_param( (unsigned) drill_value, msg );
msg = frame->CoordinateToString( (unsigned) drill_value );
wxString title = _( "Drill" );
title += wxT( " " );
......@@ -1068,17 +1087,10 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( _( "Width" ), msg, DARKCYAN );
}
NETCLASS* netclass = GetNetClass();
if( netclass )
{
msg = netclass->GetName();
frame->AppendMsgPanel( _( "Net Class" ), msg, DARKCYAN );
}
// Display segment length
if( Type() != TYPE_VIA ) // Display Diam and Drill values
{
valeur_param( wxRound( GetLength() ), msg );
msg = frame->CoordinateToString( wxRound( GetLength() ) );
frame->AppendMsgPanel( _( "Segment Length" ), msg, DARKCYAN );
}
}
......
......@@ -667,8 +667,6 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard()
std::vector <VIA_DIMENSION>* vialist = &m_Parent->GetBoard()->m_ViasDimensionsList;
vialist->erase( vialist->begin() + 1, vialist->end() );
vialist->insert( vialist->end(), m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() );
m_Parent->m_TrackAndViasSizesList_Changed = true;
}
......@@ -709,7 +707,6 @@ void DIALOG_DESIGN_RULES::OnOkButtonClick( wxCommandEvent& event )
EndModal( wxID_OK );
m_Pcb->SetCurrentNetClass( NETCLASS::Default );
m_Parent->m_TrackAndViasSizesList_Changed = true;
}
......
......@@ -150,8 +150,6 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
// Display info about track Net class, and init track and vias sizes:
g_CurrentTrackSegment->SetNet( g_HighLight_NetCode );
GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true;
updateDesignRulesSelectBoxes();
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->m_Width = GetBoard()->GetCurrentTrackWidth();
......
......@@ -142,8 +142,6 @@ the changes?" ) ) )
return false;
}
m_TrackAndViasSizesList_Changed = true;
if( aAppend )
{
GetScreen()->SetFileName( wxEmptyString );
......@@ -273,14 +271,11 @@ this file again." ) );
// Update info shown by the horizontal toolbars
GetBoard()->SetCurrentNetClass( NETCLASS::Default );
m_TrackAndViasSizesList_Changed = true;
ReFillLayerWidget();
ReCreateLayerBox( NULL );
syncLayerWidget();
updateDesignRulesSelectBoxes();
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
......
......@@ -42,7 +42,6 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
// delete the old BOARD and create a new BOARD so that the default
// layer names are put into the BOARD.
SetBoard( new BOARD( NULL, this ) );
m_TrackAndViasSizesList_Changed = true;
SetCurItem( NULL );
/* clear filename, to avoid overwriting an old file */
......
......@@ -1116,7 +1116,6 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
board->SynchronizeNetsAndNetClasses();
m_TrackAndViasSizesList_Changed = true;
SetStatusText( wxEmptyString );
BestZoom();
return 1;
......@@ -1154,7 +1153,6 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
// Select default Netclass before writing file.
// Useful to save default values in headers
GetBoard()->SetCurrentNetClass( GetBoard()->m_NetClasses.GetDefault()->GetName() );
m_TrackAndViasSizesList_Changed = true;
WriteGeneralDescrPcb( aFile );
WriteSheetDescr( GetScreen(), aFile );
......
......@@ -124,8 +124,6 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case TYPE_PAD:
GetBoard()->SetCurrentNetClass(
((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true;
updateDesignRulesSelectBoxes();
break;
default:
......
......@@ -393,8 +393,6 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
wxString msg;
GetBoard()->SetCurrentNetClass( Track->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true;
updateDesignRulesSelectBoxes();
int flags = Track->m_Flags;
......@@ -714,8 +712,6 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
return;
GetBoard()->SetCurrentNetClass( Pad->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true;
updateDesignRulesSelectBoxes();
wxString msg = Pad->MenuText( GetBoard() );
......
......@@ -271,7 +271,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_SelTrackWidthBox = NULL;
m_SelViaSizeBox = NULL;
m_SelLayerBox = NULL;
m_TrackAndViasSizesList_Changed = false;
m_show_microwave_tools = false;
m_show_layer_manager_tools = true;
m_HotkeysZoomAndGridList = g_Board_Editor_Hokeys_Descr;
......@@ -291,8 +290,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_Layers = new PCB_LAYER_WIDGET( this, DrawPanel, pointSize );
m_TrackAndViasSizesList_Changed = true;
m_drc = new DRC( this ); // these 2 objects point to each other
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
......@@ -513,7 +510,6 @@ void PCB_EDIT_FRAME::ShowDesignRulesEditor( wxCommandEvent& event )
if( returncode == wxID_OK ) // New rules, or others changes.
{
ReCreateLayerBox( NULL );
updateDesignRulesSelectBoxes();
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
OnModify();
......@@ -653,7 +649,6 @@ void PCB_EDIT_FRAME::unitsChangeRefresh()
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
updateDesignRulesSelectBoxes();
}
......
......@@ -111,8 +111,6 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
SetLocaleTo_Default( ); // revert to the current locale
m_TrackAndViasSizesList_Changed = true;
OnModify();
GetBoard()->m_Status_Pcb = 0;
......
......@@ -25,9 +25,9 @@ void PCB_EDIT_FRAME::ToolOnRightClick( wxCommandEvent& event )
case ID_TRACK_BUTT:
{
DIALOG_DESIGN_RULES dlg( this );
if( dlg.ShowModal() == wxID_OK )
{
updateDesignRulesSelectBoxes();
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
}
......
......@@ -506,8 +506,6 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this, ID_AUX_TOOLBAR, true );
m_TrackAndViasSizesList_Changed = true;
/* Set up toolbar items */
// Creates box to display and choose tracks widths:
......@@ -526,24 +524,6 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
m_AuxiliaryToolBar->AddControl( m_SelViaSizeBox );
m_AuxiliaryToolBar->AddSeparator();
// Creates box to display tracks and vias clearance:
m_ClearanceBox = new wxTextCtrl( m_AuxiliaryToolBar, -1,
wxEmptyString, wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH + 10, -1 ),
wxTE_READONLY );
m_ClearanceBox->SetToolTip(_("Current NetClass clearance value") );
m_AuxiliaryToolBar->AddControl( m_ClearanceBox );
m_AuxiliaryToolBar->AddSeparator();
// Creates box to display the current NetClass:
m_NetClassSelectedBox = new wxTextCtrl( m_AuxiliaryToolBar, -1,
wxEmptyString, wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ),
wxTE_READONLY );
m_NetClassSelectedBox->SetToolTip(_("Name of the current NetClass") );
m_AuxiliaryToolBar->AddControl( m_NetClassSelectedBox );
m_AuxiliaryToolBar->AddSeparator();
// Creates box to display and choose strategy to handle tracks an vias sizes:
m_AuxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
wxEmptyString,
......@@ -572,44 +552,13 @@ an existing track use its width\notherwise, use current width setting" ),
updateGridSelectBox();
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
updateDesignRulesSelectBoxes();
// after adding the buttons to the toolbar, must call Realize()
m_AuxiliaryToolBar->Realize();
m_TrackAndViasSizesList_Changed = true;
m_AuxiliaryToolBar->AddSeparator();
}
/* helper to convert an integer value to a string, using mils or mm
* according to g_UserUnit value
*/
static wxString ReturnStringValue( int aValue )
{
wxString text;
const wxChar* format;
double value = To_User_Unit( g_UserUnit, aValue, PCB_INTERNAL_UNIT );
if( g_UserUnit == INCHES )
{
format = wxT( " %.1f" );
value *= 1000;
}
else
format = wxT( " %.3f" );
text.Printf( format, value );
if( g_UserUnit == INCHES )
text += _( " mils" );
else
text += _( " mm" );
return text;
}
void PCB_EDIT_FRAME::updateTraceWidthSelectBox()
{
if( m_SelTrackWidthBox == NULL )
......@@ -621,7 +570,7 @@ void PCB_EDIT_FRAME::updateTraceWidthSelectBox()
for( unsigned ii = 0; ii < GetBoard()->m_TrackWidthList.size(); ii++ )
{
msg = _( "Track" ) + ReturnStringValue( GetBoard()->m_TrackWidthList[ii] );
msg = _( "Track " ) + CoordinateToString( GetBoard()->m_TrackWidthList[ii], true );
if( ii == 0 )
msg << _( " *" );
......@@ -645,11 +594,12 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox()
for( unsigned ii = 0; ii < GetBoard()->m_ViasDimensionsList.size(); ii++ )
{
msg = _( "Via" );
msg << ReturnStringValue( GetBoard()->m_ViasDimensionsList[ii].m_Diameter );
msg = _( "Via " );
msg << CoordinateToString( GetBoard()->m_ViasDimensionsList[ii].m_Diameter, true );
if( GetBoard()->m_ViasDimensionsList[ii].m_Drill )
msg << wxT("/") << ReturnStringValue( GetBoard()->m_ViasDimensionsList[ii].m_Drill );
msg << wxT("/ ")
<< CoordinateToString( GetBoard()->m_ViasDimensionsList[ii].m_Drill, true );
if( ii == 0 )
msg << _( " *" );
......@@ -662,33 +612,6 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox()
}
/**
* Function updateDesignRulesSelectBoxes
* update the displayed values: track widths, via sizes, clearance, Netclass name
* used when a netclass is selected
*/
void PCB_EDIT_FRAME::updateDesignRulesSelectBoxes()
{
wxString nclname = GetBoard()->m_CurrentNetClassName;
wxString msg = _( "NetClass: " ) + nclname;
if( m_NetClassSelectedBox )
{
m_NetClassSelectedBox->Clear();
m_NetClassSelectedBox->AppendText( msg );
}
NETCLASS* netclass = GetBoard()->m_NetClasses.Find( nclname );
if( m_ClearanceBox )
{
wxString msg = _( "Clearance" ) + ReturnStringValue( netclass->GetClearance() );
m_ClearanceBox->Clear();
m_ClearanceBox->AppendText( msg );
}
}
WinEDALayerChoiceBox* PCB_EDIT_FRAME::ReCreateLayerBox( WinEDA_Toolbar* parent )
{
if( m_SelLayerBox == NULL )
......
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