Commit 197371de authored by jean-pierre charras's avatar jean-pierre charras
Browse files

dialog non copper zones: better look. dialog copper zones: fix a minor bug.

parent a525c890
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -133,6 +133,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
    EDA_PANEINFO    mesg;
    EDA_PANEINFO    mesg;
    mesg.MessageToolbarPane();
    mesg.MessageToolbarPane();


    // Create a wxAuiPaneInfo for the Layers Manager, not derived from the template.
    // the Layers Manager is floatable, but initially docked at far right
    EDA_PANEINFO    lyrs;
    EDA_PANEINFO    lyrs;
    lyrs.LayersToolbarPane();
    lyrs.LayersToolbarPane();
    lyrs.MinSize( m_LayersManager->GetBestSize() );
    lyrs.MinSize( m_LayersManager->GetBestSize() );
+1 −1
Original line number Original line Diff line number Diff line
@@ -102,6 +102,7 @@ set( PCBNEW_DIALOGS
    dialogs/dialog_pcb_text_properties_base.cpp
    dialogs/dialog_pcb_text_properties_base.cpp
    dialogs/dialog_pns_settings.cpp
    dialogs/dialog_pns_settings.cpp
    dialogs/dialog_pns_settings_base.cpp
    dialogs/dialog_pns_settings_base.cpp
    dialogs/dialog_non_copper_zones_properties.cpp
    dialogs/dialog_non_copper_zones_properties_base.cpp
    dialogs/dialog_non_copper_zones_properties_base.cpp
    dialogs/dialog_pad_properties.cpp
    dialogs/dialog_pad_properties.cpp
    dialogs/dialog_pad_properties_base.cpp
    dialogs/dialog_pad_properties_base.cpp
@@ -250,7 +251,6 @@ set( PCBNEW_CLASS_SRCS
    zones_by_polygon_fill_functions.cpp
    zones_by_polygon_fill_functions.cpp
    zone_filling_algorithm.cpp
    zone_filling_algorithm.cpp
    zones_functions_for_undo_redo.cpp
    zones_functions_for_undo_redo.cpp
    zones_non_copper_type_functions.cpp
    zones_polygons_insulated_copper_islands.cpp
    zones_polygons_insulated_copper_islands.cpp
    zones_polygons_test_connections.cpp
    zones_polygons_test_connections.cpp
    zones_test_and_combine_areas.cpp
    zones_test_and_combine_areas.cpp
+3 −2
Original line number Original line Diff line number Diff line
@@ -253,10 +253,11 @@ void DIALOG_COPPER_ZONE::initDialog()
    m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
    m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );


    int ctrlWidth = 0;  // Min width for m_LayerSelectionCtrl to show the layers names
    int ctrlWidth = 0;  // Min width for m_LayerSelectionCtrl to show the layers names
    int imgIdx = 0;


    LSET cu_set = LSET::AllCuMask( board->GetCopperLayerCount() );
    LSET cu_set = LSET::AllCuMask( board->GetCopperLayerCount() );


    for( LSEQ cu_stack = cu_set.UIOrder();  cu_stack;  ++cu_stack )
    for( LSEQ cu_stack = cu_set.UIOrder();  cu_stack;  ++cu_stack, imgIdx++ )
    {
    {
        LAYER_ID layer = *cu_stack;
        LAYER_ID layer = *cu_stack;


@@ -271,7 +272,7 @@ void DIALOG_COPPER_ZONE::initDialog()
        imageList->Add( makeLayerBitmap( layerColor ) );
        imageList->Add( makeLayerBitmap( layerColor ) );


        int itemIndex = m_LayerSelectionCtrl->InsertItem(
        int itemIndex = m_LayerSelectionCtrl->InsertItem(
                m_LayerSelectionCtrl->GetItemCount(), msg, layer );
                m_LayerSelectionCtrl->GetItemCount(), msg, imgIdx );


        if( m_settings.m_CurrentZone_Layer == layer )
        if( m_settings.m_CurrentZone_Layer == layer )
            m_LayerSelectionCtrl->Select( itemIndex );
            m_LayerSelectionCtrl->Select( itemIndex );
+83 −21
Original line number Original line Diff line number Diff line
/**
/**
 * @file zones_non_copper_type_functions.cpp
 * @file zones_non_copper_type_functions.cpp
 */
 */
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
 * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */


#include <fctsys.h>
#include <fctsys.h>
//#include <pgm_base.h>
#include <kiface_i.h>
#include <kiface_i.h>
#include <confirm.h>
#include <confirm.h>
#include <wxPcbStruct.h>
#include <wxPcbStruct.h>
@@ -17,17 +40,19 @@


#include <dialog_non_copper_zones_properties_base.h>
#include <dialog_non_copper_zones_properties_base.h>


#define LAYER_BITMAP_SIZE_X     20
#define LAYER_BITMAP_SIZE_Y     10


/**
/**
 * Class DIALOG_NON_COPPER_ZONES_EDITOR
 * Class DIALOG_NON_COPPER_ZONES_EDITOR
 * is a dialog editor for non copper zones properties,
 * is a dialog editor for non copper zones properties,
 * derived from DialogNonCopperZonesPropertiesBase, which is maintained and
 * derived from DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE, which is maintained and
 * created by wxFormBuilder
 * created by wxFormBuilder
 */
 */
class DIALOG_NON_COPPER_ZONES_EDITOR : public DialogNonCopperZonesPropertiesBase
class DIALOG_NON_COPPER_ZONES_EDITOR : public DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE
{
{
private:
private:
    PCB_BASE_FRAME* m_Parent;
    PCB_BASE_FRAME* m_parent;
    ZONE_CONTAINER* m_zone;
    ZONE_CONTAINER* m_zone;
    ZONE_SETTINGS*  m_ptr;
    ZONE_SETTINGS*  m_ptr;
    ZONE_SETTINGS   m_settings;     // working copy of zone settings
    ZONE_SETTINGS   m_settings;     // working copy of zone settings
@@ -39,6 +64,14 @@ private:
public:
public:
    DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent,
    DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent,
                                    ZONE_CONTAINER* aZone, ZONE_SETTINGS* aSettings );
                                    ZONE_CONTAINER* aZone, ZONE_SETTINGS* aSettings );

private:
    /**
     * Function makeLayerBitmap
     * creates the colored rectangle bitmaps used in the layer selection widget.
     * @param aColor is the color to fill the rectangle with.
     */
    wxBitmap makeLayerBitmap( EDA_COLOR_T aColor );
};
};




@@ -49,8 +82,6 @@ ZONE_EDIT_T InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent,


    ZONE_EDIT_T result = ZONE_EDIT_T( dlg.ShowModal() );
    ZONE_EDIT_T result = ZONE_EDIT_T( dlg.ShowModal() );


    // D(printf( "%s: result:%d\n", __FUNCTION__, result );)

    return result;
    return result;
}
}


