Commit c0f2af8a authored by Marco Mattila's avatar Marco Mattila

Tune pcbnew zone properties dialog layout.

parent 640a0685
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
/// Licence: GNU License /// Licence: GNU License
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#include <wx/wx.h>
#include <wx/imaglist.h>
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
...@@ -18,6 +20,9 @@ ...@@ -18,6 +20,9 @@
#include "dialog_copper_zones.h" #include "dialog_copper_zones.h"
#define LAYER_BITMAP_SIZE_X 20
#define LAYER_BITMAP_SIZE_Y 10
/* the filter to show nets (default * "*"). /* the filter to show nets (default * "*").
* static to keep this pattern for an entire pcbnew session * static to keep this pattern for an entire pcbnew session
*/ */
...@@ -38,6 +43,16 @@ dialog_copper_zone::dialog_copper_zone( WinEDA_PcbFrame* parent, ZONE_SETTING* z ...@@ -38,6 +43,16 @@ dialog_copper_zone::dialog_copper_zone( WinEDA_PcbFrame* parent, ZONE_SETTING* z
SetReturnCode( ZONE_ABORT ); // Will be changed on buttons click SetReturnCode( ZONE_ABORT ); // Will be changed on buttons click
m_LayerSelectionCtrl = new wxListView( this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxLC_NO_HEADER | wxLC_REPORT
| wxLC_SINGLE_SEL | wxRAISED_BORDER );
wxListItem col0;
col0.SetId( 0 );
m_LayerSelectionCtrl->InsertColumn( 0, col0 );
m_layerSizer->Add( m_LayerSelectionCtrl, 1,
wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
initDialog(); initDialog();
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
...@@ -89,7 +104,6 @@ void dialog_copper_zone::initDialog() ...@@ -89,7 +104,6 @@ void dialog_copper_zone::initDialog()
break; break;
} }
if( m_Zone_Setting->m_Zone_Pad_Options != THERMAL_PAD ) if( m_Zone_Setting->m_Zone_Pad_Options != THERMAL_PAD )
{ {
m_AntipadSizeValue->Enable( false ); m_AntipadSizeValue->Enable( false );
...@@ -128,26 +142,34 @@ void dialog_copper_zone::initDialog() ...@@ -128,26 +142,34 @@ void dialog_copper_zone::initDialog()
m_ArcApproximationOpt->SetSelection( m_ArcApproximationOpt->SetSelection(
m_Zone_Setting->m_ArcToSegmentsCount == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ? 1 : 0 ); m_Zone_Setting->m_ArcToSegmentsCount == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ? 1 : 0 );
/* build copper layers list */ // Build copper layer list and append to layer widget
int layer_cnt = board->GetCopperLayerCount(); int layerCount = board->GetCopperLayerCount();
for( int ii = 0; ii < board->GetCopperLayerCount(); ii++ ) int layerNumber, itemIndex, layerColor;
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
for( int ii = 0; ii < layerCount; ii++ )
{ {
int layer_number = LAYER_N_BACK; layerNumber = LAYER_N_BACK;
if( layer_cnt <= 1 || ii < layer_cnt - 1 ) if( layerCount <= 1 || ii < layerCount - 1 )
layer_number = ii; layerNumber = ii;
else if( ii == layer_cnt - 1 ) else if( ii == layerCount - 1 )
layer_number = LAYER_N_FRONT; layerNumber = LAYER_N_FRONT;
m_LayerId[ii] = layer_number; m_LayerId.insert( m_LayerId.begin(), layerNumber );
msg = board->GetLayerName( layer_number ).Trim(); msg = board->GetLayerName( layerNumber ).Trim();
m_LayerSelectionCtrl->InsertItems( 1, &msg, ii ); layerColor = board->GetLayerColor( layerNumber );
imageList->Add( makeLayerBitmap( layerColor ) );
itemIndex = m_LayerSelectionCtrl->InsertItem( 0, msg, ii );
if( m_Zone_Setting->m_CurrentZone_Layer == layer_number ) if( m_Zone_Setting->m_CurrentZone_Layer == layerNumber )
m_LayerSelectionCtrl->SetSelection( ii ); m_LayerSelectionCtrl->Select( itemIndex );
} }
// Set layer list column width to widget width
m_LayerSelectionCtrl->SetColumnWidth( 0, m_LayerSelectionCtrl->GetSize().x );
wxString netNameDoNotShowFilter = wxT( "N-*" ); wxString netNameDoNotShowFilter = wxT( "N-*" );
if( m_Config ) if( m_Config )
{ {
...@@ -170,6 +192,12 @@ void dialog_copper_zone::initDialog() ...@@ -170,6 +192,12 @@ void dialog_copper_zone::initDialog()
/********************************************************************/ /********************************************************************/
void dialog_copper_zone::OnButtonCancelClick( wxCommandEvent& event ) void dialog_copper_zone::OnButtonCancelClick( wxCommandEvent& event )
/********************************************************************/ /********************************************************************/
{
Close( true );
}
void dialog_copper_zone::OnClose( wxCloseEvent& event )
{ {
EndModal( m_OnExitCode ); EndModal( m_OnExitCode );
} }
...@@ -240,7 +268,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -240,7 +268,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
#define CLEARANCE_MAX_VALUE 5000 // in 1/10000 inch #define CLEARANCE_MAX_VALUE 5000 // in 1/10000 inch
if( m_Zone_Setting->m_ZoneClearance > CLEARANCE_MAX_VALUE ) if( m_Zone_Setting->m_ZoneClearance > CLEARANCE_MAX_VALUE )
{ {
DisplayError( this, _( "Error : Zone clearance is set to an unreasonnable value" ) ); DisplayError( this, _( "Clearance must be smaller than 0.5\" / 12.7 mm." ) );
return false; return false;
} }
...@@ -250,8 +278,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -250,8 +278,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
if( m_Zone_Setting->m_ZoneMinThickness < 10 ) if( m_Zone_Setting->m_ZoneMinThickness < 10 )
{ {
DisplayError( this, DisplayError( this,
_( _( "Minimum width must be larger than 0.001\" / 0.0254 mm." ) );
"Error :\nyou must choose a copper min thickness value bigger than 0.001 inch (or 0.0254 mm)" ) );
return false; return false;
} }
...@@ -275,8 +302,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -275,8 +302,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
if( m_Zone_Setting->m_ThermalReliefCopperBridgeValue <= m_Zone_Setting->m_ZoneMinThickness ) if( m_Zone_Setting->m_ThermalReliefCopperBridgeValue <= m_Zone_Setting->m_ZoneMinThickness )
{ {
DisplayError( this, DisplayError( this,
_( _( "Thermal relief spoke width is larger than the minimum width." ) );
"Error :\nyou must choose a copper bridge value for thermal reliefs bigger than the min zone thickness" ) );
return false; return false;
} }
...@@ -285,22 +311,20 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -285,22 +311,20 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
return true; return 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 && aPromptForErrors ) if( ii < 0 && aPromptForErrors )
{ {
DisplayError( this, _( "Error : you must choose a layer" ) ); DisplayError( this, _( "No layer selected." ) );
return false; return false;
} }
m_Zone_Setting->m_CurrentZone_Layer = m_LayerId[ii]; m_Zone_Setting->m_CurrentZone_Layer = m_LayerId[ii];
/* Get the net name selection for this zone */ /* Get the net name selection for this zone */
ii = m_ListNetNameSelection->GetSelection(); ii = m_ListNetNameSelection->GetSelection();
if( ii < 0 && aPromptForErrors ) if( ii < 0 && aPromptForErrors )
{ {
DisplayError( this, _( "Error : you must choose a net name" ) ); DisplayError( this, _( "No net selected." ) );
return false; return false;
} }
...@@ -489,3 +513,21 @@ void dialog_copper_zone::buildAvailableListOfNets() ...@@ -489,3 +513,21 @@ void dialog_copper_zone::buildAvailableListOfNets()
} }
} }
} }
wxBitmap dialog_copper_zone::makeLayerBitmap( int aColor )
{
wxBitmap bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
wxBrush brush;
wxMemoryDC iconDC;
iconDC.SelectObject( bitmap );
brush.SetColour( MakeColour( aColor ) );
brush.SetStyle( wxSOLID );
iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
return bitmap;
}
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#ifndef DIALOG_COPPER_ZONES #ifndef DIALOG_COPPER_ZONES
#define DIALOG_COPPER_ZONES #define DIALOG_COPPER_ZONES
#include <wx/wx.h>
#include "dialog_copper_zones_base.h" #include "dialog_copper_zones_base.h"
/* here is the derivated class from dialog_copper_zone_frame created by wxFormBuilder /* here is the derivated class from dialog_copper_zone_frame created by wxFormBuilder
...@@ -22,10 +23,12 @@ private: ...@@ -22,10 +23,12 @@ private:
* true = pad count sort. * true = pad count sort.
*/ */
long m_NetFiltering; long m_NetFiltering;
int m_LayerId[LAYER_COUNT]; // Handle the real layer number from layer name position in m_LayerSelectionCtrl std::vector<int> m_LayerId; // Handle the real layer number from layer
// name position in m_LayerSelectionCtrl
static wxString m_netNameShowFilter; /* the filter to show nets (default * "*"). static wxString m_netNameShowFilter; /* the filter to show nets (default * "*").
* static to keep this pattern for an entire pcbnew session * static to keep this pattern for an entire pcbnew session
*/ */
wxListView* m_LayerSelectionCtrl;
public: public:
dialog_copper_zone( WinEDA_PcbFrame* parent, ZONE_SETTING* zone_setting ); dialog_copper_zone( WinEDA_PcbFrame* parent, ZONE_SETTING* zone_setting );
...@@ -33,6 +36,7 @@ private: ...@@ -33,6 +36,7 @@ private:
void initDialog(); void initDialog();
void OnButtonOkClick( wxCommandEvent& event ); void OnButtonOkClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event ); void OnButtonCancelClick( wxCommandEvent& event );
void OnClose( wxCloseEvent& event );
bool AcceptOptions( bool aPromptForErrors, bool aUseExportableSetupOnly = false ); bool AcceptOptions( bool aPromptForErrors, bool aUseExportableSetupOnly = false );
void OnNetSortingOptionSelected( wxCommandEvent& event ); void OnNetSortingOptionSelected( wxCommandEvent& event );
void ExportSetupToOtherCopperZones( wxCommandEvent& event ); void ExportSetupToOtherCopperZones( wxCommandEvent& event );
...@@ -40,5 +44,6 @@ private: ...@@ -40,5 +44,6 @@ private:
void OnRunFiltersButtonClick( wxCommandEvent& event ); void OnRunFiltersButtonClick( wxCommandEvent& event );
void buildAvailableListOfNets(); void buildAvailableListOfNets();
void initListNetsParams(); void initListNetsParams();
wxBitmap makeLayerBitmap( int aColor );
}; };
#endif // #ifndef DIALOG_COPPER_ZONES #endif // #ifndef DIALOG_COPPER_ZONES
This diff is collapsed.
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008) // C++ code generated with wxFormBuilder (version Nov 18 2010)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_copper_zones_base__ #ifndef __dialog_copper_zones_base__
#define __dialog_copper_zones_base__ #define __dialog_copper_zones_base__
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/radiobox.h> #include <wx/stattext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/stattext.h> #include <wx/sizer.h>
#include <wx/textctrl.h> #include <wx/listbox.h>
#include <wx/sizer.h> #include <wx/choice.h>
#include <wx/statbox.h> #include <wx/textctrl.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/listbox.h> #include <wx/statbox.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class dialog_copper_zone_base /// Class dialog_copper_zone_base
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class dialog_copper_zone_base : public wxDialog class dialog_copper_zone_base : public wxDialog
{ {
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
private: private:
// Private event handlers // Private event handlers
void _wxFB_OnPadsInZoneClick( wxCommandEvent& event ){ OnPadsInZoneClick( event ); } void _wxFB_OnClose( wxCloseEvent& event ){ OnClose( event ); }
void _wxFB_ExportSetupToOtherCopperZones( wxCommandEvent& event ){ ExportSetupToOtherCopperZones( event ); } void _wxFB_OnNetSortingOptionSelected( wxCommandEvent& event ){ OnNetSortingOptionSelected( event ); }
void _wxFB_OnButtonOkClick( wxCommandEvent& event ){ OnButtonOkClick( event ); } void _wxFB_OnRunFiltersButtonClick( wxCommandEvent& event ){ OnRunFiltersButtonClick( event ); }
void _wxFB_OnButtonCancelClick( wxCommandEvent& event ){ OnButtonCancelClick( event ); } void _wxFB_OnPadsInZoneClick( wxCommandEvent& event ){ OnPadsInZoneClick( event ); }
void _wxFB_OnNetSortingOptionSelected( wxCommandEvent& event ){ OnNetSortingOptionSelected( event ); } void _wxFB_ExportSetupToOtherCopperZones( wxCommandEvent& event ){ ExportSetupToOtherCopperZones( event ); }
void _wxFB_OnRunFiltersButtonClick( wxCommandEvent& event ){ OnRunFiltersButtonClick( event ); } void _wxFB_OnButtonOkClick( wxCommandEvent& event ){ OnButtonOkClick( event ); }
void _wxFB_OnButtonCancelClick( wxCommandEvent& event ){ OnButtonCancelClick( event ); }
protected:
enum protected:
{ enum
ID_RADIOBOX_FILL_MODE_SELECTION = 1000, {
wxID_ARC_APPROX, ID_NETNAME_SELECTION = 1000,
wxID_PADS_IN_ZONE_OPTIONS, ID_M_NETDISPLAYOPTION,
wxID_ANTIPAD_SIZE, ID_TEXTCTRL_NETNAMES_FILTER,
wxID_COPPER_BRIDGE_VALUE, wxID_APPLY_FILTERS,
ID_RADIOBOX_OUTLINES_OPTION, ID_M_PADINZONEOPT,
wxID_BUTTON_EXPORT, wxID_ANTIPAD_SIZE,
ID_NET_SORTING_OPTION, wxID_COPPER_BRIDGE_VALUE,
ID_TEXTCTRL_NETNAMES_FILTER, ID_M_FILLMODECTRL,
ID_NETNAME_SELECTION, ID_M_ARCAPPROXIMATIONOPT,
ID_LAYER_CHOICE, ID_M_ORIENTEDGESOPT,
}; ID_M_OUTLINEAPPEARANCECTRL,
wxID_BUTTON_EXPORT,
wxRadioBox* m_FillModeCtrl; };
wxRadioBox* m_ArcApproximationOpt;
wxRadioBox* m_PadInZoneOpt; wxBoxSizer* m_layerSizer;
wxStaticText* m_AntipadSizeText; wxStaticText* m_staticText17;
wxTextCtrl* m_AntipadSizeValue; wxStaticText* m_staticText2;
wxStaticText* m_CopperBridgeWidthText; wxListBox* m_ListNetNameSelection;
wxTextCtrl* m_CopperWidthValue; wxStaticText* m_staticText16;
wxChoice* m_NetDisplayOption;
wxRadioBox* m_OrientEdgesOpt; wxStaticText* m_staticText5;
wxRadioBox* m_OutlineAppearanceCtrl; wxTextCtrl* m_DoNotShowNetNameFilter;
wxStaticText* m_ClearanceValueTitle; wxStaticText* m_staticText51;
wxTextCtrl* m_ZoneClearanceCtrl; wxTextCtrl* m_ShowNetNameFilter;
wxStaticText* m_MinThicknessValueTitle; wxButton* m_buttonRunFilter;
wxTextCtrl* m_ZoneMinThicknessCtrl; wxStaticText* m_ClearanceValueTitle;
wxTextCtrl* m_ZoneClearanceCtrl;
wxButton* m_ExportSetupButton; wxStaticText* m_MinThicknessValueTitle;
wxButton* m_OkButton; wxTextCtrl* m_ZoneMinThicknessCtrl;
wxButton* m_ButtonCancel; wxStaticText* m_staticText151;
wxChoice* m_choice7;
wxRadioBox* m_NetDisplayOption; wxStaticText* m_staticText161;
wxStaticText* m_staticText5; wxTextCtrl* m_textCtrl7;
wxTextCtrl* m_DoNotShowNetNameFilter; wxStaticText* m_staticText13;
wxStaticText* m_staticText51; wxChoice* m_PadInZoneOpt;
wxTextCtrl* m_ShowNetNameFilter; wxStaticText* m_AntipadSizeText;
wxButton* m_buttonRunFilter; wxTextCtrl* m_AntipadSizeValue;
wxStaticText* m_staticText2; wxStaticText* m_CopperBridgeWidthText;
wxListBox* m_ListNetNameSelection; wxTextCtrl* m_CopperWidthValue;
wxStaticText* m_staticText3; wxStaticText* m_staticText11;
wxListBox* m_LayerSelectionCtrl; wxChoice* m_FillModeCtrl;
wxStaticText* m_staticText12;
// Virtual event handlers, overide them in your derived class wxChoice* m_ArcApproximationOpt;
virtual void OnPadsInZoneClick( wxCommandEvent& event ){ event.Skip(); } wxStaticText* m_staticText14;
virtual void ExportSetupToOtherCopperZones( wxCommandEvent& event ){ event.Skip(); } wxChoice* m_OrientEdgesOpt;
virtual void OnButtonOkClick( wxCommandEvent& event ){ event.Skip(); } wxStaticText* m_staticText15;
virtual void OnButtonCancelClick( wxCommandEvent& event ){ event.Skip(); } wxChoice* m_OutlineAppearanceCtrl;
virtual void OnNetSortingOptionSelected( wxCommandEvent& event ){ event.Skip(); } wxButton* m_ExportSetupButton;
virtual void OnRunFiltersButtonClick( wxCommandEvent& event ){ event.Skip(); } wxButton* m_OkButton;
wxButton* m_ButtonCancel;
public: // Virtual event handlers, overide them in your derived class
dialog_copper_zone_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fill Zones Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 566,582 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
~dialog_copper_zone_base(); virtual void OnNetSortingOptionSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRunFiltersButtonClick( wxCommandEvent& event ) { event.Skip(); }
}; virtual void OnPadsInZoneClick( wxCommandEvent& event ) { event.Skip(); }
virtual void ExportSetupToOtherCopperZones( wxCommandEvent& event ) { event.Skip(); }
#endif //__dialog_copper_zones_base__ virtual void OnButtonOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); }
public:
dialog_copper_zone_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Zone Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 550,500 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~dialog_copper_zone_base();
};
#endif //__dialog_copper_zones_base__
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment