diff --git a/common/widgets/color_swatch.cpp b/common/widgets/color_swatch.cpp index 359be0b37e..8f8c3aeaf7 100644 --- a/common/widgets/color_swatch.cpp +++ b/common/widgets/color_swatch.cpp @@ -42,10 +42,9 @@ extern COLOR4D DisplayColorFrame( wxWindow* aParent, COLOR4D aOldColor ); * * @param aWindow - window used as context for device-independent size */ -static wxBitmap makeBitmap( COLOR4D aColor, COLOR4D aBackground, wxWindow *aWindow ) +wxBitmap COLOR_SWATCH::MakeBitmap( COLOR4D aColor, COLOR4D aBackground, wxSize aSize ) { - wxSize size( aWindow->ConvertDialogToPixels( SWATCH_SIZE_DU ) ); - wxBitmap bitmap( size ); + wxBitmap bitmap( aSize ); wxBrush brush; wxMemoryDC iconDC; @@ -54,11 +53,11 @@ static wxBitmap makeBitmap( COLOR4D aColor, COLOR4D aBackground, wxWindow *aWind brush.SetStyle( wxBRUSHSTYLE_SOLID ); brush.SetColour( aBackground.WithAlpha(1.0).ToColour() ); iconDC.SetBrush( brush ); - iconDC.DrawRectangle( 0, 0, size.x, size.y ); + iconDC.DrawRectangle( 0, 0, aSize.x, aSize.y ); brush.SetColour( aColor.ToColour() ); iconDC.SetBrush( brush ); - iconDC.DrawRectangle( 0, 0, size.x, size.y ); + iconDC.DrawRectangle( 0, 0, aSize.x, aSize.y ); return bitmap; } @@ -68,10 +67,11 @@ static wxBitmap makeBitmap( COLOR4D aColor, COLOR4D aBackground, wxWindow *aWind * Function makeColorButton * creates a wxStaticBitmap and assigns it a solid color and a control ID */ -static std::unique_ptr makeColorSwatch( - wxWindow* aParent, COLOR4D aColor, COLOR4D aBackground, int aID ) +static std::unique_ptr makeColorSwatch( wxWindow* aParent, COLOR4D aColor, + COLOR4D aBackground, int aID ) { - wxBitmap bitmap = makeBitmap( aColor, aBackground, aParent ); + wxSize size = aParent->ConvertDialogToPixels( SWATCH_SIZE_DU ); + wxBitmap bitmap = COLOR_SWATCH::MakeBitmap( aColor, aBackground, size ); auto ret = std::make_unique( aParent, aID, bitmap ); return ret; @@ -130,7 +130,7 @@ void COLOR_SWATCH::SetSwatchColor( COLOR4D aColor, bool sendEvent ) { m_color = aColor; - wxBitmap bm = makeBitmap( m_color, m_background, GetParent() ); + wxBitmap bm = MakeBitmap( m_color, m_background, ConvertDialogToPixels( SWATCH_SIZE_DU ) ); m_swatch->SetBitmap( bm ); if( sendEvent ) @@ -143,7 +143,7 @@ void COLOR_SWATCH::SetSwatchColor( COLOR4D aColor, bool sendEvent ) void COLOR_SWATCH::SetSwatchBackground( COLOR4D aBackground ) { m_background = aBackground; - wxBitmap bm = makeBitmap( m_color, m_background, (wxWindow*) this ); + wxBitmap bm = MakeBitmap( m_color, m_background, ConvertDialogToPixels( SWATCH_SIZE_DU ) ); m_swatch->SetBitmap( bm ); } @@ -172,7 +172,7 @@ void COLOR_SWATCH::GetNewSwatchColor() { m_color = newColor; - wxBitmap bm = makeBitmap( newColor, m_background, (wxWindow*) this ); + wxBitmap bm = MakeBitmap( newColor, m_background, ConvertDialogToPixels( SWATCH_SIZE_DU ) ); m_swatch->SetBitmap( bm ); sendSwatchChangeEvent( *this ); diff --git a/eeschema/dialogs/dialog_fields_editor_global.cpp b/eeschema/dialogs/dialog_fields_editor_global.cpp index d26ad52f09..0ddbdf29ff 100644 --- a/eeschema/dialogs/dialog_fields_editor_global.cpp +++ b/eeschema/dialogs/dialog_fields_editor_global.cpp @@ -612,7 +612,7 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::OnSizeFieldList( wxSizeEvent& event ) { int nameColWidth = event.GetSize().GetX() - m_showColWidth - m_groupByColWidth - 8; - // Linux loses its head and messes these up when resizing the splitter bar: + // GTK loses its head and messes these up when resizing the splitter bar: m_fieldsCtrl->GetColumn( 1 )->SetWidth( m_showColWidth ); m_fieldsCtrl->GetColumn( 2 )->SetWidth( m_groupByColWidth ); diff --git a/include/widgets/color_swatch.h b/include/widgets/color_swatch.h index c61850a95a..f68d199721 100644 --- a/include/widgets/color_swatch.h +++ b/include/widgets/color_swatch.h @@ -73,6 +73,8 @@ public: */ void GetNewSwatchColor(); + static wxBitmap MakeBitmap( KIGFX::COLOR4D aColor, KIGFX::COLOR4D aBackground, wxSize aSize ); + private: /** diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index 8a8e0844f1..3247dcd849 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -47,7 +48,6 @@ #include #include - /** * Class DIALOG_COPPER_ZONE * is the derived class from dialog_copper_zone_frame created by wxFormBuilder @@ -112,19 +112,10 @@ private: * according to m_NetDisplayOption selection. */ void initListNetsParams(); - - /** - * Function makeLayerBitmap - * creates the colored rectangle bitmaps used in the layer selection widget. - * @param aColor is the color to fill the rectangle with. - * @param aBackground is the background color in case aColor is transparent. - */ - wxBitmap makeLayerBitmap( COLOR4D aColor, COLOR4D aBackground ); }; -#define LAYER_BITMAP_SIZE_X 20 -#define LAYER_BITMAP_SIZE_Y 10 +const static wxSize LAYER_BITMAP_SIZE( 20, 14 ); // Initialize static member variables wxString DIALOG_COPPER_ZONE::m_netNameShowFilter( wxT( "*" ) ); @@ -241,7 +232,7 @@ void DIALOG_COPPER_ZONE::initDialog() column0.SetId( 0 ); m_LayerSelectionCtrl->InsertColumn( 0, column0 ); - wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); + wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE.x, LAYER_BITMAP_SIZE.y ); m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL ); int ctrlWidth = 0; // Min width for m_LayerSelectionCtrl to show the layers names @@ -257,32 +248,28 @@ void DIALOG_COPPER_ZONE::initDialog() m_LayerId.push_back( layer ); msg = board->GetLayerName( layer ); - msg.Trim(); + wxSize tsize( GetTextSize( msg, m_LayerSelectionCtrl ) ); + ctrlWidth = std::max( ctrlWidth, tsize.x ); COLOR4D layerColor = m_Parent->Settings().Colors().GetLayerColor( layer ); + imageList->Add( COLOR_SWATCH::MakeBitmap( layerColor, backgroundColor, LAYER_BITMAP_SIZE ) ); - imageList->Add( makeLayerBitmap( layerColor, backgroundColor ) ); - - int itemIndex = m_LayerSelectionCtrl->InsertItem( - m_LayerSelectionCtrl->GetItemCount(), msg, imgIdx ); + int itemIndex = m_LayerSelectionCtrl->GetItemCount(); + m_LayerSelectionCtrl->InsertItem( itemIndex, msg, imgIdx ); if( m_settings.m_CurrentZone_Layer == layer ) m_LayerSelectionCtrl->Select( itemIndex ); - - wxSize tsize( GetTextSize( msg, m_LayerSelectionCtrl ) ); - ctrlWidth = std::max( ctrlWidth, tsize.x ); } // The most easy way to ensure the right size is to use wxLIST_AUTOSIZE // unfortunately this option does not work well both on // wxWidgets 2.8 ( column width too small), and // wxWidgets 2.9 ( column width too large) - ctrlWidth += LAYER_BITMAP_SIZE_X + 25; // Add bitmap width + margin between bitmap and text + ctrlWidth += LAYER_BITMAP_SIZE.x + 25; // Add bitmap width + margin before text m_LayerSelectionCtrl->SetColumnWidth( 0, ctrlWidth ); - ctrlWidth += 25; // add small margin between text and window borders - // and room for vertical scroll bar + ctrlWidth += 25; // Add margin after text + width for scroll bar m_LayerSelectionCtrl->SetMinSize( wxSize( ctrlWidth, -1 ) ); wxString netNameDoNotShowFilter = wxT( "Net-*" ); @@ -686,23 +673,3 @@ void DIALOG_COPPER_ZONE::buildAvailableListOfNets() } } - -wxBitmap DIALOG_COPPER_ZONE::makeLayerBitmap( COLOR4D aColor, COLOR4D aBackground ) -{ - wxBitmap bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); - wxBrush brush; - wxMemoryDC iconDC; - - iconDC.SelectObject( bitmap ); - - brush.SetStyle( wxBRUSHSTYLE_SOLID ); - brush.SetColour( aBackground.WithAlpha(1.0).ToColour() ); - iconDC.SetBrush( brush ); - iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); - - brush.SetColour( aColor.ToColour() ); - iconDC.SetBrush( brush ); - iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); - - return bitmap; -} diff --git a/pcbnew/dialogs/dialog_keepout_area_properties.cpp b/pcbnew/dialogs/dialog_keepout_area_properties.cpp index 1b07c923ce..d6411e67ef 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties.cpp @@ -28,6 +28,7 @@ */ #include +#include #include #include #include @@ -36,6 +37,7 @@ #include #include #include +#include #include #include @@ -44,8 +46,6 @@ #include // needed for wx/listctrl.h, in wxGTK 2.8.12 #include - - /** * Class DIALOG_KEEPOUT_AREA_PROPERTIES * is the derived class from dialog_copper_zone_frame created by wxFormBuilder @@ -71,9 +71,11 @@ private: /** * automatically called by wxWidgets before closing the dialog */ - virtual bool TransferDataFromWindow() override; + bool TransferDataFromWindow() override; - virtual void OnLayerSelection( wxDataViewEvent& event ) override; + void OnLayerSelection( wxDataViewEvent& event ) override; + + void OnSizeLayersList( wxSizeEvent& event ) override; /** * Function AcceptOptionsForKeepOut @@ -81,18 +83,15 @@ private: * @return bool - false if incorrect options, true if ok. */ bool AcceptOptionsForKeepOut(); - - /** - * Function makeLayerIcon - * creates the colored rectangle icons used in the layer selection widget. - * @param aColor is the color to fill the rectangle with. - */ - wxIcon makeLayerIcon( COLOR4D aColor ); }; -#define LAYER_BITMAP_SIZE_X 25 -#define LAYER_BITMAP_SIZE_Y 15 +#ifdef __WXMAC__ +const static wxSize LAYER_BITMAP_SIZE( 28, 28 ); // Things get wonky if this isn't square... +#else +const static wxSize LAYER_BITMAP_SIZE( 20, 14 ); +#endif + ZONE_EDIT_T InvokeKeepoutAreaEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings ) { @@ -127,7 +126,7 @@ DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES( PCB_BASE_FRAME* void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog() { BOARD* board = m_parent->GetBoard(); - + COLOR4D backgroundColor = m_parent->Settings().Colors().GetLayerColor( LAYER_PCB_BACKGROUND ); wxString msg; if( m_zonesettings.m_Zone_45_Only ) @@ -155,24 +154,25 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog() auto* layerColumn = m_layers->AppendIconTextColumn( wxEmptyString ); wxVector row; + int minNamesWidth = 0; - int imgIdx = 0; - - for( LSEQ cu_stack = show.UIOrder(); cu_stack; ++cu_stack, imgIdx++ ) + for( LSEQ cu_stack = show.UIOrder(); cu_stack; ++cu_stack ) { PCB_LAYER_ID layer = *cu_stack; msg = board->GetLayerName( layer ); + wxSize tsize( GetTextSize( msg, m_layers ) ); + minNamesWidth = std::max( minNamesWidth, tsize.x ); COLOR4D layerColor = m_parent->Settings().Colors().GetLayerColor( layer ); + wxBitmap bitmap = COLOR_SWATCH::MakeBitmap( layerColor, backgroundColor, LAYER_BITMAP_SIZE ); + wxIcon icon; + icon.CopyFromBitmap( bitmap ); row.clear(); row.push_back( m_zonesettings.m_Layers.test( layer ) ); - auto iconItem = wxDataViewIconText( msg, makeLayerIcon( layerColor ) ); - row.push_back( wxVariant( iconItem ) ); - + row.push_back( wxVariant( wxDataViewIconText( msg, icon ) ) ); m_layers->AppendItem( row ); - } // Init keepout parameters: @@ -180,11 +180,13 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog() m_cbViasCtrl->SetValue( m_zonesettings.GetDoNotAllowVias() ); m_cbCopperPourCtrl->SetValue( m_zonesettings.GetDoNotAllowCopperPour() ); - checkColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE ); - layerColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE ); + checkColumn->SetWidth( 25 ); // if only wxCOL_WIDTH_AUTOSIZE worked on all platforms... + layerColumn->SetMinWidth( minNamesWidth + LAYER_BITMAP_SIZE.x + 25 ); - m_layers->SetExpanderColumn( layerColumn ); - m_layers->SetMinSize( wxSize( 300, -1 ) ); + // You'd think the fact that m_layers is a list would encourage wxWidgets not to save room + // for the tree expanders... but you'd be wrong. Force indent to 0. + m_layers->SetIndent( 0 ); + m_layers->SetMinSize( wxSize( checkColumn->GetWidth() + layerColumn->GetWidth(), -1 ) ); m_layers->Update(); @@ -286,21 +288,13 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut() } -wxIcon DIALOG_KEEPOUT_AREA_PROPERTIES::makeLayerIcon( COLOR4D aColor ) +void DIALOG_KEEPOUT_AREA_PROPERTIES::OnSizeLayersList( wxSizeEvent& event ) { - wxBitmap bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); - wxBrush brush; - wxMemoryDC iconDC; + int nameColWidth = event.GetSize().GetX() - m_layers->GetColumn( 0 )->GetWidth() - 8; - iconDC.SelectObject( bitmap ); - brush.SetColour( aColor.ToColour() ); - brush.SetStyle( wxBRUSHSTYLE_SOLID ); + m_layers->GetColumn( 1 )->SetWidth( nameColWidth ); - iconDC.SetBrush( brush ); - iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); - - iconDC.SelectObject( wxNullBitmap ); // mandatory before using bitmap data - wxIcon icon; - icon.CopyFromBitmap( bitmap ); - return icon; + event.Skip(); } + + diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp b/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp index d95d518860..b223981e0b 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 30 2017) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -9,75 +9,78 @@ /////////////////////////////////////////////////////////////////////////// -BEGIN_EVENT_TABLE( DIALOG_KEEPOUT_AREA_PROPERTIES_BASE, DIALOG_SHIM ) - EVT_DATAVIEW_ITEM_VALUE_CHANGED( wxID_ANY, DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::_wxFB_OnLayerSelection ) -END_EVENT_TABLE() - DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::DIALOG_KEEPOUT_AREA_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( wxSize( 500,-1 ), wxDefaultSize ); + this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); - wxBoxSizer* m_MainSizer; - m_MainSizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bMainSizer; + bMainSizer = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* m_UpperSizer; - m_UpperSizer = new wxBoxSizer( wxHORIZONTAL ); + wxBoxSizer* bUpperSizer; + bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); - wxBoxSizer* m_layersListSizer; - m_layersListSizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bLayersListSizer; + bLayersListSizer = new wxBoxSizer( wxVERTICAL ); - m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Keepout area layers:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layers:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextLayerSelection->Wrap( -1 ); - m_layersListSizer->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + bLayersListSizer->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_layers = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_HORIZ_RULES|wxDV_NO_HEADER ); - m_layersListSizer->Add( m_layers, 1, wxALL|wxEXPAND, 5 ); + m_layers = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_NO_HEADER ); + bLayersListSizer->Add( m_layers, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - m_UpperSizer->Add( m_layersListSizer, 1, wxEXPAND, 5 ); + bUpperSizer->Add( bLayersListSizer, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bSizerRight; bSizerRight = new wxBoxSizer( wxVERTICAL ); - m_staticTextprops = new wxStaticText( this, wxID_ANY, _("Properties:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextprops->Wrap( -1 ); - bSizerRight->Add( m_staticTextprops, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + m_cbTracksCtrl = new wxCheckBox( this, wxID_ANY, _("Keepout tracks"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerRight->Add( m_cbTracksCtrl, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - wxString m_OrientEdgesOptChoices[] = { _("Any orientation"), _("180, 90, and 45 degrees") }; + m_cbViasCtrl = new wxCheckBox( this, wxID_ANY, _("Keepout vias"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerRight->Add( m_cbViasCtrl, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + m_cbCopperPourCtrl = new wxCheckBox( this, wxID_ANY, _("Keepout copper pours"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerRight->Add( m_cbCopperPourCtrl, 0, wxALL|wxEXPAND, 5 ); + + + bSizerRight->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + wxBoxSizer* bSizerLowerRight; + bSizerLowerRight = new wxBoxSizer( wxVERTICAL ); + + m_staticTextSlope = new wxStaticText( this, wxID_ANY, _("Outline slope:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextSlope->Wrap( -1 ); + bSizerLowerRight->Add( m_staticTextSlope, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + wxString m_OrientEdgesOptChoices[] = { _("Arbitrary"), _("H, V, and 45 deg only") }; int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString ); - m_OrientEdgesOpt = new wxRadioBox( this, wxID_ANY, _("Zone Edge Orientation:"), wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 1, wxRA_SPECIFY_COLS ); - m_OrientEdgesOpt->SetSelection( 1 ); - bSizerRight->Add( m_OrientEdgesOpt, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_OrientEdgesOpt = new wxChoice( this, ID_M_ORIENTEDGESOPT, wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 0 ); + m_OrientEdgesOpt->SetSelection( 0 ); + bSizerLowerRight->Add( m_OrientEdgesOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched outline"), _("Full hatched") }; + m_staticTextStyle = new wxStaticText( this, wxID_ANY, _("Outline style:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextStyle->Wrap( -1 ); + bSizerLowerRight->Add( m_staticTextStyle, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") }; int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString ); - m_OutlineAppearanceCtrl = new wxRadioBox( this, wxID_ANY, _("Outline Appearance:"), wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_OutlineAppearanceCtrl->SetSelection( 1 ); - bSizerRight->Add( m_OutlineAppearanceCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - wxStaticBoxSizer* sbSizerCutoutOpts; - sbSizerCutoutOpts = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Keepout Options:") ), wxVERTICAL ); - - m_cbTracksCtrl = new wxCheckBox( sbSizerCutoutOpts->GetStaticBox(), wxID_ANY, _("No tracks"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerCutoutOpts->Add( m_cbTracksCtrl, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - m_cbViasCtrl = new wxCheckBox( sbSizerCutoutOpts->GetStaticBox(), wxID_ANY, _("No vias"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerCutoutOpts->Add( m_cbViasCtrl, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - m_cbCopperPourCtrl = new wxCheckBox( sbSizerCutoutOpts->GetStaticBox(), wxID_ANY, _("No copper pour"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerCutoutOpts->Add( m_cbCopperPourCtrl, 0, wxALL|wxEXPAND, 5 ); + m_OutlineAppearanceCtrl = new wxChoice( this, ID_M_OUTLINEAPPEARANCECTRL, wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 0 ); + m_OutlineAppearanceCtrl->SetSelection( 0 ); + bSizerLowerRight->Add( m_OutlineAppearanceCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - bSizerRight->Add( sbSizerCutoutOpts, 0, wxEXPAND|wxALL, 5 ); + bSizerRight->Add( bSizerLowerRight, 1, wxEXPAND, 5 ); - m_UpperSizer->Add( bSizerRight, 0, wxEXPAND, 5 ); + bUpperSizer->Add( bSizerRight, 0, wxEXPAND|wxALL, 5 ); - m_MainSizer->Add( m_UpperSizer, 1, wxEXPAND, 5 ); + bMainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - m_MainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); m_sdbSizerButtons = new wxStdDialogButtonSizer(); m_sdbSizerButtonsOK = new wxButton( this, wxID_OK ); @@ -86,16 +89,24 @@ DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWind m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel ); m_sdbSizerButtons->Realize(); - m_MainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND|wxALL, 5 ); + bMainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND, 5 ); - this->SetSizer( m_MainSizer ); + this->SetSizer( bMainSizer ); this->Layout(); - m_MainSizer->Fit( this ); + bMainSizer->Fit( this ); this->Centre( wxBOTH ); + + // Connect Events + m_layers->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::OnLayerSelection ), NULL, this ); + m_layers->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::OnSizeLayersList ), NULL, this ); } DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::~DIALOG_KEEPOUT_AREA_PROPERTIES_BASE() { + // Disconnect Events + m_layers->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::OnLayerSelection ), NULL, this ); + m_layers->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::OnSizeLayersList ), NULL, this ); + } diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp b/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp index 62e546e8ac..1cdbda6603 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp +++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp @@ -10,7 +10,7 @@ 0 res UTF-8 - table + connect dialog_keepout_area_properties_base 1000 none @@ -41,7 +41,7 @@ 0 wxID_ANY - 500,-1 + -1,-1 DIALOG_KEEPOUT_AREA_PROPERTIES_BASE -1,-1 @@ -90,7 +90,7 @@ - m_MainSizer + bMainSizer wxVERTICAL none @@ -99,16 +99,16 @@ 1 - m_UpperSizer + bUpperSizer wxHORIZONTAL none 5 - wxEXPAND + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 1 - m_layersListSizer + bLayersListSizer wxVERTICAL none @@ -143,7 +143,7 @@ 0 0 wxID_ANY - Keepout area layers: + Layers: 0 @@ -196,7 +196,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 1 @@ -213,7 +213,7 @@ protected - wxDV_HORIZ_RULES|wxDV_NO_HEADER + wxDV_NO_HEADER @@ -258,7 +258,7 @@ - + OnSizeLayersList @@ -266,7 +266,7 @@ 5 - wxEXPAND + wxEXPAND|wxALL 0 @@ -275,9 +275,9 @@ none 5 - wxTOP|wxRIGHT|wxLEFT + wxTOP|wxRIGHT|wxLEFT|wxEXPAND 0 - + 1 1 1 @@ -291,6 +291,7 @@ 1 0 + 0 1 1 @@ -305,7 +306,7 @@ 0 0 wxID_ANY - Properties: + Keepout tracks 0 @@ -313,7 +314,7 @@ 0 1 - m_staticTextprops + m_cbTracksCtrl 1 @@ -327,11 +328,15 @@ 0 + + wxFILTER_NONE + wxDefaultValidator + - -1 + @@ -358,9 +363,9 @@ 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxTOP|wxRIGHT|wxLEFT|wxEXPAND 0 - + 1 1 1 @@ -374,7 +379,7 @@ 1 0 - "Any orientation" "180, 90, and 45 degrees" + 0 1 1 @@ -389,8 +394,7 @@ 0 0 wxID_ANY - Zone Edge Orientation: - 1 + Keepout vias 0 @@ -398,7 +402,7 @@ 0 1 - m_OrientEdgesOpt + m_cbViasCtrl 1 @@ -406,10 +410,9 @@ 1 Resizable - 1 1 - wxRA_SPECIFY_COLS + 0 @@ -421,6 +424,7 @@ + @@ -437,7 +441,6 @@ - @@ -448,9 +451,9 @@ 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + wxALL|wxEXPAND 0 - + 1 1 1 @@ -464,7 +467,7 @@ 1 0 - "Line" "Hatched outline" "Full hatched" + 0 1 1 @@ -479,8 +482,7 @@ 0 0 wxID_ANY - Outline Appearance: - 1 + Keepout copper pours 0 @@ -488,7 +490,7 @@ 0 1 - m_OutlineAppearanceCtrl + m_cbCopperPourCtrl 1 @@ -496,10 +498,9 @@ 1 Resizable - 1 1 - wxRA_SPECIFY_COLS + 0 @@ -511,6 +512,7 @@ + @@ -527,7 +529,6 @@ - @@ -538,22 +539,28 @@ 5 - wxEXPAND|wxALL + wxEXPAND|wxTOP|wxBOTTOM 0 - - wxID_ANY - Keepout Options: + + 0 + protected + 0 + + + + 5 + wxEXPAND + 1 + - sbSizerCutoutOpts + bSizerLowerRight wxVERTICAL - 1 none - - + 5 - wxTOP|wxRIGHT|wxLEFT|wxEXPAND + wxLEFT|wxRIGHT|wxTOP 0 - + 1 1 1 @@ -567,7 +574,6 @@ 1 0 - 0 1 1 @@ -582,7 +588,7 @@ 0 0 wxID_ANY - No tracks + Outline slope: 0 @@ -590,7 +596,7 @@ 0 1 - m_cbTracksCtrl + m_staticTextSlope 1 @@ -604,15 +610,11 @@ 0 - - wxFILTER_NONE - wxDefaultValidator - + -1 - @@ -637,11 +639,11 @@ - + 5 - wxTOP|wxRIGHT|wxLEFT|wxEXPAND + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT 0 - + 1 1 1 @@ -655,7 +657,7 @@ 1 0 - 0 + "Arbitrary" "H, V, and 45 deg only" 1 1 @@ -669,8 +671,7 @@ 0 0 - wxID_ANY - No vias + ID_M_ORIENTEDGESOPT 0 @@ -678,7 +679,7 @@ 0 1 - m_cbViasCtrl + m_OrientEdgesOpt 1 @@ -686,6 +687,7 @@ 1 Resizable + 0 1 @@ -700,7 +702,7 @@ - + @@ -725,11 +727,11 @@ - + 5 - wxALL|wxEXPAND + wxLEFT|wxRIGHT|wxTOP 0 - + 1 1 1 @@ -743,7 +745,6 @@ 1 0 - 0 1 1 @@ -758,7 +759,7 @@ 0 0 wxID_ANY - No copper pour + Outline style: 0 @@ -766,7 +767,7 @@ 0 1 - m_cbCopperPourCtrl + m_staticTextStyle 1 @@ -780,6 +781,90 @@ 0 + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Line" "Hatched" "Fully hatched" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_M_OUTLINEAPPEARANCECTRL + + 0 + + + 0 + + 1 + m_OutlineAppearanceCtrl + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + wxFILTER_NONE wxDefaultValidator @@ -788,7 +873,7 @@ - + @@ -902,7 +987,7 @@ 5 - wxEXPAND|wxALL + wxEXPAND 0 0 diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.h b/pcbnew/dialogs/dialog_keepout_area_properties_base.h index 02d50c8798..c8f9b616d3 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties_base.h +++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 30 2017) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -20,37 +20,34 @@ #include #include #include -#include #include -#include +#include #include #include #include /////////////////////////////////////////////////////////////////////////// +#define ID_M_ORIENTEDGESOPT 1000 +#define ID_M_OUTLINEAPPEARANCECTRL 1001 /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE /////////////////////////////////////////////////////////////////////////////// class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE : public DIALOG_SHIM { - DECLARE_EVENT_TABLE() private: - - // Private event handlers - void _wxFB_OnLayerSelection( wxDataViewEvent& event ){ OnLayerSelection( event ); } - protected: wxStaticText* m_staticTextLayerSelection; wxDataViewListCtrl* m_layers; - wxStaticText* m_staticTextprops; - wxRadioBox* m_OrientEdgesOpt; - wxRadioBox* m_OutlineAppearanceCtrl; wxCheckBox* m_cbTracksCtrl; wxCheckBox* m_cbViasCtrl; wxCheckBox* m_cbCopperPourCtrl; + wxStaticText* m_staticTextSlope; + wxChoice* m_OrientEdgesOpt; + wxStaticText* m_staticTextStyle; + wxChoice* m_OutlineAppearanceCtrl; wxStaticLine* m_staticline1; wxStdDialogButtonSizer* m_sdbSizerButtons; wxButton* m_sdbSizerButtonsOK; @@ -58,6 +55,7 @@ class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE : public DIALOG_SHIM // Virtual event handlers, overide them in your derived class virtual void OnLayerSelection( wxDataViewEvent& event ) { event.Skip(); } + virtual void OnSizeLayersList( wxSizeEvent& event ) { event.Skip(); } public: