diff --git a/common/class_layer_box_selector.cpp b/common/class_layer_box_selector.cpp
index a4676e91cf..401f8d3bb9 100644
--- a/common/class_layer_box_selector.cpp
+++ b/common/class_layer_box_selector.cpp
@@ -84,6 +84,9 @@ int LAYER_BOX_SELECTOR::GetChoice()
// Get Current Layer
LAYER_NUM LAYER_BOX_SELECTOR::GetLayerSelection() const
{
+ if( GetSelection() < 0 )
+ return UNDEFINED_LAYER;
+
return (LAYER_NUM)(intptr_t) GetClientData( GetSelection() );
}
diff --git a/pcbnew/dialogs/dialog_dimension_editor_base.fbp b/pcbnew/dialogs/dialog_dimension_editor_base.fbp
index c841d8509c..4373b4f5cf 100644
--- a/pcbnew/dialogs/dialog_dimension_editor_base.fbp
+++ b/pcbnew/dialogs/dialog_dimension_editor_base.fbp
@@ -42,7 +42,7 @@
DIALOG_DIMENSION_EDITOR_BASE
- 378,328
+ 417,328
wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER
DIALOG_SHIM; dialog_shim.h
Dimension Properties
@@ -1341,7 +1341,7 @@
5
wxBOTTOM|wxRIGHT|wxLEFT
0
-
-
+
5
- wxEXPAND|wxALL
+ wxALL
0
-
+
1
1
1
@@ -2172,22 +2172,23 @@
1
Resizable
- 0
+ -1
1
-
+ PCB_LAYER_BOX_SELECTOR; class_pcb_layer_box_selector.h
0
- Select the layer on which text should lay.
+
wxFILTER_NONE
wxDefaultValidator
+
-
+
@@ -2209,6 +2210,8 @@
+
+
diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_base.h b/pcbnew/dialogs/dialog_graphic_item_properties_base.h
index 07961a4611..bb78ca4782 100644
--- a/pcbnew/dialogs/dialog_graphic_item_properties_base.h
+++ b/pcbnew/dialogs/dialog_graphic_item_properties_base.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Apr 10 2012)
+// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -11,6 +11,9 @@
#include
#include
#include
+class DIALOG_SHIM;
+class PCB_LAYER_BOX_SELECTOR;
+
#include "dialog_shim.h"
#include
#include
@@ -21,7 +24,7 @@
#include
#include
#include
-#include
+#include
#include
#include
@@ -59,7 +62,7 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE : public DIALOG_SHIM
wxTextCtrl* m_DefaultThicknessCtrl;
wxStaticText* m_DefaulThicknessTextUnit;
wxStaticText* m_LayerLabel;
- wxChoice* m_LayerSelectionCtrl;
+ PCB_LAYER_BOX_SELECTOR* m_LayerSelectionCtrl;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_StandardButtonsSizer;
wxButton* m_StandardButtonsSizerOK;
diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp
index 3618570380..9c4fdd2dfe 100644
--- a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp
+++ b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp
@@ -24,6 +24,7 @@
#include
#include
+#include
class DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES: public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE
{
@@ -32,7 +33,6 @@ private:
EDGE_MODULE* m_item;
BOARD_DESIGN_SETTINGS m_brdSettings;
MODULE * m_module;
- std::vector m_layerId; // the layer Id with the same order as m_LayerSelectionCtrl widget
public:
DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES( FOOTPRINT_EDIT_FRAME* aParent,
@@ -129,7 +129,7 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg()
m_EndPointXLabel->SetLabel(_("Start Point X"));
m_EndPointYLabel->SetLabel(_("Start Point Y"));
- // Here the angle is a double, but the UI is still working
+ // Here the angle is a double, but the UI is still working
// with integers
msg << int( m_item->GetAngle() );
m_Angle_Ctrl->SetValue(msg);
@@ -154,27 +154,16 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg()
PutValueInLocalUnits( *m_DefaultThicknessCtrl, m_brdSettings.m_ModuleSegmentWidth );
- m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( LAYER_N_BACK ) );
- m_layerId.push_back( LAYER_N_BACK );
- m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( LAYER_N_FRONT ) );
- m_layerId.push_back( LAYER_N_FRONT );
- for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER; ++layer )
+ // Configure the layers list selector
+ m_LayerSelectionCtrl->SetLayersHotkeys( false );
+ m_LayerSelectionCtrl->SetLayerMask( INTERNAL_CU_LAYERS|EDGE_LAYER );
+ m_LayerSelectionCtrl->SetBoardFrame( m_parent );
+ m_LayerSelectionCtrl->Resync();
+ if( m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() ) < 0 )
{
- if( layer == EDGE_N )
- // Do not use pcb edge layer for footprints, this is a special layer
- // So skip it in list
- continue;
- m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( layer ) );
- m_layerId.push_back( layer );
- }
-
- for( unsigned ii = 0; ii < m_layerId.size(); ii++ )
- {
- if( m_layerId[ii] == m_item->GetLayer() )
- {
- m_LayerSelectionCtrl->SetSelection( ii );
- break;
- }
+ wxMessageBox( _("This item has an illegal layer id.\n"
+ "Now, forced on the front silk screen layer. Please, fix it") );
+ m_LayerSelectionCtrl->SetLayerSelection( SILKSCREEN_N_FRONT );
}
}
@@ -191,14 +180,8 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
/* Copy values in text control to the item parameters
*/
{
- int idx = m_LayerSelectionCtrl->GetCurrentSelection();
- if( idx < 0 )
- {
- wxMessageBox( _("No valid layer selected for this item. Please, select a layer") );
- return;
- }
+ LAYER_NUM layer = m_LayerSelectionCtrl->GetLayerSelection();
- LAYER_NUM layer = m_layerId[idx];
if( IsCopperLayer( layer ) )
{
/* an edge is put on a copper layer: this it is very dangerous. a
diff --git a/pcbnew/dialogs/dialog_pcb_text_properties.cpp b/pcbnew/dialogs/dialog_pcb_text_properties.cpp
index 7a78102c41..ceaf62f5cc 100644
--- a/pcbnew/dialogs/dialog_pcb_text_properties.cpp
+++ b/pcbnew/dialogs/dialog_pcb_text_properties.cpp
@@ -41,6 +41,7 @@
#include
#include
#include
+#include
class PCB_EDIT_FRAME;
@@ -56,7 +57,6 @@ private:
PCB_EDIT_FRAME* m_Parent;
wxDC* m_DC;
TEXTE_PCB* m_SelectedPCBText;
- std::vector layerList;
void MyInit();
@@ -126,20 +126,13 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit()
PutValueInLocalUnits( *m_PositionXCtrl, m_SelectedPCBText->GetTextPosition().x );
PutValueInLocalUnits( *m_PositionYCtrl, m_SelectedPCBText->GetTextPosition().y );
- LAYER_MSK enabledLayers = m_Parent->GetBoard()->GetEnabledLayers();
-
- for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
- {
- if( enabledLayers & GetLayerMask( layer ) )
- {
- layerList.push_back( layer );
- int itemIndex =
- m_LayerSelectionCtrl->Append( m_Parent->GetBoard()->GetLayerName( layer ) );
-
- if( m_SelectedPCBText->GetLayer() == layer )
- m_LayerSelectionCtrl->SetSelection( itemIndex );
- }
- }
+ // Configure the layers list selector
+ m_LayerSelectionCtrl->SetLayersHotkeys( false );
+ // A text has no sense on edge cut layer
+ m_LayerSelectionCtrl->SetLayerMask( EDGE_LAYER );
+ m_LayerSelectionCtrl->SetBoardFrame( m_Parent );
+ m_LayerSelectionCtrl->Resync();
+ m_LayerSelectionCtrl->SetLayerSelection( m_SelectedPCBText->GetLayer() );
wxString orientationStr;
orientationStr << m_SelectedPCBText->GetOrientation();
@@ -245,7 +238,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event )
}
// Set the layer on which the PCB text is laying
- m_SelectedPCBText->SetLayer( layerList[m_LayerSelectionCtrl->GetSelection()] );
+ m_SelectedPCBText->SetLayer( m_LayerSelectionCtrl->GetLayerSelection() );
// Set whether the PCB text is mirrored (faced down from layer face perspective)
m_SelectedPCBText->SetMirrored( m_DisplayCtrl->GetSelection() == 1 );
diff --git a/pcbnew/dialogs/dialog_pcb_text_properties_base.cpp b/pcbnew/dialogs/dialog_pcb_text_properties_base.cpp
index c68284866e..d04c149bcf 100644
--- a/pcbnew/dialogs/dialog_pcb_text_properties_base.cpp
+++ b/pcbnew/dialogs/dialog_pcb_text_properties_base.cpp
@@ -1,10 +1,12 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Apr 11 2012)
+// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
+#include "class_pcb_layer_box_selector.h"
+
#include "dialog_pcb_text_properties_base.h"
///////////////////////////////////////////////////////////////////////////
@@ -24,13 +26,14 @@ DIALOG_PCB_TEXT_PROPERTIES_BASE::DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* pare
bSizer9->Add( m_TextLabel, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TextContentCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
+ m_TextContentCtrl->SetMaxLength( 0 );
m_TextContentCtrl->SetToolTip( _("Enter the text placed on selected layer.") );
m_TextContentCtrl->SetMinSize( wxSize( 400,60 ) );
bSizer9->Add( m_TextContentCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxFlexGridSizer* fgSizer1;
- fgSizer1 = new wxFlexGridSizer( 6, 4, 0, 0 );
+ fgSizer1 = new wxFlexGridSizer( 0, 4, 0, 0 );
fgSizer1->AddGrowableCol( 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->AddGrowableCol( 2 );
@@ -55,17 +58,15 @@ DIALOG_PCB_TEXT_PROPERTIES_BASE::DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* pare
fgSizer1->Add( m_staticText10, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_SizeXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ m_SizeXCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_SizeXCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_PositionXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ m_PositionXCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_PositionXCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
- wxArrayString m_LayerSelectionCtrlChoices;
- m_LayerSelectionCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_LayerSelectionCtrlChoices, 0 );
- m_LayerSelectionCtrl->SetSelection( 0 );
- m_LayerSelectionCtrl->SetToolTip( _("Select the layer on which text should lay.") );
-
- fgSizer1->Add( m_LayerSelectionCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
+ m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
+ fgSizer1->Add( m_LayerSelectionCtrl, 0, wxALL, 5 );
wxString m_DisplayCtrlChoices[] = { _("Normal"), _("Mirrored") };
int m_DisplayCtrlNChoices = sizeof( m_DisplayCtrlChoices ) / sizeof( wxString );
@@ -90,9 +91,11 @@ DIALOG_PCB_TEXT_PROPERTIES_BASE::DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* pare
fgSizer1->Add( m_staticText11, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_SizeYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ m_SizeYCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_SizeYCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_PositionYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ m_PositionYCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_PositionYCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
wxString m_StyleCtrlChoices[] = { _("Normal"), _("Italic") };
@@ -122,9 +125,11 @@ DIALOG_PCB_TEXT_PROPERTIES_BASE::DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* pare
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
m_ThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ m_ThicknessCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_ThicknessCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_OrientationCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ m_OrientationCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_OrientationCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
diff --git a/pcbnew/dialogs/dialog_pcb_text_properties_base.fbp b/pcbnew/dialogs/dialog_pcb_text_properties_base.fbp
index ba2d76916c..18ad8d4662 100644
--- a/pcbnew/dialogs/dialog_pcb_text_properties_base.fbp
+++ b/pcbnew/dialogs/dialog_pcb_text_properties_base.fbp
@@ -42,7 +42,7 @@
-1,-1
DIALOG_PCB_TEXT_PROPERTIES_BASE
- 433,450
+ 483,450
wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU
DIALOG_SHIM; dialog_shim.h
Text Properties
@@ -288,7 +288,7 @@
fgSizer1
wxFLEX_GROWMODE_SPECIFIED
none
- 6
+ 0
0
5
@@ -804,11 +804,11 @@
-
+
5
- wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT
+ wxALL
0
-
+
1
1
1
@@ -852,22 +852,23 @@
1
Resizable
- 0
+ -1
1
-
+ PCB_LAYER_BOX_SELECTOR; class_pcb_layer_box_selector.h
0
- Select the layer on which text should lay.
+
wxFILTER_NONE
wxDefaultValidator
+
-
+
@@ -889,6 +890,8 @@
+
+
diff --git a/pcbnew/dialogs/dialog_pcb_text_properties_base.h b/pcbnew/dialogs/dialog_pcb_text_properties_base.h
index e5062b8b94..c049515d48 100644
--- a/pcbnew/dialogs/dialog_pcb_text_properties_base.h
+++ b/pcbnew/dialogs/dialog_pcb_text_properties_base.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Apr 11 2012)
+// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -11,6 +11,9 @@
#include
#include
#include
+class DIALOG_SHIM;
+class PCB_LAYER_BOX_SELECTOR;
+
#include "dialog_shim.h"
#include
#include
@@ -19,6 +22,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -43,7 +47,7 @@ class DIALOG_PCB_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_staticText10;
wxTextCtrl* m_SizeXCtrl;
wxTextCtrl* m_PositionXCtrl;
- wxChoice* m_LayerSelectionCtrl;
+ PCB_LAYER_BOX_SELECTOR* m_LayerSelectionCtrl;
wxChoice* m_DisplayCtrl;
wxStaticText* m_SizeYLabel;
wxStaticText* m_PositionYLabel;
@@ -69,7 +73,7 @@ class DIALOG_PCB_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
public:
- DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 433,450 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU );
+ DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 483,450 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_PCB_TEXT_PROPERTIES_BASE();
};