@@ -58,9 +89,9 @@ ZONE_EDIT_T InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent,
DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent,
DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent,
                                                                ZONE_CONTAINER* aZone,
                                                                ZONE_CONTAINER* aZone,
                                                                ZONE_SETTINGS* aSettings ) :
                                                                ZONE_SETTINGS* aSettings ) :
    DialogNonCopperZonesPropertiesBase( aParent )
    DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( aParent )
{
{
    m_Parent = aParent;
    m_parent = aParent;


    m_zone = aZone;
    m_zone = aZone;
    m_ptr  = aSettings;
    m_ptr  = aSettings;
@@ -75,6 +106,8 @@ DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME*


void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
{
{
    BOARD* board = m_parent->GetBoard();

    SetReturnCode( ZONE_ABORT );  // Will be changed on button click
    SetReturnCode( ZONE_ABORT );  // Will be changed on button click


    AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
    AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
@@ -99,28 +132,36 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
        break;
        break;
    }
    }


    // Create one column in m_LayerSelectionCtrl
    wxListItem column0;
    column0.SetId( 0 );
    m_LayerSelectionCtrl->InsertColumn( 0, column0 );

    // Create an icon list:
    wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
    m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );

    int ii = 0;
    int ii = 0;
    int lyrSelect = ( (PCB_SCREEN*) m_parent->GetScreen() )->m_Active_Layer;

    if( m_zone )
        lyrSelect = m_zone->GetLayer();


    for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++ii )
    for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++ii )
    {
    {
        LAYER_ID layer = *seq;
        LAYER_ID layer = *seq;


        wxString msg = m_Parent->GetBoard()->GetLayerName( layer );
        EDA_COLOR_T layerColor = board->GetLayerColor( layer );
        imageList->Add( makeLayerBitmap( layerColor ) );


        wxString msg = board->GetLayerName( layer );
        msg.Trim();
        msg.Trim();


        m_LayerSelectionCtrl->InsertItems( 1, &msg, ii );
        int itemIndex = m_LayerSelectionCtrl->InsertItem(
                m_LayerSelectionCtrl->GetItemCount(), msg, ii );


        if( m_zone )
        if(lyrSelect == layer )
        {
            m_LayerSelectionCtrl->Select( itemIndex );
            if( m_zone->GetLayer() == layer )
                m_LayerSelectionCtrl->SetSelection( ii );
        }
        else
        {
            if( ( (PCB_SCREEN*) m_Parent->GetScreen() )->m_Active_Layer == layer )
                m_LayerSelectionCtrl->SetSelection( ii );
        }
    }
    }
}
}


