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 ...@@ -52,6 +52,7 @@ set(PCBNEW_DIALOGS
dialogs/dialog_graphic_items_options_base.cpp dialogs/dialog_graphic_items_options_base.cpp
dialogs/dialog_graphic_item_properties.cpp dialogs/dialog_graphic_item_properties.cpp
dialogs/dialog_graphic_item_properties_base.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.cpp
dialogs/dialog_global_deletion_base.cpp dialogs/dialog_global_deletion_base.cpp
dialogs/dialog_layers_setup.cpp dialogs/dialog_layers_setup.cpp
......
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) // C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_graphic_item_properties_base__ #ifndef __DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE_H__
#define __dialog_graphic_item_properties_base__ #define __DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE_H__
#include <wx/string.h> #include <wx/artprov.h>
#include <wx/stattext.h> #include <wx/xrc/xmlres.h>
#include <wx/gdicmn.h> #include <wx/intl.h>
#include <wx/font.h> #include <wx/string.h>
#include <wx/colour.h> #include <wx/stattext.h>
#include <wx/settings.h> #include <wx/gdicmn.h>
#include <wx/textctrl.h> #include <wx/font.h>
#include <wx/sizer.h> #include <wx/colour.h>
#include <wx/statline.h> #include <wx/settings.h>
#include <wx/choice.h> #include <wx/textctrl.h>
#include <wx/button.h> #include <wx/sizer.h>
#include <wx/dialog.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: /// Class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
protected: class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE : public wxDialog
enum {
{ private:
wxID_ANGLE_CTRL = 1000,
wxID_LAYER_SELECTION, protected:
}; wxStaticText* m_StartPointXLabel;
wxTextCtrl* m_Center_StartXCtrl;
wxStaticText* m_Start_Center_XText; wxStaticText* m_StartPointXUnit;
wxTextCtrl* m_Center_StartXCtrl; wxStaticText* m_StartPointYLabel;
wxStaticText* m_Start_Center_YText; wxTextCtrl* m_Center_StartYCtrl;
wxTextCtrl* m_Center_StartYCtrl; wxStaticText* m_StartPointYUnit;
wxStaticText* m_EndX_Radius_Text; wxStaticText* m_EndPointXLabel;
wxTextCtrl* m_EndX_Radius_Ctrl; wxTextCtrl* m_EndX_Radius_Ctrl;
wxStaticText* m_EndY_Text; wxStaticText* m_EndPointXUnit;
wxTextCtrl* m_EndY_Ctrl; wxStaticText* m_EndPointYLabel;
wxStaticText* m_Angle_Text; wxTextCtrl* m_EndY_Ctrl;
wxTextCtrl* m_Angle_Ctrl; wxStaticText* m_EndPointYUnit;
wxStaticText* m_ItemThicknessText; wxStaticLine* m_staticline2;
wxTextCtrl* m_ThicknessCtrl; wxStaticText* m_Angle_Text;
wxStaticText* m_DefaultThicknessText; wxTextCtrl* m_Angle_Ctrl;
wxTextCtrl* m_DefaultThicknessCtrl; wxStaticText* m_AngleUnit;
wxStaticLine* m_staticline1; wxStaticText* m_ThicknessLabel;
wxStaticText* m_LayerText; wxTextCtrl* m_ThicknessCtrl;
wxChoice* m_LayerSelection; wxStaticText* m_ThicknessTextUnit;
wxButton* m_buttonOK; wxStaticText* m_DefaultThicknessLabel;
wxButton* m_buttonCANCEL; wxTextCtrl* m_DefaultThicknessCtrl;
wxStaticText* m_DefaulThicknessTextUnit;
// Virtual event handlers, overide them in your derived class wxStaticText* m_LayerLabel;
virtual void OnLayerChoice( wxCommandEvent& event ){ event.Skip(); } wxChoice* m_LayerSelectionCtrl;
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } wxStaticLine* m_staticline1;
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } wxStdDialogButtonSizer* m_StandardButtonsSizer;
wxButton* m_StandardButtonsSizerOK;
wxButton* m_StandardButtonsSizerCancel;
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 ); // Virtual event handlers, overide them in your derived class
~DialogGraphicItemProperties_base(); virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
}; virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
#endif //__dialog_graphic_item_properties_base__
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 ) ...@@ -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::DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* parent )
: DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE( parent ) : DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE( parent )
{ {
m_Parent = parent; m_parent = parent;
m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings(); m_brdSettings = m_parent->GetDesignSettings();
initValues( ); initValues( );
m_sdbSizer1OK->SetDefault(); m_sdbSizer1OK->SetDefault();
...@@ -61,45 +61,45 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues() ...@@ -61,45 +61,45 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues()
/* Drawings width */ /* Drawings width */
AddUnitSymbol( *m_GraphicSegmWidthTitle ); AddUnitSymbol( *m_GraphicSegmWidthTitle );
PutValueInLocalUnits( *m_OptPcbSegmWidth, PutValueInLocalUnits( *m_OptPcbSegmWidth,
m_BrdSettings.m_DrawSegmentWidth, m_brdSettings.m_DrawSegmentWidth,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
/* Edges width */ /* Edges width */
AddUnitSymbol( *m_BoardEdgesWidthTitle ); AddUnitSymbol( *m_BoardEdgesWidthTitle );
PutValueInLocalUnits( *m_OptPcbEdgesWidth, PutValueInLocalUnits( *m_OptPcbEdgesWidth,
m_BrdSettings.m_EdgeSegmentWidth, m_brdSettings.m_EdgeSegmentWidth,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
/* Pcb Textes (Size & Width) */ /* Pcb Textes (Size & Width) */
AddUnitSymbol( *m_CopperTextWidthTitle ); AddUnitSymbol( *m_CopperTextWidthTitle );
PutValueInLocalUnits( *m_OptPcbTextWidth, PutValueInLocalUnits( *m_OptPcbTextWidth,
m_BrdSettings.m_PcbTextWidth, PCB_INTERNAL_UNIT ); m_brdSettings.m_PcbTextWidth, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_TextSizeVTitle ); AddUnitSymbol( *m_TextSizeVTitle );
PutValueInLocalUnits( *m_OptPcbTextVSize, PutValueInLocalUnits( *m_OptPcbTextVSize,
m_BrdSettings.m_PcbTextSize.y, PCB_INTERNAL_UNIT ); m_brdSettings.m_PcbTextSize.y, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_TextSizeHTitle ); AddUnitSymbol( *m_TextSizeHTitle );
PutValueInLocalUnits( *m_OptPcbTextHSize, PutValueInLocalUnits( *m_OptPcbTextHSize,
m_BrdSettings.m_PcbTextSize.x, PCB_INTERNAL_UNIT ); m_brdSettings.m_PcbTextSize.x, PCB_INTERNAL_UNIT );
/* Modules: Edges width */ /* Modules: Edges width */
AddUnitSymbol( *m_EdgeModWidthTitle ); AddUnitSymbol( *m_EdgeModWidthTitle );
PutValueInLocalUnits( *m_OptModuleEdgesWidth, PutValueInLocalUnits( *m_OptModuleEdgesWidth,
m_BrdSettings.m_ModuleSegmentWidth, PCB_INTERNAL_UNIT ); m_brdSettings.m_ModuleSegmentWidth, PCB_INTERNAL_UNIT );
/* Modules: Texts: Size & width */ /* Modules: Texts: Size & width */
AddUnitSymbol( *m_TextModWidthTitle ); AddUnitSymbol( *m_TextModWidthTitle );
PutValueInLocalUnits( *m_OptModuleTextWidth, PutValueInLocalUnits( *m_OptModuleTextWidth,
m_BrdSettings.m_ModuleTextWidth, PCB_INTERNAL_UNIT ); m_brdSettings.m_ModuleTextWidth, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_TextModSizeVTitle ); AddUnitSymbol( *m_TextModSizeVTitle );
PutValueInLocalUnits( *m_OptModuleTextVSize, PutValueInLocalUnits( *m_OptModuleTextVSize,
m_BrdSettings.m_ModuleTextSize.y, PCB_INTERNAL_UNIT ); m_brdSettings.m_ModuleTextSize.y, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_TextModSizeHTitle ); AddUnitSymbol( *m_TextModSizeHTitle );
PutValueInLocalUnits( *m_OptModuleTextHSize, PutValueInLocalUnits( *m_OptModuleTextHSize,
m_BrdSettings.m_ModuleTextSize.x, PCB_INTERNAL_UNIT ); m_brdSettings.m_ModuleTextSize.x, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_DefaultPenSizeTitle ); AddUnitSymbol( *m_DefaultPenSizeTitle );
PutValueInLocalUnits( *m_DefaultPenSizeCtrl, PutValueInLocalUnits( *m_DefaultPenSizeCtrl,
...@@ -109,26 +109,26 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues() ...@@ -109,26 +109,26 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues()
void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event ) void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event )
{ {
m_BrdSettings.m_DrawSegmentWidth = m_brdSettings.m_DrawSegmentWidth =
ReturnValueFromTextCtrl( *m_OptPcbSegmWidth, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptPcbSegmWidth, PCB_INTERNAL_UNIT );
m_BrdSettings.m_EdgeSegmentWidth = m_brdSettings.m_EdgeSegmentWidth =
ReturnValueFromTextCtrl( *m_OptPcbEdgesWidth, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptPcbEdgesWidth, PCB_INTERNAL_UNIT );
m_BrdSettings.m_PcbTextWidth = m_brdSettings.m_PcbTextWidth =
ReturnValueFromTextCtrl( *m_OptPcbTextWidth, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptPcbTextWidth, PCB_INTERNAL_UNIT );
m_BrdSettings.m_PcbTextSize.y = m_brdSettings.m_PcbTextSize.y =
ReturnValueFromTextCtrl( *m_OptPcbTextVSize, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptPcbTextVSize, PCB_INTERNAL_UNIT );
m_BrdSettings.m_PcbTextSize.x = m_brdSettings.m_PcbTextSize.x =
ReturnValueFromTextCtrl( *m_OptPcbTextHSize, PCB_INTERNAL_UNIT ); 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 ); ReturnValueFromTextCtrl( *m_OptModuleEdgesWidth, PCB_INTERNAL_UNIT );
m_BrdSettings.m_ModuleTextWidth = m_brdSettings.m_ModuleTextWidth =
ReturnValueFromTextCtrl( *m_OptModuleTextWidth, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptModuleTextWidth, PCB_INTERNAL_UNIT );
m_BrdSettings.m_ModuleTextSize.y = m_brdSettings.m_ModuleTextSize.y =
ReturnValueFromTextCtrl( *m_OptModuleTextVSize, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptModuleTextVSize, PCB_INTERNAL_UNIT );
m_BrdSettings.m_ModuleTextSize.x = m_brdSettings.m_ModuleTextSize.x =
ReturnValueFromTextCtrl( *m_OptModuleTextHSize, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptModuleTextHSize, PCB_INTERNAL_UNIT );
g_DrawDefaultLineThickness = g_DrawDefaultLineThickness =
...@@ -137,6 +137,8 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event ) ...@@ -137,6 +137,8 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event )
if( g_DrawDefaultLineThickness < 0 ) if( g_DrawDefaultLineThickness < 0 )
g_DrawDefaultLineThickness = 0; g_DrawDefaultLineThickness = 0;
m_parent->SetDesignSettings( m_brdSettings );
EndModal( wxID_OK ); EndModal( wxID_OK );
} }
......
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
class DIALOG_GRAPHIC_ITEMS_OPTIONS: public DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE class DIALOG_GRAPHIC_ITEMS_OPTIONS: public DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE
{ {
public: private:
BOARD_DESIGN_SETTINGS m_BrdSettings; BOARD_DESIGN_SETTINGS m_brdSettings;
PCB_BASE_FRAME * m_Parent; PCB_BASE_FRAME * m_parent;
public: public:
DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* parent ); DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* parent );
......
...@@ -195,7 +195,7 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge ) ...@@ -195,7 +195,7 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
new_layer = aEdge->GetLayer(); new_layer = aEdge->GetLayer();
// Ask for the new layer // 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 ) if( new_layer < 0 )
return; return;
...@@ -205,7 +205,7 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge ) ...@@ -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 /* an edge is put on a copper layer, and it is very dangerous. a
*confirmation is requested */ *confirmation is requested */
if( !IsOK( this, 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; return;
} }
......
...@@ -179,12 +179,12 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -179,12 +179,12 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS: case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
case ID_POPUP_PCB_STOP_CURRENT_DRAWING: case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
case ID_POPUP_PCB_EDIT_EDGE: case ID_POPUP_MODEDIT_EDIT_BODY_ITEM:
case ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE: case ID_POPUP_MODEDIT_EDIT_WIDTH_CURRENT_EDGE:
case ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE: case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE:
case ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE: case ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE:
case ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE: case ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE:
case ID_POPUP_PCB_ENTER_EDGE_WIDTH: case ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH:
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
...@@ -591,7 +591,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -591,7 +591,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_ENTER_EDGE_WIDTH: case ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH:
{ {
EDGE_MODULE* edge = NULL; EDGE_MODULE* edge = NULL;
if( GetScreen()->GetCurItem() if( GetScreen()->GetCurItem()
...@@ -608,25 +608,31 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -608,25 +608,31 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
} }
break; 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(); m_canvas->MoveCursorToCrossHair();
Edit_Edge_Width( (EDGE_MODULE*) GetScreen()->GetCurItem() ); Edit_Edge_Width( (EDGE_MODULE*) GetScreen()->GetCurItem() );
m_canvas->Refresh(); m_canvas->Refresh();
break; break;
case ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE: case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
Edit_Edge_Width( NULL ); Edit_Edge_Width( NULL );
m_canvas->Refresh(); m_canvas->Refresh();
break; break;
case ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE: case ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
Edit_Edge_Layer( (EDGE_MODULE*) GetScreen()->GetCurItem() ); Edit_Edge_Layer( (EDGE_MODULE*) GetScreen()->GetCurItem() );
m_canvas->Refresh(); m_canvas->Refresh();
break; break;
case ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE: case ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
Edit_Edge_Layer( NULL ); Edit_Edge_Layer( NULL );
m_canvas->Refresh(); m_canvas->Refresh();
......
...@@ -337,15 +337,17 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen ...@@ -337,15 +337,17 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
KiBitmap( apply_xpm ) ); KiBitmap( apply_xpm ) );
wxMenu* edit_mnu = new wxMenu; wxMenu* edit_mnu = new wxMenu;
AddMenuItem( PopMenu, edit_mnu, ID_POPUP_PCB_EDIT_EDGE, _( "Edit" ), KiBitmap( edit_xpm ) ); AddMenuItem( PopMenu, edit_mnu, ID_POPUP_MODEDIT_EDIT_EDGE, _( "Edit" ), KiBitmap( edit_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE, AddMenuItem( edit_mnu, ID_POPUP_MODEDIT_EDIT_BODY_ITEM,
_( "Edit Width (Current)" ), KiBitmap( width_segment_xpm ) ); _( "Edit Body Item" ), KiBitmap( options_segment_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE, AddMenuItem( edit_mnu, ID_POPUP_MODEDIT_EDIT_WIDTH_CURRENT_EDGE,
_( "Edit Width (All)" ), KiBitmap( width_segment_xpm ) ); _( "Change Body Item Width (Current)" ), KiBitmap( width_segment_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE, AddMenuItem( edit_mnu, ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE,
_( "Edit Layer (Current)" ), KiBitmap( select_layer_pair_xpm ) ); _( "Change Body Items Width (All)" ), KiBitmap( width_segment_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE, AddMenuItem( edit_mnu, ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE,
_( "Edit Layer (All)" ), KiBitmap( select_layer_pair_xpm ) ); _( "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 ); msg = AddHotkeyName( _("Delete edge" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_EDGE, msg, KiBitmap( delete_xpm ) ); 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 ...@@ -360,6 +362,9 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
case PCB_MARKER_T: case PCB_MARKER_T:
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
case PCB_TARGET_T: case PCB_TARGET_T:
msg.Printf( wxT( "FOOTPRINT_EDIT_FRAME::OnRightClick Error: Unexpected DrawType %d" ),
item->Type() );
DisplayError( this, msg );
break; break;
case SCREEN_T: case SCREEN_T:
...@@ -383,7 +388,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen ...@@ -383,7 +388,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
( GetToolId() == ID_MODEDIT_CIRCLE_TOOL ) || ( GetToolId() == ID_MODEDIT_CIRCLE_TOOL ) ||
( GetToolId() == ID_MODEDIT_ARC_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 ) ); KiBitmap( width_segment_xpm ) );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
} }
...@@ -391,7 +396,9 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen ...@@ -391,7 +396,9 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
return true; return true;
} }
/*
* Called on a mouse left button double click
*/
void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
...@@ -418,7 +425,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -418,7 +425,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break; break;
case PCB_MODULE_T: case PCB_MODULE_T:
{ {
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) item ); DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) item );
int ret = dialog.ShowModal(); int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->ClearFlags(); GetScreen()->GetCurItem()->ClearFlags();
...@@ -426,14 +433,20 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -426,14 +433,20 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
if( ret > 0 ) if( ret > 0 )
m_canvas->Refresh(); m_canvas->Refresh();
} }
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
InstallTextModOptionsFrame( (TEXTE_MODULE*) item, DC ); InstallTextModOptionsFrame( (TEXTE_MODULE*) item, DC );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
case PCB_MODULE_EDGE_T :
m_canvas->MoveCursorToCrossHair();
InstallFootprintBodyItemPropertiesDlg( (EDGE_MODULE*) item );
m_canvas->Refresh();
break;
default: default:
break; break;
} }
......
...@@ -339,6 +339,13 @@ public: ...@@ -339,6 +339,13 @@ public:
/// Function to place a graphic item type EDGE_MODULE currently moved /// Function to place a graphic item type EDGE_MODULE currently moved
void Place_EdgeMod( EDGE_MODULE* drawitem ); 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 DlgGlobalChange_PadSettings
* Function to change pad caracteristics for the given footprint * Function to change pad caracteristics for the given footprint
......
...@@ -105,6 +105,12 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -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, EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) 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 // Module transformations
EVT_MENU( ID_MODEDIT_MODULE_ROTATE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_MODEDIT_MODULE_ROTATE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_MIRROR, 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 ...@@ -128,7 +128,6 @@ enum pcbnew_ids
ID_POPUP_PCB_SELECT_CU_LAYER, ID_POPUP_PCB_SELECT_CU_LAYER,
ID_POPUP_PCB_SELECT_NO_CU_LAYER, ID_POPUP_PCB_SELECT_NO_CU_LAYER,
ID_POPUP_PCB_SELECT_LAYER_PAIR, ID_POPUP_PCB_SELECT_LAYER_PAIR,
ID_POPUP_PCB_EDIT_EDGE,
ID_POPUP_PCB_DELETE_EDGE, ID_POPUP_PCB_DELETE_EDGE,
ID_POPUP_PCB_MOVE_EDGE, ID_POPUP_PCB_MOVE_EDGE,
ID_POPUP_PCB_PLACE_EDGE, ID_POPUP_PCB_PLACE_EDGE,
...@@ -141,11 +140,6 @@ enum pcbnew_ids ...@@ -141,11 +140,6 @@ enum pcbnew_ids
ID_POPUP_PCB_LOCK_OFF_NET, ID_POPUP_PCB_LOCK_OFF_NET,
ID_POPUP_PCB_SETFLAGS_TRACK_MNU, 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_GLOBAL_IMPORT_PAD_SETTINGS,
ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE, ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE,
ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE, ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE,
...@@ -294,6 +288,12 @@ enum pcbnew_ids ...@@ -294,6 +288,12 @@ enum pcbnew_ids
ID_MODEDIT_PLACE_GRID_COORD, ID_MODEDIT_PLACE_GRID_COORD,
// ID used in module editor: // 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_CHECK,
ID_MODEDIT_SELECT_CURRENT_LIB, ID_MODEDIT_SELECT_CURRENT_LIB,
ID_MODEDIT_SAVE_LIBMODULE, ID_MODEDIT_SAVE_LIBMODULE,
...@@ -312,6 +312,7 @@ enum pcbnew_ids ...@@ -312,6 +312,7 @@ enum pcbnew_ids
ID_MODEDIT_IMPORT_PART, ID_MODEDIT_IMPORT_PART,
ID_MODEDIT_EXPORT_PART, ID_MODEDIT_EXPORT_PART,
ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
ID_POPUP_MODEDIT_EDIT_BODY_ITEM,
ID_MODVIEW_LIBWINDOW, ID_MODVIEW_LIBWINDOW,
ID_MODVIEW_FOOTPRINT_WINDOW, 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