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

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
Loading
Loading
Loading
Loading
+45 −0
Original line number Original line Diff line number Diff line
@@ -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()
void EDA_DRAW_FRAME::EraseMsgBox()
{
{
    if( MsgPanel )
    if( MsgPanel )
@@ -793,3 +804,37 @@ void EDA_DRAW_FRAME::ClearMsgPanel( void )


    MsgPanel->EraseMsgBox();
    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;
}
+0 −8
Original line number Original line Diff line number Diff line
@@ -55,7 +55,6 @@ class PCB_EDIT_FRAME : public PCB_BASE_FRAME


    void updateTraceWidthSelectBox();
    void updateTraceWidthSelectBox();
    void updateViaSizeSelectBox();
    void updateViaSizeSelectBox();
    void updateDesignRulesSelectBoxes();


protected:
protected:


@@ -120,12 +119,6 @@ public:
                                            // select current track width
                                            // select current track width
    WinEDAChoiceBox* m_SelViaSizeBox;       // a combo box to display and
    WinEDAChoiceBox* m_SelViaSizeBox;       // a combo box to display and
                                            // select current via diameter
                                            // 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_microwave_tools;
    bool             m_show_layer_manager_tools;
    bool             m_show_layer_manager_tools;
@@ -1148,7 +1141,6 @@ public:
     */
     */
    virtual void SetLanguage( wxCommandEvent& event );
    virtual void SetLanguage( wxCommandEvent& event );



    DECLARE_EVENT_TABLE()
    DECLARE_EVENT_TABLE()
};
};


+12 −1
Original line number Original line Diff line number Diff line
@@ -258,7 +258,7 @@ protected:
     * default version only updates the status bar.  Don't forget to call the default
     * 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.
     * in your derived class or the status bar will not get updated properly.
     */
     */
    virtual void unitsChangeRefresh() { UpdateStatusBar(); }
    virtual void unitsChangeRefresh();


public:
public:
    EDA_DRAW_FRAME( wxWindow* father, int idtype,
    EDA_DRAW_FRAME( wxWindow* father, int idtype,
@@ -557,6 +557,17 @@ public:
     */
     */
    virtual void PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
    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()
    DECLARE_EVENT_TABLE()
};
};


+23 −11
Original line number Original line Diff line number Diff line
@@ -951,9 +951,28 @@ void TRACK::DisplayInfo( EDA_DRAW_FRAME* frame )
    {
    {
        int trackLen = 0;
        int trackLen = 0;
        Marque_Une_Piste( board, this, NULL, &trackLen, false );
        Marque_Une_Piste( board, this, NULL, &trackLen, false );
        valeur_param( trackLen, msg );
        msg = frame->CoordinateToString( trackLen );
        frame->AppendMsgPanel( _( "Track Length" ), msg, DARKCYAN );
        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 );
    frame->AppendMsgPanel( _( "Layer" ), msg, BROWN );


    /* Display width */
    /* Display width */
    valeur_param( (unsigned) m_Width, msg );
    msg = frame->CoordinateToString( (unsigned) m_Width );


    if( Type() == TYPE_VIA )      // Display Diam and Drill values
    if( Type() == TYPE_VIA )      // Display Diam and Drill values
    {
    {
@@ -1051,7 +1070,7 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
        // Display drill value
        // Display drill value
        int drill_value = GetDrillValue();
        int drill_value = GetDrillValue();


        valeur_param( (unsigned) drill_value, msg );
        msg = frame->CoordinateToString( (unsigned) drill_value );


        wxString title = _( "Drill" );
        wxString title = _( "Drill" );
        title += wxT( " " );
        title += wxT( " " );
@@ -1068,17 +1087,10 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
        frame->AppendMsgPanel( _( "Width" ), msg, DARKCYAN );
        frame->AppendMsgPanel( _( "Width" ), msg, DARKCYAN );
    }
    }


    NETCLASS* netclass = GetNetClass();
    if( netclass )
    {
        msg = netclass->GetName();
        frame->AppendMsgPanel( _( "Net Class" ), msg, DARKCYAN );
    }

    // Display segment length
    // Display segment length
    if( Type() != TYPE_VIA )      // Display Diam and Drill values
    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 );
        frame->AppendMsgPanel( _( "Segment Length" ), msg, DARKCYAN );
    }
    }
}
}
+0 −3
Original line number Original line Diff line number Diff line
@@ -667,8 +667,6 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard()
    std::vector <VIA_DIMENSION>* vialist = &m_Parent->GetBoard()->m_ViasDimensionsList;
    std::vector <VIA_DIMENSION>* vialist = &m_Parent->GetBoard()->m_ViasDimensionsList;
    vialist->erase( vialist->begin() + 1, vialist->end() );
    vialist->erase( vialist->begin() + 1, vialist->end() );
    vialist->insert( vialist->end(), m_ViasDimensionsList.begin(), m_ViasDimensionsList.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 );
    EndModal( wxID_OK );


    m_Pcb->SetCurrentNetClass( NETCLASS::Default );
    m_Pcb->SetCurrentNetClass( NETCLASS::Default );
    m_Parent->m_TrackAndViasSizesList_Changed = true;
}
}




Loading