Commit f2bd20ab authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

Mostly EAGLE_PLUGIN work:

* Derive the pcbnew copper zone and non-copper zone dialog windows from DIAG_SHIM,
  which injects some template code.
* Update UIpolicies.txt to talk about DIALOG_SHIM support.
* Add zone support to eagle_plugin.
* Organize ZONE_CONTAINER class declaration for future privacy and accessors.
parent 52318f69
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -42,6 +42,14 @@ Dialogs:
    leaving them all bundled tightly together.  The dialog box should look
    nice at any size large enough to show all the components.

    When using wxFormBuilder, please add the following settings to the
    "Dialog" node:
        subclass.name   <- DIALOG_SHIM
        subclass.header <- dialog_shim.h

    This will provide for an override of the Show( bool ) wxWindow() function
    and provide retentitive size and position for the session.

    Use tooltips to explain the functionality of each non-obvious control.
    This is important because the help files and the wiki often lag behind
    the source code.
+1 −1
Original line number Diff line number Diff line
@@ -1468,7 +1468,7 @@ int BOARD::SetAreasNetCodesFromNetNames( void )

        if( GetArea( ii )->GetNet() != 0 )      // i.e. if this zone is connected to a net
        {
            const NETINFO_ITEM* net = FindNet( GetArea( ii )->m_Netname );
            const NETINFO_ITEM* net = FindNet( GetArea( ii )->GetNetName() );

            if( net )
            {
+7 −1
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :

    // For corner moving, corner index to drag, or -1 if no selection
    m_CornerSelection = -1;
    m_IsFilled = aZone.m_IsFilled;
    m_ZoneClearance = aZone.m_ZoneClearance;     // clearance value
    m_ZoneMinThickness = aZone.m_ZoneMinThickness;
    m_FillMode = aZone.m_FillMode;               // Filling mode (segments/polygons)
@@ -84,6 +85,11 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
    m_ThermalReliefCopperBridge = aZone.m_ThermalReliefCopperBridge;
    m_FilledPolysList = aZone.m_FilledPolysList;
    m_FillSegmList = aZone.m_FillSegmList;

    cornerSmoothingType = aZone.cornerSmoothingType;
    cornerRadius = aZone.cornerRadius;
    utility    = aZone.utility;
    utility2   = aZone.utility;
}


@@ -717,7 +723,7 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame )
    frame->AppendMsgPanel( _( "Corners" ), msg, BLUE );

    if( m_FillMode )
        msg.Printf( _( "Segments" ), m_FillMode );
        msg = _( "Segments" );
    else
        msg = _( "Polygons" );

+58 −56
Original line number Diff line number Diff line
@@ -77,58 +77,7 @@ struct SEGMENT
class ZONE_CONTAINER : public BOARD_CONNECTED_ITEM
{
public:
    wxString              m_Netname;                        // Net Name
    CPolyLine*            m_Poly;                           // outlines

    // For corner moving, corner index to drag, or -1 if no selection.
    int                   m_CornerSelection;
    int                   m_ZoneClearance;                  // clearance value
    int                   m_ZoneMinThickness;               // Min thickness value in filled areas

    // How to fill areas: 0 = use filled polygons, != 0 fill with segments.
    int                   m_FillMode;

    // number of segments to convert a circle to a polygon (uses
    //ARC_APPROX_SEGMENTS_COUNT_LOW_DEF or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF)
    int                   m_ArcToSegmentsCount;

    // thickness of the gap in thermal reliefs.
    int                   m_ThermalReliefGap;

    // thickness of the copper bridge in thermal reliefs
    int                   m_ThermalReliefCopperBridge;
    int                   utility, utility2;                // flags used in polygon calculations

    // true when a zone was filled, false after deleting the filled areas
    bool                  m_IsFilled;

    /* set of filled polygons used to draw a zone as a filled area.
     * from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole
     * (they are* all in one piece)  In very simple cases m_FilledPolysList is same
     * as m_Poly.  In less simple cases (when m_Poly has holes) m_FilledPolysList is
     * a polygon equivalent to m_Poly, without holes but with extra outline segment
     * connecting "holes" with external main outline.  In complex cases an outline
     * described by m_Poly can have many filled areas
     */
    std::vector <CPolyPt> m_FilledPolysList;

    /* set of segments used to fill area, when fill zone by segment is used.
     *  ( m_FillMode == 1 )
     *  in this case segments have m_ZoneMinThickness width
     */
    std::vector <SEGMENT> m_FillSegmList;

private:
    CPolyLine*            smoothedPoly;         // Corner-smoothed version of m_Poly
    int                   cornerSmoothingType;
    unsigned int          cornerRadius;
    // Priority: when a zone outline is inside and other zone, if its priority is higher
    // the other zone priority, it will be created inside.
    // if priorities are equal, a DRC error is set
    unsigned              m_priority;
    ZoneConnection        m_PadConnection;

public:
    ZONE_CONTAINER( BOARD* parent );

    ZONE_CONTAINER( const ZONE_CONTAINER& aZone );
@@ -547,6 +496,59 @@ public:
#if defined(DEBUG)
    void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif


    CPolyLine*            m_Poly;                           // outlines

    // For corner moving, corner index to drag, or -1 if no selection.
    int                   m_CornerSelection;
    int                   m_ZoneClearance;                  // clearance value
    int                   m_ZoneMinThickness;               // Min thickness value in filled areas

    // How to fill areas: 0 = use filled polygons, != 0 fill with segments.
    int                   m_FillMode;

    // number of segments to convert a circle to a polygon (uses
    //ARC_APPROX_SEGMENTS_COUNT_LOW_DEF or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF)
    int                   m_ArcToSegmentsCount;

    // thickness of the gap in thermal reliefs.
    int                   m_ThermalReliefGap;

    // thickness of the copper bridge in thermal reliefs
    int                   m_ThermalReliefCopperBridge;
    int                   utility, utility2;                // flags used in polygon calculations

    // true when a zone was filled, false after deleting the filled areas
    bool                  m_IsFilled;

    /* set of filled polygons used to draw a zone as a filled area.
     * from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole
     * (they are* all in one piece)  In very simple cases m_FilledPolysList is same
     * as m_Poly.  In less simple cases (when m_Poly has holes) m_FilledPolysList is
     * a polygon equivalent to m_Poly, without holes but with extra outline segment
     * connecting "holes" with external main outline.  In complex cases an outline
     * described by m_Poly can have many filled areas
     */
    std::vector <CPolyPt> m_FilledPolysList;

    /* set of segments used to fill area, when fill zone by segment is used.
     *  ( m_FillMode == 1 )
     *  in this case segments have m_ZoneMinThickness width
     */
    std::vector <SEGMENT> m_FillSegmList;


private:
    wxString              m_Netname;                        // Net Name
    CPolyLine*            smoothedPoly;         // Corner-smoothed version of m_Poly
    int                   cornerSmoothingType;
    unsigned int          cornerRadius;
    // Priority: when a zone outline is inside and other zone, if its priority is higher
    // the other zone priority, it will be created inside.
    // if priorities are equal, a DRC error is set
    unsigned              m_priority;
    ZoneConnection        m_PadConnection;
};


+2 −21
Original line number Diff line number Diff line
@@ -56,9 +56,6 @@ private:

    wxListView*     m_LayerSelectionCtrl;

    static wxPoint  prevPosition;           ///< Dialog position & size
    static wxSize   prevSize;

    /**
     * Function initDialog
     * fills in the dialog controls using the current settings.
@@ -108,8 +105,6 @@ private:

// Initialize static member variables
wxString DIALOG_COPPER_ZONE::m_netNameShowFilter( wxT( "*" ) );
wxPoint DIALOG_COPPER_ZONE::prevPosition( -1, -1 );
wxSize DIALOG_COPPER_ZONE::prevSize;


ZONE_EDIT_T InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings )
@@ -157,10 +152,6 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*

    GetSizer()->SetSizeHints( this );

    if( prevPosition.x != -1 )
        SetSize( prevPosition.x, prevPosition.y,
                 prevSize.x, prevSize.y );
    else
    Center();
}

@@ -169,8 +160,6 @@ void DIALOG_COPPER_ZONE::initDialog()
{
    BOARD* board = m_Parent->GetBoard();

    SetFocus();     // Required under wxGTK if we want to demiss the dialog with the ESC key

    wxString msg;

    if( m_settings.m_Zone_45_Only )
@@ -297,8 +286,6 @@ void DIALOG_COPPER_ZONE::OnButtonCancelClick( wxCommandEvent& event )
void DIALOG_COPPER_ZONE::OnButtonOkClick( wxCommandEvent& event )
{
    m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
    prevPosition = GetPosition();
    prevSize = GetSize();

    if( AcceptOptions( true ) )
    {
@@ -311,9 +298,6 @@ void DIALOG_COPPER_ZONE::OnButtonOkClick( wxCommandEvent& event )
// called on system close button
void DIALOG_COPPER_ZONE::OnClose( wxCloseEvent& event )
{
    prevPosition = GetPosition();
    prevSize = GetSize();

    if( m_OnExitCode != ZONE_ABORT )
        *m_ptr = m_settings;

@@ -384,7 +368,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
    wxString txtvalue = m_ZoneClearanceCtrl->GetValue();
    m_settings.m_ZoneClearance = ReturnValueFromString( g_UserUnit, txtvalue );

    // Test if this is a reasonnable value for this parameter
    // Test if this is a reasonable value for this parameter
    // A too large value can hang Pcbnew
    #define CLEARANCE_MAX_VALUE 5000    // in 1/10000 inch
    if( m_settings.m_ZoneClearance > CLEARANCE_MAX_VALUE )
@@ -519,9 +503,6 @@ void DIALOG_COPPER_ZONE::OnNetSortingOptionSelected( wxCommandEvent& event )

void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event )
{
    prevPosition = GetPosition();
    prevSize = GetSize();

    if( !AcceptOptions( true, true ) )
        return;

Loading