Commit 197ace9e authored by jean-pierre charras's avatar jean-pierre charras

Modedit: add dialog to edit footprint body items. Fix also minor issues about...

Modedit: add dialog to edit footprint body items. Fix also minor issues about footprint body items edition.
parent 1393e5c3
......@@ -52,6 +52,7 @@ set(PCBNEW_DIALOGS
dialogs/dialog_graphic_items_options_base.cpp
dialogs/dialog_graphic_item_properties.cpp
dialogs/dialog_graphic_item_properties_base.cpp
dialogs/dialog_graphic_item_properties_for_Modedit.cpp
dialogs/dialog_global_deletion.cpp
dialogs/dialog_global_deletion_base.cpp
dialogs/dialog_layers_setup.cpp
......
......@@ -24,20 +24,17 @@
#include <dialog_graphic_item_properties_base.h>
///////////////////////////////////////////////////////////////////////////
class DialogGraphicItemProperties: public DialogGraphicItemProperties_base
class DIALOG_GRAPHIC_ITEM_PROPERTIES: public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE
{
private:
PCB_EDIT_FRAME* m_Parent;
PCB_EDIT_FRAME* m_parent;
wxDC* m_DC;
DRAWSEGMENT* m_Item;
BOARD_DESIGN_SETTINGS m_BrdSettings;
BOARD_DESIGN_SETTINGS m_brdSettings;
public:
DialogGraphicItemProperties( PCB_EDIT_FRAME* aParent, DRAWSEGMENT * aItem, wxDC * aDC);
~DialogGraphicItemProperties() {};
DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_EDIT_FRAME* aParent, DRAWSEGMENT * aItem, wxDC * aDC);
~DIALOG_GRAPHIC_ITEM_PROPERTIES() {};
private:
void initDlg( );
......@@ -46,14 +43,14 @@ private:
void OnLayerChoice( wxCommandEvent& event );
};
DialogGraphicItemProperties::DialogGraphicItemProperties( PCB_EDIT_FRAME* aParent,
DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_EDIT_FRAME* aParent,
DRAWSEGMENT * aItem, wxDC * aDC):
DialogGraphicItemProperties_base( aParent )
DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( aParent )
{
m_Parent = aParent;
m_parent = aParent;
m_DC = aDC;
m_Item = aItem;
m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings();
m_brdSettings = m_parent->GetDesignSettings();
initDlg();
Layout();
GetSizer()->SetSizeHints( this );
......@@ -72,20 +69,41 @@ void PCB_EDIT_FRAME::InstallGraphicItemPropertiesDialog(DRAWSEGMENT * aItem, wxD
}
m_canvas->SetIgnoreMouseEvents( true );
DialogGraphicItemProperties* dialog = new DialogGraphicItemProperties( this, aItem, aDC );
dialog->ShowModal(); dialog->Destroy();
DIALOG_GRAPHIC_ITEM_PROPERTIES* dialog = new DIALOG_GRAPHIC_ITEM_PROPERTIES( this, aItem, aDC );
dialog->ShowModal();
dialog->Destroy();
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
}
/**************************************************************************/
void DialogGraphicItemProperties::initDlg( )
void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( )
/**************************************************************************/
/* Initialize messages and values in text control,
* according to the item parameters values
*/
{
SetFocus();
m_StandardButtonsSizerOK->SetDefault();
// Set unit symbol
wxStaticText * texts_unit[] =
{
m_StartPointXUnit,
m_StartPointYUnit,
m_EndPointXUnit,
m_EndPointYUnit,
m_ThicknessTextUnit,
m_DefaulThicknessTextUnit,
NULL
};
for( int ii = 0; ; ii++ )
{
if( texts_unit[ii] == NULL )
break;
texts_unit[ii]->SetLabel( GetAbbreviatedUnitsLabel() );
}
wxString msg;
......@@ -93,19 +111,20 @@ void DialogGraphicItemProperties::initDlg( )
switch ( m_Item->GetShape() )
{
case S_CIRCLE:
m_Start_Center_XText->SetLabel(_("Center X"));
m_Start_Center_YText->SetLabel(_("Center Y"));
m_EndX_Radius_Text->SetLabel(_("Point X"));
m_EndY_Text->SetLabel(_("Point Y"));
m_StartPointXLabel->SetLabel(_("Center X"));
m_StartPointYLabel->SetLabel(_("Center Y"));
m_EndPointXLabel->SetLabel(_("Point X"));
m_EndPointYLabel->SetLabel(_("Point Y"));
m_Angle_Text->Show(false);
m_Angle_Ctrl->Show(false);
m_AngleUnit->Show(false);
break;
case S_ARC:
m_Start_Center_XText->SetLabel(_("Center X"));
m_Start_Center_YText->SetLabel(_("Center Y"));
m_EndX_Radius_Text->SetLabel(_("Start Point X"));
m_EndY_Text->SetLabel(_("Start Point Y"));
m_StartPointXLabel->SetLabel(_("Center X"));
m_StartPointYLabel->SetLabel(_("Center Y"));
m_EndPointXLabel->SetLabel(_("Start Point X"));
m_EndPointYLabel->SetLabel(_("Start Point Y"));
msg << m_Item->GetAngle();
m_Angle_Ctrl->SetValue(msg);
break;
......@@ -113,45 +132,38 @@ void DialogGraphicItemProperties::initDlg( )
default:
m_Angle_Text->Show(false);
m_Angle_Ctrl->Show(false);
m_AngleUnit->Show(false);
break;
}
AddUnitSymbol( *m_Start_Center_XText );
PutValueInLocalUnits( *m_Center_StartXCtrl, m_Item->GetStart().x,
m_Parent->GetInternalUnits() );
m_parent->GetInternalUnits() );
AddUnitSymbol( *m_Start_Center_YText );
PutValueInLocalUnits( *m_Center_StartYCtrl, m_Item->GetStart().y,
m_Parent->GetInternalUnits() );
m_parent->GetInternalUnits() );
AddUnitSymbol( *m_EndX_Radius_Text );
PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_Item->GetEnd().x,
m_Parent->GetInternalUnits() );
m_parent->GetInternalUnits() );
AddUnitSymbol( *m_EndY_Text );
PutValueInLocalUnits( *m_EndY_Ctrl, m_Item->GetEnd().y,
m_Parent->GetInternalUnits() );
m_parent->GetInternalUnits() );
AddUnitSymbol( *m_ItemThicknessText );
PutValueInLocalUnits( *m_ThicknessCtrl, m_Item->GetWidth(),
m_Parent->GetInternalUnits() );
AddUnitSymbol( *m_DefaultThicknessText );
m_parent->GetInternalUnits() );
int thickness;
if( m_Item->GetLayer() == EDGE_N )
thickness = m_BrdSettings.m_EdgeSegmentWidth;
thickness = m_brdSettings.m_EdgeSegmentWidth;
else
thickness = m_BrdSettings.m_DrawSegmentWidth;
thickness = m_brdSettings.m_DrawSegmentWidth;
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness,
m_Parent->GetInternalUnits() );
m_parent->GetInternalUnits() );
for( int layer=FIRST_NO_COPPER_LAYER; layer <= LAST_NO_COPPER_LAYER; ++layer )
{
m_LayerSelection->Append( m_Parent->GetBoard()->GetLayerName( layer ) );
m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( layer ) );
}
int layer = m_Item->GetLayer();
......@@ -160,62 +172,62 @@ void DialogGraphicItemProperties::initDlg( )
layer = FIRST_NO_COPPER_LAYER;
if ( layer > LAST_NO_COPPER_LAYER )
layer = LAST_NO_COPPER_LAYER;
m_LayerSelection->SetSelection( layer - FIRST_NO_COPPER_LAYER );
m_LayerSelectionCtrl->SetSelection( layer - FIRST_NO_COPPER_LAYER );
}
/*******************************************************************/
void DialogGraphicItemProperties::OnLayerChoice( wxCommandEvent& event )
void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& event )
/*******************************************************************/
{
int thickness;
if( (m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER) == EDGE_N )
thickness = m_BrdSettings.m_EdgeSegmentWidth;
if( (m_LayerSelectionCtrl->GetCurrentSelection() + FIRST_NO_COPPER_LAYER) == EDGE_N )
thickness = m_brdSettings.m_EdgeSegmentWidth;
else
thickness = m_BrdSettings.m_DrawSegmentWidth;
thickness = m_brdSettings.m_DrawSegmentWidth;
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness,
m_Parent->GetInternalUnits() );
m_parent->GetInternalUnits() );
}
/*******************************************************************/
void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
/*******************************************************************/
/* Copy values in text control to the item parameters
*/
{
m_Parent->SaveCopyInUndoList( m_Item, UR_CHANGED );
m_parent->SaveCopyInUndoList( m_Item, UR_CHANGED );
wxString msg;
if( m_DC )
m_Item->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR );
m_Item->Draw( m_parent->GetCanvas(), m_DC, GR_XOR );
msg = m_Center_StartXCtrl->GetValue();
m_Item->SetStartX( ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() ));
m_Item->SetStartX( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_Center_StartYCtrl->GetValue();
m_Item->SetStartY( ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() ));
m_Item->SetStartY( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_EndX_Radius_Ctrl->GetValue();
m_Item->SetEndX( ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() ));
m_Item->SetEndX( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_EndY_Ctrl->GetValue();
m_Item->SetEndY( ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() ));
m_Item->SetEndY( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_ThicknessCtrl->GetValue();
m_Item->SetWidth( ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() ));
m_Item->SetWidth( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_DefaultThicknessCtrl->GetValue();
int thickness = ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() );
int thickness = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() );
m_Item->SetLayer( m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER);
m_Item->SetLayer( m_LayerSelectionCtrl->GetCurrentSelection() + FIRST_NO_COPPER_LAYER);
if( m_Item->GetLayer() == EDGE_N )
m_BrdSettings.m_EdgeSegmentWidth = thickness;
m_brdSettings.m_EdgeSegmentWidth = thickness;
else
m_BrdSettings.m_DrawSegmentWidth = thickness;
m_brdSettings.m_DrawSegmentWidth = thickness;
if( m_Item->GetShape() == S_ARC )
{
......@@ -225,19 +237,19 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
m_Item->SetAngle( angle );
}
m_Parent->OnModify();
m_parent->OnModify();
if( m_DC )
m_Item->Draw( m_Parent->GetCanvas(), m_DC, GR_OR );
m_Item->Draw( m_parent->GetCanvas(), m_DC, GR_OR );
m_Item->DisplayInfo( m_Parent );
m_Item->DisplayInfo( m_parent );
m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings );
m_parent->SetDesignSettings( m_brdSettings );
Close( true );
}
void DialogGraphicItemProperties::OnCancelClick( wxCommandEvent& event )
void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnCancelClick( wxCommandEvent& event )
{
event.Skip();
}
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_graphic_item_properties_base.h"
///////////////////////////////////////////////////////////////////////////
DialogGraphicItemProperties_base::DialogGraphicItemProperties_base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL );
m_Start_Center_XText = new wxStaticText( this, wxID_ANY, wxT("Start Position X"), wxDefaultPosition, wxDefaultSize, 0 );
m_Start_Center_XText->Wrap( -1 );
bLeftSizer->Add( m_Start_Center_XText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_Center_StartXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bLeftSizer->Add( m_Center_StartXCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Start_Center_YText = new wxStaticText( this, wxID_ANY, wxT("Start Position Y"), wxDefaultPosition, wxDefaultSize, 0 );
m_Start_Center_YText->Wrap( -1 );
bLeftSizer->Add( m_Start_Center_YText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_Center_StartYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bLeftSizer->Add( m_Center_StartYCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_EndX_Radius_Text = new wxStaticText( this, wxID_ANY, wxT("End Position X"), wxDefaultPosition, wxDefaultSize, 0 );
m_EndX_Radius_Text->Wrap( -1 );
bLeftSizer->Add( m_EndX_Radius_Text, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_EndX_Radius_Ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bLeftSizer->Add( m_EndX_Radius_Ctrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_EndY_Text = new wxStaticText( this, wxID_ANY, wxT("End Position Y"), wxDefaultPosition, wxDefaultSize, 0 );
m_EndY_Text->Wrap( -1 );
bLeftSizer->Add( m_EndY_Text, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_EndY_Ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bLeftSizer->Add( m_EndY_Ctrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_Angle_Text = new wxStaticText( this, wxID_ANY, wxT("Arc Angle (0.1 degree)"), wxDefaultPosition, wxDefaultSize, 0 );
m_Angle_Text->Wrap( -1 );
bLeftSizer->Add( m_Angle_Text, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_Angle_Ctrl = new wxTextCtrl( this, wxID_ANGLE_CTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bLeftSizer->Add( m_Angle_Ctrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bMiddleSizer;
bMiddleSizer = new wxBoxSizer( wxVERTICAL );
m_ItemThicknessText = new wxStaticText( this, wxID_ANY, wxT("Item Thickness"), wxDefaultPosition, wxDefaultSize, 0 );
m_ItemThicknessText->Wrap( -1 );
bMiddleSizer->Add( m_ItemThicknessText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ThicknessCtrl->SetToolTip( wxT("Thickness of this item") );
bMiddleSizer->Add( m_ThicknessCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_DefaultThicknessText = new wxStaticText( this, wxID_ANY, wxT("Default Thickness"), wxDefaultPosition, wxDefaultSize, 0 );
m_DefaultThicknessText->Wrap( -1 );
bMiddleSizer->Add( m_DefaultThicknessText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_DefaultThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_DefaultThicknessCtrl->SetToolTip( wxT("Default value for thickness when creating a new graphic item") );
bMiddleSizer->Add( m_DefaultThicknessCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMiddleSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_LayerText = new wxStaticText( this, wxID_ANY, wxT("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayerText->Wrap( -1 );
bMiddleSizer->Add( m_LayerText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxArrayString m_LayerSelectionChoices;
m_LayerSelection = new wxChoice( this, wxID_LAYER_SELECTION, wxDefaultPosition, wxDefaultSize, m_LayerSelectionChoices, 0 );
m_LayerSelection->SetSelection( 0 );
bMiddleSizer->Add( m_LayerSelection, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( bMiddleSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
m_buttonOK = new wxButton( this, wxID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonOK->SetDefault();
bRightSizer->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonCANCEL = new wxButton( this, wxID_CANCEL, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonCANCEL, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bMainSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
m_LayerSelection->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DialogGraphicItemProperties_base::OnLayerChoice ), NULL, this );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGraphicItemProperties_base::OnOkClick ), NULL, this );
m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGraphicItemProperties_base::OnCancelClick ), NULL, this );
}
DialogGraphicItemProperties_base::~DialogGraphicItemProperties_base()
{
// Disconnect Events
m_LayerSelection->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DialogGraphicItemProperties_base::OnLayerChoice ), NULL, this );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGraphicItemProperties_base::OnOkClick ), NULL, this );
m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGraphicItemProperties_base::OnCancelClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_graphic_item_properties_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxFlexGridSizer* fgUpperLeftGridSizer;
fgUpperLeftGridSizer = new wxFlexGridSizer( 4, 3, 0, 0 );
fgUpperLeftGridSizer->AddGrowableCol( 1 );
fgUpperLeftGridSizer->SetFlexibleDirection( wxBOTH );
fgUpperLeftGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_StartPointXLabel = new wxStaticText( this, wxID_ANY, _("Start point X"), wxDefaultPosition, wxDefaultSize, 0 );
m_StartPointXLabel->Wrap( -1 );
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 );
fgUpperLeftGridSizer->Add( m_Center_StartXCtrl, 0, wxEXPAND|wxALL, 5 );
m_StartPointXUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_StartPointXUnit->Wrap( -1 );
fgUpperLeftGridSizer->Add( m_StartPointXUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_StartPointYLabel = new wxStaticText( this, wxID_ANY, _("Start point Y"), wxDefaultPosition, wxDefaultSize, 0 );
m_StartPointYLabel->Wrap( -1 );
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 );
fgUpperLeftGridSizer->Add( m_Center_StartYCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_StartPointYUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_StartPointYUnit->Wrap( -1 );
fgUpperLeftGridSizer->Add( m_StartPointYUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_EndPointXLabel = new wxStaticText( this, wxID_ANY, _("End point X"), wxDefaultPosition, wxDefaultSize, 0 );
m_EndPointXLabel->Wrap( -1 );
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 );
fgUpperLeftGridSizer->Add( m_EndX_Radius_Ctrl, 0, wxEXPAND|wxALL, 5 );
m_EndPointXUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_EndPointXUnit->Wrap( -1 );
fgUpperLeftGridSizer->Add( m_EndPointXUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_EndPointYLabel = new wxStaticText( this, wxID_ANY, _("End point Y"), wxDefaultPosition, wxDefaultSize, 0 );
m_EndPointYLabel->Wrap( -1 );
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 );
fgUpperLeftGridSizer->Add( m_EndY_Ctrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_EndPointYUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_EndPointYUnit->Wrap( -1 );
fgUpperLeftGridSizer->Add( m_EndPointYUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
bUpperSizer->Add( fgUpperLeftGridSizer, 1, wxEXPAND, 5 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
bUpperSizer->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bUpperRightSizer;
bUpperRightSizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgUpperRightGridSizer;
fgUpperRightGridSizer = new wxFlexGridSizer( 3, 3, 0, 0 );
fgUpperRightGridSizer->AddGrowableCol( 1 );
fgUpperRightGridSizer->SetFlexibleDirection( wxBOTH );
fgUpperRightGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_Angle_Text = new wxStaticText( this, wxID_ANY, _("Arc angle:"), wxDefaultPosition, wxDefaultSize, 0 );
m_Angle_Text->Wrap( -1 );
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 );
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->Wrap( -1 );
fgUpperRightGridSizer->Add( m_AngleUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_ThicknessLabel = new wxStaticText( this, wxID_ANY, _("Item thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThicknessLabel->Wrap( -1 );
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 );
fgUpperRightGridSizer->Add( m_ThicknessCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_ThicknessTextUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThicknessTextUnit->Wrap( -1 );
fgUpperRightGridSizer->Add( m_ThicknessTextUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_DefaultThicknessLabel = new wxStaticText( this, wxID_ANY, _("Default thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_DefaultThicknessLabel->Wrap( -1 );
fgUpperRightGridSizer->Add( m_DefaultThicknessLabel, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
m_DefaultThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgUpperRightGridSizer->Add( m_DefaultThicknessCtrl, 0, wxALL|wxEXPAND, 5 );
m_DefaulThicknessTextUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_DefaulThicknessTextUnit->Wrap( -1 );
fgUpperRightGridSizer->Add( m_DefaulThicknessTextUnit, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
bUpperRightSizer->Add( fgUpperRightGridSizer, 0, wxEXPAND, 5 );
wxFlexGridSizer* fgLowerRightSizer;
fgLowerRightSizer = new wxFlexGridSizer( 1, 2, 0, 0 );
fgLowerRightSizer->AddGrowableCol( 1 );
fgLowerRightSizer->SetFlexibleDirection( wxBOTH );
fgLowerRightSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_LayerLabel = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayerLabel->Wrap( -1 );
fgLowerRightSizer->Add( m_LayerLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|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.") );
fgLowerRightSizer->Add( m_LayerSelectionCtrl, 0, wxEXPAND|wxALL, 5 );
bUpperRightSizer->Add( fgLowerRightSizer, 1, wxEXPAND, 5 );
bUpperSizer->Add( bUpperRightSizer, 1, wxEXPAND, 5 );
bMainSizer->Add( bUpperSizer, 1, wxALL|wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_StandardButtonsSizer = new wxStdDialogButtonSizer();
m_StandardButtonsSizerOK = new wxButton( this, wxID_OK );
m_StandardButtonsSizer->AddButton( m_StandardButtonsSizerOK );
m_StandardButtonsSizerCancel = new wxButton( this, wxID_CANCEL );
m_StandardButtonsSizer->AddButton( m_StandardButtonsSizerCancel );
m_StandardButtonsSizer->Realize();
bMainSizer->Add( m_StandardButtonsSizer, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5 );
this->SetSizer( bMainSizer );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnClose ) );
m_StandardButtonsSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnCancelClick ), NULL, this );
m_StandardButtonsSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnOkClick ), NULL, this );
}
DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnClose ) );
m_StandardButtonsSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnCancelClick ), NULL, this );
m_StandardButtonsSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnOkClick ), NULL, this );
}
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_graphic_item_properties_base__
#define __dialog_graphic_item_properties_base__
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/choice.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DialogGraphicItemProperties_base
///////////////////////////////////////////////////////////////////////////////
class DialogGraphicItemProperties_base : public wxDialog
{
private:
protected:
enum
{
wxID_ANGLE_CTRL = 1000,
wxID_LAYER_SELECTION,
};
wxStaticText* m_Start_Center_XText;
wxTextCtrl* m_Center_StartXCtrl;
wxStaticText* m_Start_Center_YText;
wxTextCtrl* m_Center_StartYCtrl;
wxStaticText* m_EndX_Radius_Text;
wxTextCtrl* m_EndX_Radius_Ctrl;
wxStaticText* m_EndY_Text;
wxTextCtrl* m_EndY_Ctrl;
wxStaticText* m_Angle_Text;
wxTextCtrl* m_Angle_Ctrl;
wxStaticText* m_ItemThicknessText;
wxTextCtrl* m_ThicknessCtrl;
wxStaticText* m_DefaultThicknessText;
wxTextCtrl* m_DefaultThicknessCtrl;
wxStaticLine* m_staticline1;
wxStaticText* m_LayerText;
wxChoice* m_LayerSelection;
wxButton* m_buttonOK;
wxButton* m_buttonCANCEL;
// Virtual event handlers, overide them in your derived class
virtual void OnLayerChoice( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
public:
DialogGraphicItemProperties_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Graphic item properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 399,247 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DialogGraphicItemProperties_base();
};
#endif //__dialog_graphic_item_properties_base__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE_H__
#define __DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/choice.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_StartPointXLabel;
wxTextCtrl* m_Center_StartXCtrl;
wxStaticText* m_StartPointXUnit;
wxStaticText* m_StartPointYLabel;
wxTextCtrl* m_Center_StartYCtrl;
wxStaticText* m_StartPointYUnit;
wxStaticText* m_EndPointXLabel;
wxTextCtrl* m_EndX_Radius_Ctrl;
wxStaticText* m_EndPointXUnit;
wxStaticText* m_EndPointYLabel;
wxTextCtrl* m_EndY_Ctrl;
wxStaticText* m_EndPointYUnit;
wxStaticLine* m_staticline2;
wxStaticText* m_Angle_Text;
wxTextCtrl* m_Angle_Ctrl;
wxStaticText* m_AngleUnit;
wxStaticText* m_ThicknessLabel;
wxTextCtrl* m_ThicknessCtrl;
wxStaticText* m_ThicknessTextUnit;
wxStaticText* m_DefaultThicknessLabel;
wxTextCtrl* m_DefaultThicknessCtrl;
wxStaticText* m_DefaulThicknessTextUnit;
wxStaticText* m_LayerLabel;
wxChoice* m_LayerSelectionCtrl;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_StandardButtonsSizer;
wxButton* m_StandardButtonsSizerOK;
wxButton* m_StandardButtonsSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Graphic Item Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 537,215 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE();
};
#endif //__DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE_H__
/**
@file dialog_graphic_item_properties_for_Modedit.cpp
*/
/* Edit parameters values of graphic items in a footprint body:
* Lines
* Circles
* Arcs
* used as graphic elements found on non copper layers in boards
* Footprint texts are not always graphic items and are not handled here
*/
#include <fctsys.h>
#include <macros.h>
#include <confirm.h>
#include <class_drawpanel.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <class_board_design_settings.h>
#include <module_editor_frame.h>
#include <class_board.h>
#include <class_module.h>
#include <class_edge_mod.h>
#include <dialog_graphic_item_properties_base.h>
class DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES: public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE
{
private:
FOOTPRINT_EDIT_FRAME* m_parent;
EDGE_MODULE* m_item;
BOARD_DESIGN_SETTINGS m_brdSettings;
MODULE * m_module;
std::vector<int> m_layerId; // the layer Id with the same order as m_LayerSelectionCtrl widget
public:
DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES( FOOTPRINT_EDIT_FRAME* aParent,
EDGE_MODULE * aItem);
~DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES() {};
private:
void initDlg( );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
void OnLayerChoice( wxCommandEvent& event );
};
DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES(
FOOTPRINT_EDIT_FRAME* aParent,
EDGE_MODULE * aItem ):
DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( aParent )
{
m_parent = aParent;
m_item = aItem;
m_brdSettings = m_parent->GetDesignSettings();
m_module = m_parent->GetBoard()->m_Modules;
initDlg();
Layout();
GetSizer()->SetSizeHints( this );
Centre();
}
/*
* Dialog to edit a graphic item of a footprint body.
*/
void FOOTPRINT_EDIT_FRAME::InstallFootprintBodyItemPropertiesDlg(EDGE_MODULE * aItem)
{
if ( aItem == NULL )
{
wxMessageBox( wxT("InstallGraphicItemPropertiesDialog() error: NULL item"));
return;
}
m_canvas->SetIgnoreMouseEvents( true );
DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES* dialog =
new DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES( this, aItem );
dialog->ShowModal();
dialog->Destroy();
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
}
void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg()
/* Initialize messages and values in text control,
* according to the item parameters values
*/
{
SetFocus();
m_StandardButtonsSizerOK->SetDefault();
// Set unit symbol
wxStaticText * texts_unit[] =
{
m_StartPointXUnit,
m_StartPointYUnit,
m_EndPointXUnit,
m_EndPointYUnit,
m_ThicknessTextUnit,
m_DefaulThicknessTextUnit,
NULL
};
for( int ii = 0; ; ii++ )
{
if( texts_unit[ii] == NULL )
break;
texts_unit[ii]->SetLabel( GetAbbreviatedUnitsLabel() );
}
wxString msg;
// Change texts according to the segment shape:
switch ( m_item->GetShape() )
{
case S_CIRCLE:
m_StartPointXLabel->SetLabel(_("Center X"));
m_StartPointYLabel->SetLabel(_("Center Y"));
m_EndPointXLabel->SetLabel(_("Point X"));
m_EndPointYLabel->SetLabel(_("Point Y"));
m_Angle_Text->Show(false);
m_Angle_Ctrl->Show(false);
m_AngleUnit->Show(false);
break;
case S_ARC:
m_StartPointXLabel->SetLabel(_("Center X"));
m_StartPointYLabel->SetLabel(_("Center Y"));
m_EndPointXLabel->SetLabel(_("Start Point X"));
m_EndPointYLabel->SetLabel(_("Start Point Y"));
msg << m_item->GetAngle();
m_Angle_Ctrl->SetValue(msg);
break;
default:
m_Angle_Text->Show(false);
m_Angle_Ctrl->Show(false);
m_AngleUnit->Show(false);
break;
}
PutValueInLocalUnits( *m_Center_StartXCtrl, m_item->GetStart().x,
m_parent->GetInternalUnits() );
PutValueInLocalUnits( *m_Center_StartYCtrl, m_item->GetStart().y,
m_parent->GetInternalUnits() );
PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_item->GetEnd().x,
m_parent->GetInternalUnits() );
PutValueInLocalUnits( *m_EndY_Ctrl, m_item->GetEnd().y,
m_parent->GetInternalUnits() );
PutValueInLocalUnits( *m_ThicknessCtrl, m_item->GetWidth(),
m_parent->GetInternalUnits() );
PutValueInLocalUnits( *m_DefaultThicknessCtrl, m_brdSettings.m_ModuleSegmentWidth,
m_parent->GetInternalUnits() );
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( int layer = FIRST_NO_COPPER_LAYER; layer <= LAST_NO_COPPER_LAYER; ++layer )
{
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;
}
}
}
/*******************************************************************/
void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& event )
/*******************************************************************/
{
}
/*******************************************************************/
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;
}
int layer = m_layerId[idx];
if( IsValidCopperLayerIndex( layer ) )
{
/* an edge is put on a copper layer, and it is very dangerous. a
*confirmation is requested */
if( !IsOK( NULL,
_( "The graphic item will be on a copper layer. This is very dangerous. Are you sure?" ) ) )
return;
}
m_parent->SaveCopyInUndoList( m_module, UR_MODEDIT );
m_module->m_LastEdit_Time = time( NULL );
wxString msg;
msg = m_Center_StartXCtrl->GetValue();
m_item->SetStartX( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_Center_StartYCtrl->GetValue();
m_item->SetStartY( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_EndX_Radius_Ctrl->GetValue();
m_item->SetEndX( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_EndY_Ctrl->GetValue();
m_item->SetEndY( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_ThicknessCtrl->GetValue();
m_item->SetWidth( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_DefaultThicknessCtrl->GetValue();
int thickness = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() );
m_brdSettings.m_ModuleSegmentWidth = thickness;
m_parent->SetDesignSettings( m_brdSettings );
m_item->SetLayer( layer );
if( m_item->GetShape() == S_ARC )
{
double angle;
m_Angle_Ctrl->GetValue().ToDouble( &angle );
NORMALIZE_ANGLE_360(angle);
m_item->SetAngle( angle );
}
m_parent->OnModify();
m_item->DisplayInfo( m_parent );
Close( true );
}
......@@ -39,8 +39,8 @@ void FOOTPRINT_EDIT_FRAME::InstallOptionsFrame( const wxPoint& pos )
DIALOG_GRAPHIC_ITEMS_OPTIONS::DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* parent )
: DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE( parent )
{
m_Parent = parent;
m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings();
m_parent = parent;
m_brdSettings = m_parent->GetDesignSettings();
initValues( );
m_sdbSizer1OK->SetDefault();
......@@ -61,45 +61,45 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues()
/* Drawings width */
AddUnitSymbol( *m_GraphicSegmWidthTitle );
PutValueInLocalUnits( *m_OptPcbSegmWidth,
m_BrdSettings.m_DrawSegmentWidth,
m_brdSettings.m_DrawSegmentWidth,
PCB_INTERNAL_UNIT );
/* Edges width */
AddUnitSymbol( *m_BoardEdgesWidthTitle );
PutValueInLocalUnits( *m_OptPcbEdgesWidth,
m_BrdSettings.m_EdgeSegmentWidth,
m_brdSettings.m_EdgeSegmentWidth,
PCB_INTERNAL_UNIT );
/* Pcb Textes (Size & Width) */
AddUnitSymbol( *m_CopperTextWidthTitle );
PutValueInLocalUnits( *m_OptPcbTextWidth,
m_BrdSettings.m_PcbTextWidth, PCB_INTERNAL_UNIT );
m_brdSettings.m_PcbTextWidth, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_TextSizeVTitle );
PutValueInLocalUnits( *m_OptPcbTextVSize,
m_BrdSettings.m_PcbTextSize.y, PCB_INTERNAL_UNIT );
m_brdSettings.m_PcbTextSize.y, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_TextSizeHTitle );
PutValueInLocalUnits( *m_OptPcbTextHSize,
m_BrdSettings.m_PcbTextSize.x, PCB_INTERNAL_UNIT );
m_brdSettings.m_PcbTextSize.x, PCB_INTERNAL_UNIT );
/* Modules: Edges width */
AddUnitSymbol( *m_EdgeModWidthTitle );
PutValueInLocalUnits( *m_OptModuleEdgesWidth,
m_BrdSettings.m_ModuleSegmentWidth, PCB_INTERNAL_UNIT );
m_brdSettings.m_ModuleSegmentWidth, PCB_INTERNAL_UNIT );
/* Modules: Texts: Size & width */
AddUnitSymbol( *m_TextModWidthTitle );
PutValueInLocalUnits( *m_OptModuleTextWidth,
m_BrdSettings.m_ModuleTextWidth, PCB_INTERNAL_UNIT );
m_brdSettings.m_ModuleTextWidth, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_TextModSizeVTitle );
PutValueInLocalUnits( *m_OptModuleTextVSize,
m_BrdSettings.m_ModuleTextSize.y, PCB_INTERNAL_UNIT );
m_brdSettings.m_ModuleTextSize.y, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_TextModSizeHTitle );
PutValueInLocalUnits( *m_OptModuleTextHSize,
m_BrdSettings.m_ModuleTextSize.x, PCB_INTERNAL_UNIT );
m_brdSettings.m_ModuleTextSize.x, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_DefaultPenSizeTitle );
PutValueInLocalUnits( *m_DefaultPenSizeCtrl,
......@@ -109,26 +109,26 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues()
void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event )
{
m_BrdSettings.m_DrawSegmentWidth =
m_brdSettings.m_DrawSegmentWidth =
ReturnValueFromTextCtrl( *m_OptPcbSegmWidth, PCB_INTERNAL_UNIT );
m_BrdSettings.m_EdgeSegmentWidth =
m_brdSettings.m_EdgeSegmentWidth =
ReturnValueFromTextCtrl( *m_OptPcbEdgesWidth, PCB_INTERNAL_UNIT );
m_BrdSettings.m_PcbTextWidth =
m_brdSettings.m_PcbTextWidth =
ReturnValueFromTextCtrl( *m_OptPcbTextWidth, PCB_INTERNAL_UNIT );
m_BrdSettings.m_PcbTextSize.y =
m_brdSettings.m_PcbTextSize.y =
ReturnValueFromTextCtrl( *m_OptPcbTextVSize, PCB_INTERNAL_UNIT );
m_BrdSettings.m_PcbTextSize.x =
m_brdSettings.m_PcbTextSize.x =
ReturnValueFromTextCtrl( *m_OptPcbTextHSize, PCB_INTERNAL_UNIT );
m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings );
m_parent->GetBoard()->SetDesignSettings( m_brdSettings );
m_BrdSettings.m_ModuleSegmentWidth =
m_brdSettings.m_ModuleSegmentWidth =
ReturnValueFromTextCtrl( *m_OptModuleEdgesWidth, PCB_INTERNAL_UNIT );
m_BrdSettings.m_ModuleTextWidth =
m_brdSettings.m_ModuleTextWidth =
ReturnValueFromTextCtrl( *m_OptModuleTextWidth, PCB_INTERNAL_UNIT );
m_BrdSettings.m_ModuleTextSize.y =
m_brdSettings.m_ModuleTextSize.y =
ReturnValueFromTextCtrl( *m_OptModuleTextVSize, PCB_INTERNAL_UNIT );
m_BrdSettings.m_ModuleTextSize.x =
m_brdSettings.m_ModuleTextSize.x =
ReturnValueFromTextCtrl( *m_OptModuleTextHSize, PCB_INTERNAL_UNIT );
g_DrawDefaultLineThickness =
......@@ -137,6 +137,8 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event )
if( g_DrawDefaultLineThickness < 0 )
g_DrawDefaultLineThickness = 0;
m_parent->SetDesignSettings( m_brdSettings );
EndModal( wxID_OK );
}
......
......@@ -37,9 +37,9 @@
class DIALOG_GRAPHIC_ITEMS_OPTIONS: public DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE
{
public:
BOARD_DESIGN_SETTINGS m_BrdSettings;
PCB_BASE_FRAME * m_Parent;
private:
BOARD_DESIGN_SETTINGS m_brdSettings;
PCB_BASE_FRAME * m_parent;
public:
DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* parent );
......
......@@ -195,7 +195,7 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
new_layer = aEdge->GetLayer();
// Ask for the new layer
new_layer = SelectLayer( new_layer, FIRST_COPPER_LAYER, LAST_NO_COPPER_LAYER );
new_layer = SelectLayer( new_layer, FIRST_COPPER_LAYER, ECO2_N );
if( new_layer < 0 )
return;
......@@ -205,7 +205,7 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
/* an edge is put on a copper layer, and it is very dangerous. a
*confirmation is requested */
if( !IsOK( this,
_( "The graphic item will be on a copper layer. It is very dangerous. Are you sure?" ) ) )
_( "The graphic item will be on a copper layer. This is very dangerous. Are you sure?" ) ) )
return;
}
......
......@@ -179,12 +179,12 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
case ID_POPUP_PCB_EDIT_EDGE:
case ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE:
case ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE:
case ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE:
case ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE:
case ID_POPUP_PCB_ENTER_EDGE_WIDTH:
case ID_POPUP_MODEDIT_EDIT_BODY_ITEM:
case ID_POPUP_MODEDIT_EDIT_WIDTH_CURRENT_EDGE:
case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE:
case ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE:
case ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE:
case ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH:
case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_PLACE_BLOCK:
case ID_POPUP_ZOOM_BLOCK:
......@@ -591,7 +591,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_ENTER_EDGE_WIDTH:
case ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH:
{
EDGE_MODULE* edge = NULL;
if( GetScreen()->GetCurItem()
......@@ -608,25 +608,31 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
break;
case ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE:
case ID_POPUP_MODEDIT_EDIT_BODY_ITEM :
m_canvas->MoveCursorToCrossHair();
InstallFootprintBodyItemPropertiesDlg( (EDGE_MODULE*) GetScreen()->GetCurItem() );
m_canvas->Refresh();
break;
case ID_POPUP_MODEDIT_EDIT_WIDTH_CURRENT_EDGE:
m_canvas->MoveCursorToCrossHair();
Edit_Edge_Width( (EDGE_MODULE*) GetScreen()->GetCurItem() );
m_canvas->Refresh();
break;
case ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE:
case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE:
m_canvas->MoveCursorToCrossHair();
Edit_Edge_Width( NULL );
m_canvas->Refresh();
break;
case ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE:
case ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE:
m_canvas->MoveCursorToCrossHair();
Edit_Edge_Layer( (EDGE_MODULE*) GetScreen()->GetCurItem() );
m_canvas->Refresh();
break;
case ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE:
case ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE:
m_canvas->MoveCursorToCrossHair();
Edit_Edge_Layer( NULL );
m_canvas->Refresh();
......
......@@ -337,15 +337,17 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
KiBitmap( apply_xpm ) );
wxMenu* edit_mnu = new wxMenu;
AddMenuItem( PopMenu, edit_mnu, ID_POPUP_PCB_EDIT_EDGE, _( "Edit" ), KiBitmap( edit_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE,
_( "Edit Width (Current)" ), KiBitmap( width_segment_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE,
_( "Edit Width (All)" ), KiBitmap( width_segment_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE,
_( "Edit Layer (Current)" ), KiBitmap( select_layer_pair_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE,
_( "Edit Layer (All)" ), KiBitmap( select_layer_pair_xpm ) );
AddMenuItem( PopMenu, edit_mnu, ID_POPUP_MODEDIT_EDIT_EDGE, _( "Edit" ), KiBitmap( edit_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_MODEDIT_EDIT_BODY_ITEM,
_( "Edit Body Item" ), KiBitmap( options_segment_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_MODEDIT_EDIT_WIDTH_CURRENT_EDGE,
_( "Change Body Item Width (Current)" ), KiBitmap( width_segment_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE,
_( "Change Body Items Width (All)" ), KiBitmap( width_segment_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE,
_( "Change Body Item Layer (Current)" ), KiBitmap( select_layer_pair_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE,
_( "Change Body Items Layer (All)" ), KiBitmap( select_layer_pair_xpm ) );
msg = AddHotkeyName( _("Delete edge" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_EDGE, msg, KiBitmap( delete_xpm ) );
......@@ -360,6 +362,9 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
case PCB_MARKER_T:
case PCB_DIMENSION_T:
case PCB_TARGET_T:
msg.Printf( wxT( "FOOTPRINT_EDIT_FRAME::OnRightClick Error: Unexpected DrawType %d" ),
item->Type() );
DisplayError( this, msg );
break;
case SCREEN_T:
......@@ -383,7 +388,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
( GetToolId() == ID_MODEDIT_CIRCLE_TOOL ) ||
( GetToolId() == ID_MODEDIT_ARC_TOOL ) )
{
AddMenuItem( PopMenu, ID_POPUP_PCB_ENTER_EDGE_WIDTH, _("Set Line Width" ),
AddMenuItem( PopMenu, ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH, _("Set Line Width" ),
KiBitmap( width_segment_xpm ) );
PopMenu->AppendSeparator();
}
......@@ -391,7 +396,9 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
return true;
}
/*
* Called on a mouse left button double click
*/
void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{
BOARD_ITEM* item = GetCurItem();
......@@ -418,7 +425,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break;
case PCB_MODULE_T:
{
{
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) item );
int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->ClearFlags();
......@@ -426,14 +433,20 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
if( ret > 0 )
m_canvas->Refresh();
}
break;
}
break;
case PCB_MODULE_TEXT_T:
InstallTextModOptionsFrame( (TEXTE_MODULE*) item, DC );
m_canvas->MoveCursorToCrossHair();
break;
case PCB_MODULE_EDGE_T :
m_canvas->MoveCursorToCrossHair();
InstallFootprintBodyItemPropertiesDlg( (EDGE_MODULE*) item );
m_canvas->Refresh();
break;
default:
break;
}
......
......@@ -339,6 +339,13 @@ public:
/// Function to place a graphic item type EDGE_MODULE currently moved
void Place_EdgeMod( EDGE_MODULE* drawitem );
/**
* Function InstallFootprintBodyItemPropertiesDlg
* Install a dialog to edit a graphic item of a footprint body.
* @param aItem = a pointer to the graphic item to edit
*/
void InstallFootprintBodyItemPropertiesDlg(EDGE_MODULE * aItem);
/**
* Function DlgGlobalChange_PadSettings
* Function to change pad caracteristics for the given footprint
......
......@@ -105,6 +105,12 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_BODY_ITEM, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
// Module transformations
EVT_MENU( ID_MODEDIT_MODULE_ROTATE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_MIRROR, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
......
......@@ -128,7 +128,6 @@ enum pcbnew_ids
ID_POPUP_PCB_SELECT_CU_LAYER,
ID_POPUP_PCB_SELECT_NO_CU_LAYER,
ID_POPUP_PCB_SELECT_LAYER_PAIR,
ID_POPUP_PCB_EDIT_EDGE,
ID_POPUP_PCB_DELETE_EDGE,
ID_POPUP_PCB_MOVE_EDGE,
ID_POPUP_PCB_PLACE_EDGE,
......@@ -141,11 +140,6 @@ enum pcbnew_ids
ID_POPUP_PCB_LOCK_OFF_NET,
ID_POPUP_PCB_SETFLAGS_TRACK_MNU,
ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE,
ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE,
ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE,
ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE,
ID_POPUP_PCB_ENTER_EDGE_WIDTH,
ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,
ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE,
ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE,
......@@ -294,6 +288,12 @@ enum pcbnew_ids
ID_MODEDIT_PLACE_GRID_COORD,
// ID used in module editor:
ID_POPUP_MODEDIT_EDIT_WIDTH_CURRENT_EDGE,
ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE,
ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE,
ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE,
ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH,
ID_POPUP_MODEDIT_EDIT_EDGE,
ID_MODEDIT_CHECK,
ID_MODEDIT_SELECT_CURRENT_LIB,
ID_MODEDIT_SAVE_LIBMODULE,
......@@ -312,6 +312,7 @@ enum pcbnew_ids
ID_MODEDIT_IMPORT_PART,
ID_MODEDIT_EXPORT_PART,
ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
ID_POPUP_MODEDIT_EDIT_BODY_ITEM,
ID_MODVIEW_LIBWINDOW,
ID_MODVIEW_FOOTPRINT_WINDOW,
......
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