Commit 2ffa0897 authored by charras's avatar charras
Browse files

Some enhancements about zones

parent 0872c8a1
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) :
    utility  = 0;               // flags used in polygon calculations
    utility2 = 0;               // flags used in polygon calculations
    m_Poly   = new CPolyLine(); // Outlines
    m_ArcToSegmentsCount = 16;   // Use 16 segment to convert a circle to a polygon
}


@@ -136,8 +137,8 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
    if( ret < 2 )
        return false;

    ret = fprintf( aFile, "ZOptions %d\n", m_GridFillValue );
    if( ret < 1 )
    ret = fprintf( aFile, "ZOptions %d %d\n", m_GridFillValue, m_ArcToSegmentsCount );
    if( ret < 2 )
        return false;


@@ -269,12 +270,15 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum )
        if( strnicmp( Line, "ZOptions", 8 ) == 0 )    // Options info found
        {
            int gridsize = 50;
            int arcsegmentcount = 16;
            text = Line + 8;
            ret  = sscanf( text, "%d", &gridsize );
            if( ret < 1 )
            ret  = sscanf( text, "%d %d", &gridsize, &arcsegmentcount );
            if( ret < 1 )   // Must find 1 or 2 args.
                return false;
            else
                m_GridFillValue = gridsize;
            if ( arcsegmentcount >= 32 )
                m_ArcToSegmentsCount = 32;
        }
        if( strnicmp( Line, "ZClearance", 10 ) == 0 )    // Clearence and pad options info found
        {
+2 −1
Original line number Diff line number Diff line
@@ -31,7 +31,8 @@ public:
    CPolyLine*            m_Poly;               // outlines
    int                   m_CornerSelection;    // For corner moving, corner index to drag, or -1 if no selection
    int                   m_ZoneClearance;      // clearance value
    int                   m_GridFillValue;      // Grid used for filling
    int                   m_GridFillValue;      // Grid used for filling, 0 = use polygonal areas to fill
    int                   m_ArcToSegmentsCount; // number of segments to convert a cirlce to a polygon (uses 16 or 32)
    m_PadInZone           m_PadOption;          // see m_PadInZone
    int                   utility, utility2;    // flags used in polygon calculations
    std::vector <CPolyPt> m_FilledPolysList;  /* set of filled polygons used to draw a zone as a filled area.
+14 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
    wxString title = _( "Zone clearance value:" ) + ReturnUnitSymbol( g_UnitMetric );
    m_ClearanceValueTitle->SetLabel( title );

    title = _( "Grid :" ) + ReturnUnitSymbol( g_UnitMetric );;
    title = _( "Grid :" ) + ReturnUnitSymbol( g_UnitMetric );
    m_GridCtrl->SetLabel( title );

    if( g_DesignSettings.m_ZoneClearence == 0 )
@@ -119,6 +119,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
            break;
        }
        g_Zone_Hatching = m_Zone_Container->m_Poly->GetHatchStyle();
        g_Zone_Arc_Approximation = m_Zone_Container->m_ArcToSegmentsCount;

    }
    else
@@ -154,6 +155,8 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
        break;
    }
    
    m_ArcApproximationOpt->SetSelection( g_Zone_Arc_Approximation == 32 ? 1 : 0 );

    /* build copper layers list */
    int layer_cnt = board->GetCopperLayerCount();
    for( int ii = 0; ii < board->GetCopperLayerCount(); ii++ )
@@ -283,6 +286,8 @@ bool dialog_copper_zone::AcceptOptions(bool aPromptForErrors)
        break;
    }
    
    g_Zone_Arc_Approximation = m_ArcApproximationOpt->GetSelection() == 1 ? 32 : 16;

    if( m_Parent->m_Parent->m_EDA_Config )
    {
        m_Parent->m_Parent->m_EDA_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, (long)g_Zone_Hatching);
@@ -394,5 +399,13 @@ void dialog_copper_zone::OnButtonOkClick( wxCommandEvent& event )
        EndModal( ZONE_OK );
}

/****************************************************************************/
void dialog_copper_zone::OnRemoveFillZoneButtonClick( wxCommandEvent& event )
/****************************************************************************/
{
    m_Parent->Delete_Zone_Fill( NULL, NULL, m_Zone_Container->m_TimeStamp );
    m_Zone_Container->m_FilledPolysList.clear();
    m_Parent->DrawPanel->Refresh();
}

+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ public:
	void OnButtonOkClick( wxCommandEvent& event );
	void OnButtonCancelClick( wxCommandEvent& event );
    bool AcceptOptions(bool aPromptForErrors);
	void OnRemoveFillZoneButtonClick( wxCommandEvent& event );
    void OnNetSortingOptionSelected( wxCommandEvent& event );
};

+27 −10
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ BEGIN_EVENT_TABLE( dialog_copper_zone_frame, wxDialog )
	EVT_INIT_DIALOG( dialog_copper_zone_frame::_wxFB_OnInitDialog )
	EVT_BUTTON( wxID_OK, dialog_copper_zone_frame::_wxFB_OnButtonOkClick )
	EVT_BUTTON( wxID_CANCEL, dialog_copper_zone_frame::_wxFB_OnButtonCancelClick )
	EVT_BUTTON( wxID_ANY, dialog_copper_zone_frame::_wxFB_OnRemoveFillZoneButtonClick )
	EVT_RADIOBOX( ID_NET_SORTING_OPTION, dialog_copper_zone_frame::_wxFB_OnNetSortingOptionSelected )
END_EVENT_TABLE()

@@ -35,7 +36,7 @@ dialog_copper_zone_frame::dialog_copper_zone_frame( wxWindow* parent, wxWindowID
	wxString m_GridCtrlChoices[] = { _("0.00000"), _("0.00000"), _("0.00000"), _("0.00000"), _("No Grid (For tests only!)") };
	int m_GridCtrlNChoices = sizeof( m_GridCtrlChoices ) / sizeof( wxString );
	m_GridCtrl = new wxRadioBox( this,  ID_RADIOBOX_GRID_SELECTION, _("Grid Size for Filling:"), wxDefaultPosition, wxDefaultSize, m_GridCtrlNChoices, m_GridCtrlChoices, 1, wxRA_SPECIFY_COLS );
	m_GridCtrl->SetSelection( 4 );
	m_GridCtrl->SetSelection( 1 );
	m_FillOptionsBox->Add( m_GridCtrl, 0, wxALL, 5 );
	
	m_ClearanceValueTitle = new wxStaticText( this, wxID_ANY, _("Zone clearance value (mm):"), wxDefaultPosition, wxDefaultSize, 0 );
@@ -64,20 +65,30 @@ dialog_copper_zone_frame::dialog_copper_zone_frame( wxWindow* parent, wxWindowID
	wxStaticBoxSizer* m_OutilinesBoxOpt;
	m_OutilinesBoxOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Outlines Options:") ), wxVERTICAL );
	
	wxString m_OrientEdgesOptChoices[] = { _("Any"), _("H , V and 45 deg") };
	int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString );
	m_OrientEdgesOpt = new wxRadioBox( this, wxID_ANY, _("Zone edges orient:"), wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 1, wxRA_SPECIFY_COLS );
	m_OrientEdgesOpt->SetSelection( 0 );
	m_OutilinesBoxOpt->Add( m_OrientEdgesOpt, 0, wxALL|wxEXPAND, 5 );
	
	
	m_OutilinesBoxOpt->Add( 5, 5, 0, 0, 5 );
	
	wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched Outline"), _("Full Hatched") };
	int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString );
	m_OutlineAppearanceCtrl = new wxRadioBox( this, ID_RADIOBOX_OUTLINES_OPTION, _("Outlines Appearance"), wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 1, wxRA_SPECIFY_COLS );
	m_OutlineAppearanceCtrl->SetSelection( 0 );
	m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxEXPAND, 5 );
	m_OutlineAppearanceCtrl->SetSelection( 1 );
	m_OutlineAppearanceCtrl->SetToolTip( _("How a zone outline is shoved:\nSingle line\nShort hatching\nFull area hatched") );
	
	m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxEXPAND, 5 );
	
	m_OutilinesBoxOpt->Add( 5, 5, 0, 0, 5 );
	wxString m_ArcApproximationOptChoices[] = { _("16 segments / 360 deg"), _("32 segments / 360 deg") };
	int m_ArcApproximationOptNChoices = sizeof( m_ArcApproximationOptChoices ) / sizeof( wxString );
	m_ArcApproximationOpt = new wxRadioBox( this, wxID_ARC_APPROX, _("Arcs Approximation:"), wxDefaultPosition, wxDefaultSize, m_ArcApproximationOptNChoices, m_ArcApproximationOptChoices, 1, wxRA_SPECIFY_COLS );
	m_ArcApproximationOpt->SetSelection( 1 );
	m_ArcApproximationOpt->SetToolTip( _("Number of segments to approximate a circle in filling calculations.\n16 segment is faster to calculate and when redraw screen.\n32 segment give a better quality") );
	
	wxString m_OrientEdgesOptChoices[] = { _("Any"), _("H , V and 45 deg") };
	int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString );
	m_OrientEdgesOpt = new wxRadioBox( this, wxID_ANY, _("Zone edges orient:"), wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 1, wxRA_SPECIFY_COLS );
	m_OrientEdgesOpt->SetSelection( 0 );
	m_OutilinesBoxOpt->Add( m_OrientEdgesOpt, 0, wxALL, 5 );
	m_OutilinesBoxOpt->Add( m_ArcApproximationOpt, 0, wxALL|wxEXPAND, 5 );
	
	m_MiddleBoxSizer->Add( m_OutilinesBoxOpt, 1, wxEXPAND, 5 );
	