@@ -166,7 +207,7 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick( wxCommandEvent& event )
        m_settings.m_Zone_45_Only = true;
        m_settings.m_Zone_45_Only = true;


    // Get the layer selection for this zone
    // Get the layer selection for this zone
    int ii = m_LayerSelectionCtrl->GetSelection();
    int ii = m_LayerSelectionCtrl->GetFirstSelected();


    if( ii < 0 )
    if( ii < 0 )
    {
    {
@@ -191,3 +232,24 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::OnCancelClick( wxCommandEvent& event )
    EndModal( ZONE_ABORT );
    EndModal( ZONE_ABORT );
}
}



wxBitmap DIALOG_NON_COPPER_ZONES_EDITOR::makeLayerBitmap( EDA_COLOR_T aColor )
{
    wxBitmap    bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
    wxBrush     brush;
    wxMemoryDC  iconDC;

    iconDC.SelectObject( bitmap );
    brush.SetColour( MakeColour( aColor ) );

#if wxCHECK_VERSION( 3, 0, 0 )
    brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
    brush.SetStyle( wxSOLID );
#endif

    iconDC.SetBrush( brush );
    iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );

    return bitmap;
}
+9 −8
Original line number Original line Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Nov  6 2013)
// http://www.wxformbuilder.org/
// http://www.wxformbuilder.org/
//
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -9,12 +9,12 @@


///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////


BEGIN_EVENT_TABLE( DialogNonCopperZonesPropertiesBase, DIALOG_SHIM )
BEGIN_EVENT_TABLE( DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE, DIALOG_SHIM )
	EVT_BUTTON( wxID_CANCEL, DialogNonCopperZonesPropertiesBase::_wxFB_OnCancelClick )
	EVT_BUTTON( wxID_CANCEL, DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::_wxFB_OnCancelClick )
	EVT_BUTTON( wxID_OK, DialogNonCopperZonesPropertiesBase::_wxFB_OnOkClick )
	EVT_BUTTON( wxID_OK, DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::_wxFB_OnOkClick )
END_EVENT_TABLE()
END_EVENT_TABLE()


DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	
@@ -31,8 +31,8 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
	m_staticTextLayerSelection->Wrap( -1 );
	m_staticTextLayerSelection->Wrap( -1 );
	bSizerLeft->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
	bSizerLeft->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
	
	
	m_LayerSelectionCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); 
	m_LayerSelectionCtrl = new wxListView( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ALIGN_LEFT|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL );
	bSizerLeft->Add( m_LayerSelectionCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	bSizerLeft->Add( m_LayerSelectionCtrl, 1, wxALL|wxEXPAND, 5 );
	
	
	
	
	m_UpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 );
	m_UpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 );
@@ -63,6 +63,7 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
	bSizerRight->Add( m_MinThicknessValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
	bSizerRight->Add( m_MinThicknessValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
	
	
	m_ZoneMinThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_ZoneMinThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_ZoneMinThicknessCtrl->SetMaxLength( 0 ); 
	bSizerRight->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	bSizerRight->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	
	
	
	
@@ -90,6 +91,6 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
	this->Centre( wxBOTH );
	this->Centre( wxBOTH );
}
}


DialogNonCopperZonesPropertiesBase::~DialogNonCopperZonesPropertiesBase()
DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::~DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE()
{
{
}
}
Loading