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

Pcbnew: use pcb layer box selector in dialog graphic item properties and pcb text properties.

parent b7b972d8
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -84,6 +84,9 @@ int LAYER_BOX_SELECTOR::GetChoice()
// Get Current Layer
// Get Current Layer
LAYER_NUM LAYER_BOX_SELECTOR::GetLayerSelection() const
LAYER_NUM LAYER_BOX_SELECTOR::GetLayerSelection() const
{
{
    if( GetSelection() < 0 )
        return UNDEFINED_LAYER;

    return (LAYER_NUM)(intptr_t) GetClientData( GetSelection() );
    return (LAYER_NUM)(intptr_t) GetClientData( GetSelection() );
}
}


+2 −2
Original line number Original line Diff line number Diff line
@@ -42,7 +42,7 @@
            <property name="minimum_size"></property>
            <property name="minimum_size"></property>
            <property name="name">DIALOG_DIMENSION_EDITOR_BASE</property>
            <property name="name">DIALOG_DIMENSION_EDITOR_BASE</property>
            <property name="pos"></property>
            <property name="pos"></property>
            <property name="size">378,328</property>
            <property name="size">417,328</property>
            <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
            <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
            <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
            <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
            <property name="title">Dimension Properties</property>
            <property name="title">Dimension Properties</property>
@@ -1341,7 +1341,7 @@
                                    <property name="border">5</property>
                                    <property name="border">5</property>
                                    <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
                                    <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
                                    <property name="proportion">0</property>
                                    <property name="proportion">0</property>
                                    <object class="wxComboBox" expanded="1">
                                    <object class="wxBitmapComboBox" expanded="1">
                                        <property name="BottomDockable">1</property>
                                        <property name="BottomDockable">1</property>
                                        <property name="LeftDockable">1</property>
                                        <property name="LeftDockable">1</property>
                                        <property name="RightDockable">1</property>
                                        <property name="RightDockable">1</property>
+2 −2
Original line number Original line Diff line number Diff line
@@ -24,7 +24,7 @@ class PCB_LAYER_BOX_SELECTOR;
#include <wx/textctrl.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/radiobox.h>
#include <wx/combobox.h>
#include <wx/bmpcbox.h>
#include <wx/statline.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/dialog.h>
@@ -67,7 +67,7 @@ class DIALOG_DIMENSION_EDITOR_BASE : public DIALOG_SHIM
	
	
	public:
	public:
		
		
		DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Dimension Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 378,328 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); 
		DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Dimension Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 417,328 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); 
		~DIALOG_DIMENSION_EDITOR_BASE();
		~DIALOG_DIMENSION_EDITOR_BASE();
	
	
};
};
+13 −15
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@
#include <class_drawsegment.h>
#include <class_drawsegment.h>


#include <dialog_graphic_item_properties_base.h>
#include <dialog_graphic_item_properties_base.h>
#include <class_pcb_layer_box_selector.h>


class DIALOG_GRAPHIC_ITEM_PROPERTIES: public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE
class DIALOG_GRAPHIC_ITEM_PROPERTIES: public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE
{
{
@@ -159,20 +160,17 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( )


    PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness );
    PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness );


    for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER;
    // Configure the layers list selector
         layer <= LAST_NON_COPPER_LAYER; ++layer )
    m_LayerSelectionCtrl->SetLayersHotkeys( false );
    m_LayerSelectionCtrl->SetLayerMask( ALL_CU_LAYERS );
    m_LayerSelectionCtrl->SetBoardFrame( m_parent );
    m_LayerSelectionCtrl->Resync();
    if( m_LayerSelectionCtrl->SetLayerSelection( m_Item->GetLayer() ) < 0 )
    {
    {
        m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( layer ) );
        wxMessageBox( _("This item has an illegal layer id.\n"
                        "Now, forced on the drawings layer. Please, fix it") );
        m_LayerSelectionCtrl->SetLayerSelection( DRAW_N );
    }
    }

    LAYER_NUM layer = m_Item->GetLayer();

    // It has to be an aux layer
    if ( layer < FIRST_NON_COPPER_LAYER )
        layer = FIRST_NON_COPPER_LAYER;
    if ( layer > LAST_NON_COPPER_LAYER )
        layer = LAST_NON_COPPER_LAYER;
    m_LayerSelectionCtrl->SetSelection( layer - FIRST_NON_COPPER_LAYER );
}
}