@@ -90,11 +101,15 @@ dialog_copper_zone_frame::dialog_copper_zone_frame( wxWindow* parent, wxWindowID
	m_RightBoxSizer = new wxBoxSizer( wxVERTICAL );
	
	m_OkButton = new wxButton( this, wxID_OK, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 );
	m_OkButton->SetDefault(); 
	m_RightBoxSizer->Add( m_OkButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
	
	m_ButtonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
	m_RightBoxSizer->Add( m_ButtonCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
	
	m_UnFillZoneButton = new wxButton( this, wxID_ANY, _("UnFill Zone"), wxDefaultPosition, wxDefaultSize, 0 );
	m_RightBoxSizer->Add( m_UnFillZoneButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
	
	
	m_RightBoxSizer->Add( 5, 20, 0, wxEXPAND, 5 );
	
@@ -104,7 +119,9 @@ dialog_copper_zone_frame::dialog_copper_zone_frame( wxWindow* parent, wxWindowID
	wxString m_NetSortingOptionChoices[] = { _("Alphabetic"), _("Advanced") };
	int m_NetSortingOptionNChoices = sizeof( m_NetSortingOptionChoices ) / sizeof( wxString );
	m_NetSortingOption = new wxRadioBox( this, ID_NET_SORTING_OPTION, _("Net sorting:"), wxDefaultPosition, wxDefaultSize, m_NetSortingOptionNChoices, m_NetSortingOptionChoices, 1, wxRA_SPECIFY_COLS );
	m_NetSortingOption->SetSelection( 0 );
	m_NetSortingOption->SetSelection( 1 );
	m_NetSortingOption->SetToolTip( _("Nets can be sorted:\nBy alphabetic order\nBy number of pads in the net (advanced)") );
	
	m_NetSortOptSizer->Add( m_NetSortingOption, 0, wxALL|wxEXPAND, 5 );
	
	m_staticText5 = new wxStaticText( this, wxID_ANY, _("Filter"), wxDefaultPosition, wxDefaultSize, 0 );
Loading