diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index d4163f7dfe..ad5ddaa8d0 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -133,6 +133,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ): EDA_PANEINFO mesg; 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; lyrs.LayersToolbarPane(); lyrs.MinSize( m_LayersManager->GetBestSize() ); diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 8b66ab9a49..875b75076e 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -102,6 +102,7 @@ set( PCBNEW_DIALOGS dialogs/dialog_pcb_text_properties_base.cpp dialogs/dialog_pns_settings.cpp dialogs/dialog_pns_settings_base.cpp + dialogs/dialog_non_copper_zones_properties.cpp dialogs/dialog_non_copper_zones_properties_base.cpp dialogs/dialog_pad_properties.cpp dialogs/dialog_pad_properties_base.cpp @@ -250,7 +251,6 @@ set( PCBNEW_CLASS_SRCS zones_by_polygon_fill_functions.cpp zone_filling_algorithm.cpp zones_functions_for_undo_redo.cpp - zones_non_copper_type_functions.cpp zones_polygons_insulated_copper_islands.cpp zones_polygons_test_connections.cpp zones_test_and_combine_areas.cpp diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index f92b132202..407ff8f3dd 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -253,10 +253,11 @@ void DIALOG_COPPER_ZONE::initDialog() m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL ); int ctrlWidth = 0; // Min width for m_LayerSelectionCtrl to show the layers names + int imgIdx = 0; 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; @@ -271,7 +272,7 @@ void DIALOG_COPPER_ZONE::initDialog() imageList->Add( makeLayerBitmap( layerColor ) ); int itemIndex = m_LayerSelectionCtrl->InsertItem( - m_LayerSelectionCtrl->GetItemCount(), msg, layer ); + m_LayerSelectionCtrl->GetItemCount(), msg, imgIdx ); if( m_settings.m_CurrentZone_Layer == layer ) m_LayerSelectionCtrl->Select( itemIndex ); diff --git a/pcbnew/zones_non_copper_type_functions.cpp b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp similarity index 54% rename from pcbnew/zones_non_copper_type_functions.cpp rename to pcbnew/dialogs/dialog_non_copper_zones_properties.cpp index a6b5e17f9c..a0e65d477e 100644 --- a/pcbnew/zones_non_copper_type_functions.cpp +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp @@ -1,9 +1,32 @@ /** * @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 + * 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 -//#include #include #include #include @@ -17,17 +40,19 @@ #include +#define LAYER_BITMAP_SIZE_X 20 +#define LAYER_BITMAP_SIZE_Y 10 /** * Class DIALOG_NON_COPPER_ZONES_EDITOR * 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 */ -class DIALOG_NON_COPPER_ZONES_EDITOR : public DialogNonCopperZonesPropertiesBase +class DIALOG_NON_COPPER_ZONES_EDITOR : public DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE { private: - PCB_BASE_FRAME* m_Parent; + PCB_BASE_FRAME* m_parent; ZONE_CONTAINER* m_zone; ZONE_SETTINGS* m_ptr; ZONE_SETTINGS m_settings; // working copy of zone settings @@ -39,6 +64,14 @@ private: public: DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent, 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() ); - // D(printf( "%s: result:%d\n", __FUNCTION__, 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, ZONE_CONTAINER* aZone, ZONE_SETTINGS* aSettings ) : - DialogNonCopperZonesPropertiesBase( aParent ) + DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( aParent ) { - m_Parent = aParent; + m_parent = aParent; m_zone = aZone; 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() { + BOARD* board = m_parent->GetBoard(); + SetReturnCode( ZONE_ABORT ); // Will be changed on button click AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit ); @@ -99,28 +132,36 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init() break; } - int ii = 0; + // Create one column in m_LayerSelectionCtrl + wxListItem column0; + column0.SetId( 0 ); + m_LayerSelectionCtrl->InsertColumn( 0, column0 ); - for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++ii ) + // 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 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 ) { 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(); - m_LayerSelectionCtrl->InsertItems( 1, &msg, ii ); + int itemIndex = m_LayerSelectionCtrl->InsertItem( + m_LayerSelectionCtrl->GetItemCount(), msg, ii ); - if( m_zone ) - { - if( m_zone->GetLayer() == layer ) - m_LayerSelectionCtrl->SetSelection( ii ); - } - else - { - if( ( (PCB_SCREEN*) m_Parent->GetScreen() )->m_Active_Layer == layer ) - m_LayerSelectionCtrl->SetSelection( ii ); - } + if(lyrSelect == layer ) + m_LayerSelectionCtrl->Select( itemIndex ); } } @@ -166,7 +207,7 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick( wxCommandEvent& event ) m_settings.m_Zone_45_Only = true; // Get the layer selection for this zone - int ii = m_LayerSelectionCtrl->GetSelection(); + int ii = m_LayerSelectionCtrl->GetFirstSelected(); if( ii < 0 ) { @@ -191,3 +232,24 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::OnCancelClick( wxCommandEvent& event ) 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; +} diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.cpp b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.cpp index 624e68c038..4d5c254f31 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.cpp +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 10 2012) +// C++ code generated with wxFormBuilder (version Nov 6 2013) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -9,12 +9,12 @@ /////////////////////////////////////////////////////////////////////////// -BEGIN_EVENT_TABLE( DialogNonCopperZonesPropertiesBase, DIALOG_SHIM ) - EVT_BUTTON( wxID_CANCEL, DialogNonCopperZonesPropertiesBase::_wxFB_OnCancelClick ) - EVT_BUTTON( wxID_OK, DialogNonCopperZonesPropertiesBase::_wxFB_OnOkClick ) +BEGIN_EVENT_TABLE( DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE, DIALOG_SHIM ) + EVT_BUTTON( wxID_CANCEL, DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::_wxFB_OnCancelClick ) + EVT_BUTTON( wxID_OK, DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::_wxFB_OnOkClick ) 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 ); @@ -31,8 +31,8 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow m_staticTextLayerSelection->Wrap( -1 ); bSizerLeft->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_LayerSelectionCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bSizerLeft->Add( m_LayerSelectionCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + 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, wxALL|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 ); 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 ); @@ -90,6 +91,6 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow this->Centre( wxBOTH ); } -DialogNonCopperZonesPropertiesBase::~DialogNonCopperZonesPropertiesBase() +DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::~DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE() { } diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.fbp b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.fbp index 0eb038f7a3..c543505ccc 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.fbp +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.fbp @@ -20,8 +20,10 @@ . 1 + 1 1 1 + UI 1 0 @@ -40,7 +42,7 @@ wxID_ANY - DialogNonCopperZonesPropertiesBase + DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE 369,317 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER @@ -194,9 +196,9 @@ 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxALL|wxEXPAND 1 - + 1 1 1 @@ -210,7 +212,6 @@ 1 0 - 1 1 @@ -242,8 +243,8 @@ Resizable 1 - - + wxLC_ALIGN_LEFT|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL + wxListView; 0 @@ -263,8 +264,26 @@ - - + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.h b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.h index 37b07c5dfa..4890a2872d 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.h +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 10 2012) +// C++ code generated with wxFormBuilder (version Nov 6 2013) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,6 +11,9 @@ #include #include #include +class DIALOG_SHIM; +class wxListView; + #include "dialog_shim.h" #include #include @@ -18,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -30,9 +33,9 @@ /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -/// Class DialogNonCopperZonesPropertiesBase +/// Class DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE /////////////////////////////////////////////////////////////////////////////// -class DialogNonCopperZonesPropertiesBase : public DIALOG_SHIM +class DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE : public DIALOG_SHIM { DECLARE_EVENT_TABLE() private: @@ -44,7 +47,7 @@ class DialogNonCopperZonesPropertiesBase : public DIALOG_SHIM protected: wxStaticText* m_staticTextLayerSelection; - wxListBox* m_LayerSelectionCtrl; + wxListView* m_LayerSelectionCtrl; wxRadioBox* m_OrientEdgesOpt; wxRadioBox* m_OutlineAppearanceCtrl; wxStaticText* m_MinThicknessValueTitle; @@ -61,8 +64,8 @@ class DialogNonCopperZonesPropertiesBase : public DIALOG_SHIM public: - DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non Copper Zones Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 369,317 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); - ~DialogNonCopperZonesPropertiesBase(); + DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non Copper Zones Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 369,317 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); + ~DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE(); }; diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 08eb9e36a0..1924d8ee51 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -420,6 +420,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : lyrs.MinSize( m_Layers->GetBestSize() ); // updated in ReFillLayerWidget lyrs.BestSize( m_Layers->GetBestSize() ); lyrs.Caption( _( "Visibles" ) ); + lyrs.TopDockable( false ).BottomDockable( false ); if( m_mainToolBar ) // The main horizontal toolbar {