@@ -182,7 +180,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& event )
{
{
    int thickness;
    int thickness;


    if( (m_LayerSelectionCtrl->GetCurrentSelection() + FIRST_NON_COPPER_LAYER) == EDGE_N )
    if( m_LayerSelectionCtrl->GetLayerSelection() == EDGE_N )
        thickness =  m_brdSettings.m_EdgeSegmentWidth;
        thickness =  m_brdSettings.m_EdgeSegmentWidth;
    else
    else
        thickness =  m_brdSettings.m_DrawSegmentWidth;
        thickness =  m_brdSettings.m_DrawSegmentWidth;
@@ -221,7 +219,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
    msg = m_DefaultThicknessCtrl->GetValue();
    msg = m_DefaultThicknessCtrl->GetValue();
    int thickness = ReturnValueFromString( g_UserUnit, msg );
    int thickness = ReturnValueFromString( g_UserUnit, msg );


    m_Item->SetLayer( FIRST_NON_COPPER_LAYER + m_LayerSelectionCtrl->GetCurrentSelection() );
    m_Item->SetLayer( m_LayerSelectionCtrl->GetLayerSelection() );


    if( m_Item->GetLayer() == EDGE_N )
    if( m_Item->GetLayer() == EDGE_N )
         m_brdSettings.m_EdgeSegmentWidth = thickness;
         m_brdSettings.m_EdgeSegmentWidth = thickness;
+12 −7
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 Oct  8 2012)
// http://www.wxformbuilder.org/
// http://www.wxformbuilder.org/
//
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////


#include "class_pcb_layer_box_selector.h"

#include "dialog_graphic_item_properties_base.h"
#include "dialog_graphic_item_properties_base.h"


///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
@@ -30,6 +32,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
	fgUpperLeftGridSizer->Add( m_StartPointXLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
	fgUpperLeftGridSizer->Add( m_StartPointXLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
	
	
	m_Center_StartXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_Center_StartXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_Center_StartXCtrl->SetMaxLength( 0 ); 
	fgUpperLeftGridSizer->Add( m_Center_StartXCtrl, 0, wxEXPAND|wxALL, 5 );
	fgUpperLeftGridSizer->Add( m_Center_StartXCtrl, 0, wxEXPAND|wxALL, 5 );
	
	
	m_StartPointXUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
	m_StartPointXUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
@@ -41,6 +44,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
	fgUpperLeftGridSizer->Add( m_StartPointYLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
	fgUpperLeftGridSizer->Add( m_StartPointYLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
	
	
	m_Center_StartYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_Center_StartYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_Center_StartYCtrl->SetMaxLength( 0 ); 
	fgUpperLeftGridSizer->Add( m_Center_StartYCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
	fgUpperLeftGridSizer->Add( m_Center_StartYCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
	
	
	m_StartPointYUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
	m_StartPointYUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
@@ -52,6 +56,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
	fgUpperLeftGridSizer->Add( m_EndPointXLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
	fgUpperLeftGridSizer->Add( m_EndPointXLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
	
	
	m_EndX_Radius_Ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_EndX_Radius_Ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_EndX_Radius_Ctrl->SetMaxLength( 0 ); 
	fgUpperLeftGridSizer->Add( m_EndX_Radius_Ctrl, 0, wxEXPAND|wxALL, 5 );
	fgUpperLeftGridSizer->Add( m_EndX_Radius_Ctrl, 0, wxEXPAND|wxALL, 5 );
	
	
	m_EndPointXUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
	m_EndPointXUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
@@ -63,6 +68,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
	fgUpperLeftGridSizer->Add( m_EndPointYLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
	fgUpperLeftGridSizer->Add( m_EndPointYLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
	
	
	m_EndY_Ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_EndY_Ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_EndY_Ctrl->SetMaxLength( 0 ); 
	fgUpperLeftGridSizer->Add( m_EndY_Ctrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
	fgUpperLeftGridSizer->Add( m_EndY_Ctrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
	
	
	m_EndPointYUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
	m_EndPointYUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
@@ -89,6 +95,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
	fgUpperRightGridSizer->Add( m_Angle_Text, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
	fgUpperRightGridSizer->Add( m_Angle_Text, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
	
	
	m_Angle_Ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_Angle_Ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_Angle_Ctrl->SetMaxLength( 0 ); 
	fgUpperRightGridSizer->Add( m_Angle_Ctrl, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
	fgUpperRightGridSizer->Add( m_Angle_Ctrl, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
	
	
	m_AngleUnit = new wxStaticText( this, wxID_ANY, _("0.1 degree"), wxDefaultPosition, wxDefaultSize, 0 );
	m_AngleUnit = new wxStaticText( this, wxID_ANY, _("0.1 degree"), wxDefaultPosition, wxDefaultSize, 0 );
@@ -100,6 +107,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
	fgUpperRightGridSizer->Add( m_ThicknessLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
	fgUpperRightGridSizer->Add( m_ThicknessLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
	
	
	m_ThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_ThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_ThicknessCtrl->SetMaxLength( 0 ); 
	fgUpperRightGridSizer->Add( m_ThicknessCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
	fgUpperRightGridSizer->Add( m_ThicknessCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
	
	
	m_ThicknessTextUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
	m_ThicknessTextUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
@@ -111,6 +119,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
	fgUpperRightGridSizer->Add( m_DefaultThicknessLabel, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
	fgUpperRightGridSizer->Add( m_DefaultThicknessLabel, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
	
	
	m_DefaultThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_DefaultThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_DefaultThicknessCtrl->SetMaxLength( 0 ); 
	fgUpperRightGridSizer->Add( m_DefaultThicknessCtrl, 0, wxALL|wxEXPAND, 5 );
	fgUpperRightGridSizer->Add( m_DefaultThicknessCtrl, 0, wxALL|wxEXPAND, 5 );
	
	
	m_DefaulThicknessTextUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
	m_DefaulThicknessTextUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
@@ -130,12 +139,8 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
	m_LayerLabel->Wrap( -1 );
	m_LayerLabel->Wrap( -1 );
	fgLowerRightSizer->Add( m_LayerLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
	fgLowerRightSizer->Add( m_LayerLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
	
	
	wxArrayString m_LayerSelectionCtrlChoices;
	m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); 
	m_LayerSelectionCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_LayerSelectionCtrlChoices, 0 );
	fgLowerRightSizer->Add( m_LayerSelectionCtrl, 0, wxALL, 5 );
	m_LayerSelectionCtrl->SetSelection( 0 );
	m_LayerSelectionCtrl->SetToolTip( _("Select the layer on which text should lay.") );
	
	fgLowerRightSizer->Add( m_LayerSelectionCtrl, 0, wxEXPAND|wxALL, 5 );
	
	
	
	
	bUpperRightSizer->Add( fgLowerRightSizer, 1, wxEXPAND, 5 );
	bUpperRightSizer->Add( fgLowerRightSizer, 1, wxEXPAND, 5 );
Loading