From 40c1c8285dc2ec9dec106d53e784d689a1cbf03b Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 11 Jun 2018 16:03:16 +0100 Subject: [PATCH] Combine PCBnew and ModEdit Graphic Item Properties dialogs. Also UNIT_BINDERizes the result. (cherry picked from commit edd3b25) --- pcbnew/CMakeLists.txt | 1 - pcbnew/dialogs/dialog_SVG_print.cpp | 4 +- pcbnew/dialogs/dialog_design_rules.cpp | 12 +- .../dialog_graphic_item_properties.cpp | 259 ++++------- .../dialog_graphic_item_properties_base.cpp | 125 +++-- .../dialog_graphic_item_properties_base.fbp | 432 ++---------------- .../dialog_graphic_item_properties_base.h | 48 +- ..._graphic_item_properties_for_fp_editor.cpp | 389 ---------------- pcbnew/edit.cpp | 9 +- pcbnew/footprint_edit_frame.h | 7 - pcbnew/footprint_editor_onclick.cpp | 4 +- pcbnew/footprint_editor_utils.cpp | 4 +- pcbnew/onleftclick.cpp | 2 +- pcbnew/pcb_base_edit_frame.h | 2 + pcbnew/pcb_edit_frame.h | 1 - 15 files changed, 237 insertions(+), 1062 deletions(-) delete mode 100644 pcbnew/dialogs/dialog_graphic_item_properties_for_fp_editor.cpp diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 1591c9168e..95d12242eb 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -107,7 +107,6 @@ set( PCBNEW_DIALOGS dialogs/dialog_global_pads_edition_base.cpp dialogs/dialog_graphic_item_properties.cpp dialogs/dialog_graphic_item_properties_base.cpp - dialogs/dialog_graphic_item_properties_for_fp_editor.cpp dialogs/dialog_graphic_items_options.cpp dialogs/dialog_graphic_items_options_base.cpp dialogs/dialog_keepout_area_properties.cpp diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp index eb44aede92..f6ef33be9d 100644 --- a/pcbnew/dialogs/dialog_SVG_print.cpp +++ b/pcbnew/dialogs/dialog_SVG_print.cpp @@ -151,9 +151,7 @@ void DIALOG_SVG_PRINT::initDialog() m_printMirrorOpt->SetValue( m_printMirror ); m_rbFileOpt->SetSelection( m_oneFileOnly ? 1 : 0 ); - AddUnitSymbol( *m_TextPenWidth, g_UserUnit ); - - m_DialogDefaultPenSize->SetValue( StringFromValue( g_UserUnit, g_DrawDefaultLineThickness ) ); + m_DialogDefaultPenSize->SetValue( StringFromValue( g_UserUnit, g_DrawDefaultLineThickness, true ) ); LSEQ seq = m_board->GetEnabledLayers().UIOrder(); diff --git a/pcbnew/dialogs/dialog_design_rules.cpp b/pcbnew/dialogs/dialog_design_rules.cpp index 1ecb4be35e..ed20decc78 100644 --- a/pcbnew/dialogs/dialog_design_rules.cpp +++ b/pcbnew/dialogs/dialog_design_rules.cpp @@ -571,7 +571,7 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard() if( !msg.IsEmpty() ) { - value = ValueFromString( g_UserUnit, msg ); + value = ValueFromString( GetUserUnits(), msg ); via_dim.m_Drill = value; } @@ -949,11 +949,11 @@ void DIALOG_DESIGN_RULES::setNetClass( const wxString& aNetName, const wxString& bool DIALOG_DESIGN_RULES::validateData() { wxString msg; - int minViaDia = ValueFromTextCtrl( *m_SetViasMinSizeCtrl ); - int minViaDrill = ValueFromTextCtrl( *m_SetViasMinDrillCtrl ); - int minUViaDia = ValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl ); - int minUViaDrill = ValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl ); - int minTrackWidth = ValueFromTextCtrl( *m_SetTrackMinWidthCtrl ); + int minViaDia = m_viaMinDiameter.GetValue(); + int minViaDrill = m_viaMinDrill.GetValue(); + int minUViaDia = m_microViaMinDiameter.GetValue(); + int minUViaDrill = m_microViaMinDrill.GetValue(); + int minTrackWidth = m_trackMinWidth.GetValue(); // Test net class parameters. for( int row = 0; row < m_grid->GetNumberRows(); row++ ) diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index a76989de95..a786ffe4d2 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -22,60 +22,49 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file dialog_graphic_item_properties.cpp +/* + * Edit properties of Lines, Circles, Arcs and Polygons for PCBNew and ModEdit */ -/* Edit parameters values of graphic items type DRAWSEGMENTS: - * Lines - * Circles - * Arcs - * polygon (only layer and contour thickness) - * used as graphic elements found on non copper layers in boards - * items on edge layers are considered as graphic items - * Pcb texts are not always graphic items and are not handled here - */ #include #include -#include #include #include -#include -#include -#include -#include +#include #include #include -#include - -#include -#include - -#include #include #include -#include +#include +#include +#include +#include +#include class DIALOG_GRAPHIC_ITEM_PROPERTIES : public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE { private: - PCB_EDIT_FRAME* m_parent; + PCB_BASE_EDIT_FRAME* m_parent; wxDC* m_DC; DRAWSEGMENT* m_item; - BOARD_DESIGN_SETTINGS m_brdSettings; + EDGE_MODULE* m_moduleItem; + + UNIT_BINDER m_startX, m_startY; + UNIT_BINDER m_endX, m_endY; + UNIT_BINDER m_angle; + UNIT_BINDER m_thickness; wxFloatingPointValidator m_AngleValidator; double m_AngleValue; public: - DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_EDIT_FRAME* aParent, DRAWSEGMENT* aItem, wxDC* aDC ); + DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem, wxDC* aDC ); ~DIALOG_GRAPHIC_ITEM_PROPERTIES() {}; private: bool TransferDataToWindow() override; bool TransferDataFromWindow() override; - void OnLayerChoice( wxCommandEvent& event ); void OnInitDlg( wxInitDialogEvent& event ) override { @@ -89,85 +78,80 @@ private: bool Validate() override; }; -DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_EDIT_FRAME* aParent, - DRAWSEGMENT* aItem, wxDC* aDC ): +DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, + BOARD_ITEM* aItem, wxDC* aDC ): DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( aParent ), + m_startX( aParent, m_startXLabel, m_startXCtrl, m_startXUnits ), + m_startY( aParent, m_startYLabel, m_startYCtrl, m_startYUnits ), + m_endX( aParent, m_endXLabel, m_endXCtrl, m_endXUnits ), + m_endY( aParent, m_endYLabel, m_endYCtrl, m_endYUnits ), + m_angle( aParent, m_angleLabel, m_angleCtrl, m_angleUnits ), + m_thickness( aParent, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits, true ), m_AngleValidator( 1, &m_AngleValue ), m_AngleValue( 0.0 ) { m_parent = aParent; m_DC = aDC; - m_item = aItem; - m_brdSettings = m_parent->GetDesignSettings(); + m_item = dynamic_cast( aItem ); + m_moduleItem = dynamic_cast( aItem ); + m_angle.SetUnits( DEGREES ); m_AngleValidator.SetRange( -360.0, 360.0 ); - m_AngleCtrl->SetValidator( m_AngleValidator ); - m_AngleValidator.SetWindow( m_AngleCtrl ); + m_angleCtrl->SetValidator( m_AngleValidator ); + m_AngleValidator.SetWindow( m_angleCtrl ); + + SetInitialFocus( m_startXCtrl ); m_StandardButtonsSizerOK->SetDefault(); - } -void PCB_EDIT_FRAME::InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC ) +void PCB_BASE_EDIT_FRAME::InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem, wxDC* aDC ) { wxCHECK_RET( aItem != NULL, wxT( "InstallGraphicItemPropertiesDialog() error: NULL item" ) ); +#ifdef USE_WX_OVERLAY + // #1277772 - Draw into dialog converted in refresh request + aDC = nullptr; +#endif + m_canvas->SetIgnoreMouseEvents( true ); DIALOG_GRAPHIC_ITEM_PROPERTIES dlg( this, aItem, aDC ); dlg.ShowModal(); m_canvas->MoveCursorToCrossHair(); m_canvas->SetIgnoreMouseEvents( false ); + + if( !aDC ) + m_canvas->Refresh(); } bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow() { - // Set unit symbol - wxStaticText* texts_unit[] = - { - m_StartPointXUnit, - m_StartPointYUnit, - m_EndPointXUnit, - m_EndPointYUnit, - m_ThicknessTextUnit, - m_DefaulThicknessTextUnit, - }; - - for( size_t ii = 0; ii < DIM( texts_unit ); ii++ ) - { - texts_unit[ii]->SetLabel( GetAbbreviatedUnitsLabel() ); - } + if( !m_item ) + return false; // Only an arc has a angle parameter. So do not show this parameter for other shapes if( m_item->GetShape() != S_ARC ) - { - m_AngleText->Show( false ); - m_AngleCtrl->Show( false ); - m_AngleUnit->Show( false ); - } - - wxString msg; + m_angle.Show( false ); // Change texts according to the segment shape: switch( m_item->GetShape() ) { case S_CIRCLE: SetTitle( _( "Circle Properties" ) ); - m_StartPointXLabel->SetLabel( _( "Center X:" ) ); - m_StartPointYLabel->SetLabel( _( "Center Y:" ) ); - m_EndPointXLabel->SetLabel( _( "Radius:" ) ); - m_EndPointYLabel->Show( false ); - m_EndPointYUnit->Show( false ); - m_EndY_Ctrl->Show( false ); + m_startXLabel->SetLabel( _( "Center X:" ) ); + m_startYLabel->SetLabel( _( "Center Y:" ) ); + m_endXLabel->SetLabel( _( "Radius:" ) ); + m_endY.Show( false ); break; case S_ARC: SetTitle( _( "Arc Properties" ) ); - m_StartPointXLabel->SetLabel( _( "Center X:" ) ); - m_StartPointYLabel->SetLabel( _( "Center Y:" ) ); - m_EndPointXLabel->SetLabel( _( "Start Point X:" ) ); - m_EndPointYLabel->SetLabel( _( "Start Point Y:" ) ); + m_startXLabel->SetLabel( _( "Center X:" ) ); + m_startYLabel->SetLabel( _( "Center Y:" ) ); + m_endXLabel->SetLabel( _( "Start Point X:" ) ); + m_endYLabel->SetLabel( _( "Start Point Y:" ) ); m_AngleValue = m_item->GetAngle() / 10.0; break; @@ -185,68 +169,61 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow() break; } - PutValueInLocalUnits( *m_Center_StartXCtrl, m_item->GetStart().x ); - - PutValueInLocalUnits( *m_Center_StartYCtrl, m_item->GetStart().y ); + m_startX.SetValue( m_item->GetStart().x ); + m_startY.SetValue( m_item->GetStart().y ); if( m_item->GetShape() == S_CIRCLE ) { - PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_item->GetRadius() ); + m_endX.SetValue( m_item->GetRadius() ); } else { - PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_item->GetEnd().x ); - PutValueInLocalUnits( *m_EndY_Ctrl, m_item->GetEnd().y ); + m_endX.SetValue( m_item->GetEnd().x ); + m_endY.SetValue( m_item->GetEnd().y ); } - PutValueInLocalUnits( *m_ThicknessCtrl, m_item->GetWidth() ); - - int thickness; - - if( m_item->GetLayer() == Edge_Cuts ) - thickness = m_brdSettings.m_EdgeSegmentWidth; - else - thickness = m_brdSettings.m_DrawSegmentWidth; - - PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness ); + m_thickness.SetValue( m_item->GetWidth() ); // Configure the layers list selector + if( m_moduleItem ) + m_LayerSelectionCtrl->SetNotAllowedLayerSet( LSET::InternalCuMask().set( Edge_Cuts ) ); + else + m_LayerSelectionCtrl->SetNotAllowedLayerSet( LSET::AllCuMask() ); + m_LayerSelectionCtrl->SetLayersHotkeys( false ); - m_LayerSelectionCtrl->SetNotAllowedLayerSet( LSET::AllCuMask() ); m_LayerSelectionCtrl->SetBoardFrame( m_parent ); m_LayerSelectionCtrl->Resync(); if( m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() ) < 0 ) { - wxMessageBox( _( "This item was on a not allowed or non existing layer.\n" - "It has been moved to the first allowed layer.\n\n" - "Please fix it." ) ); - //m_LayerSelectionCtrl->SetLayerSelection( Dwgs_User ); - m_LayerSelectionCtrl->SetSelection( 0 ); + wxMessageBox( _( "This item was on a forbidden or non-existing layer.\n" + "It has been moved to the first allowed layer." ) ); + m_LayerSelectionCtrl->SetSelection( F_SilkS ); } return DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::TransferDataToWindow(); } -void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& event ) -{ - int thickness; - - if( m_LayerSelectionCtrl->GetLayerSelection() == Edge_Cuts ) - thickness = m_brdSettings.m_EdgeSegmentWidth; - else - thickness = m_brdSettings.m_DrawSegmentWidth; - - PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness ); -} - - bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow() { if( !DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::TransferDataFromWindow() ) return false; + LAYER_NUM layer = m_LayerSelectionCtrl->GetLayerSelection(); + + if( IsCopperLayer( layer ) ) + { + // An graphic item is put on a copper layer. + // This is sometimes useful, for instance for microwave applications ans net tees. + // Because the DRC does not handle graphic items, it can break boards. + // Therefore a confirmation is requested + if( !IsOK( this, _( "The graphic item will be on a copper layer.\n" + "This is very dangerous because DRC does not handle it.\n" + "Are you sure?" ) ) ) + return false; + } + BOARD_COMMIT commit( m_parent ); commit.Modify( m_item ); @@ -255,38 +232,27 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow() if( m_DC ) m_item->Draw( m_parent->GetCanvas(), m_DC, GR_XOR ); - msg = m_Center_StartXCtrl->GetValue(); - m_item->SetStartX( ValueFromString( g_UserUnit, msg ) ); - - msg = m_Center_StartYCtrl->GetValue(); - m_item->SetStartY( ValueFromString( g_UserUnit, msg ) ); + m_item->SetStartX( m_startX.GetValue() ); + m_item->SetStartY( m_startY.GetValue() ); if( m_item->GetShape() == S_CIRCLE ) { - msg = m_EndX_Radius_Ctrl->GetValue(); - m_item->SetEnd( m_item->GetStart() + wxPoint( ValueFromString( g_UserUnit, msg ), 0 ) ); + m_item->SetEnd( m_item->GetStart() + wxPoint( m_endX.GetValue(), 0 ) ); } else { - msg = m_EndX_Radius_Ctrl->GetValue(); - m_item->SetEndX( ValueFromString( g_UserUnit, msg ) ); - - msg = m_EndY_Ctrl->GetValue(); - m_item->SetEndY( ValueFromString( g_UserUnit, msg ) ); + m_item->SetEndX( m_endX.GetValue() ); + m_item->SetEndY( m_endY.GetValue() ); } - msg = m_ThicknessCtrl->GetValue(); - m_item->SetWidth( ValueFromString( g_UserUnit, msg ) ); + if( m_moduleItem ) + { + m_moduleItem->SetStart0( m_moduleItem->GetStart() ); + m_moduleItem->SetEnd0( m_moduleItem->GetEnd() ); + } - msg = m_DefaultThicknessCtrl->GetValue(); - int thickness = ValueFromString( g_UserUnit, msg ); - - m_item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) ); - - if( m_item->GetLayer() == Edge_Cuts ) - m_brdSettings.m_EdgeSegmentWidth = thickness; - else - m_brdSettings.m_DrawSegmentWidth = thickness; + m_item->SetWidth( m_thickness.GetValue() ); + m_item->SetLayer( ToLAYER_ID( layer ) ); if( m_item->GetShape() == S_ARC ) { @@ -300,9 +266,6 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow() m_parent->SetMsgPanel( m_item ); - m_parent->SetDesignSettings( m_brdSettings ); - m_parent->OnModify(); - return true; } @@ -314,33 +277,19 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate() if( !DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::Validate() ) return false; - // Load the start and end points -- all types use these in the checks. - int startx = ValueFromString( g_UserUnit, m_Center_StartXCtrl->GetValue() ); - int starty = ValueFromString( g_UserUnit, m_Center_StartYCtrl->GetValue() ); - int endx = ValueFromString( g_UserUnit, m_EndX_Radius_Ctrl->GetValue() ); - int endy = ValueFromString( g_UserUnit, m_EndY_Ctrl->GetValue() ); - // Type specific checks. switch( m_item->GetShape() ) { case S_ARC: // Check angle of arc. - double angle; - m_AngleCtrl->GetValue().ToDouble( &angle ); - - if( angle == 0.0 ) - { + if( m_angle.GetValue() == 0 ) error_msgs.Add( _( "The arc angle cannot be zero." ) ); - } - // Fall through. + case S_CIRCLE: // Check radius. - if( (startx == endx) && (starty == endy) ) - { + if( m_startX.GetValue() == m_endX.GetValue() && m_startY.GetValue() == m_endY.GetValue() ) error_msgs.Add( _( "The radius must be greater than zero." ) ); - } - break; case S_POLYGON: @@ -348,32 +297,26 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate() default: // Check start and end are not the same. - if( (startx == endx) && (starty == endy) ) - { + if( m_startX.GetValue() == m_endX.GetValue() && m_startY.GetValue() == m_endY.GetValue() ) error_msgs.Add( _( "The start and end points cannot be the same." ) ); - } - break; } // Check the item thickness. Note the polygon outline thickness is allowed // to be set to 0, because if the shape is exactly the polygon, its outline // thickness must be 0 - int thickness = ValueFromString( g_UserUnit, m_ThicknessCtrl->GetValue() ); + int thickness = m_thickness.GetValue(); if( m_item->GetShape() == S_POLYGON ) { if( thickness < 0 ) error_msgs.Add( _( "The polygon outline thickness must be >= 0." ) ); } - else if( thickness <= 0 ) - error_msgs.Add( _( "The item thickness must be greater than zero." ) ); - - // And the default thickness. - thickness = ValueFromString( g_UserUnit, m_DefaultThicknessCtrl->GetValue() ); - - if( thickness <= 0 ) - error_msgs.Add( _( "The default thickness must be greater than zero." ) ); + else + { + if( thickness <= 0 ) + error_msgs.Add( _( "The item thickness must be greater than zero." ) ); + } if( error_msgs.GetCount() ) { diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp b/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp index e01a1206ec..7deaa625b6 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 4 2017) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // -// PLEASE DO "NOT" EDIT THIS FILE! +// PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #include "pcb_layer_box_selector.h" -#include "widgets/text_ctrl_eval.h" #include "dialog_graphic_item_properties_base.h" @@ -27,55 +26,52 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind m_fgUpperLeftGridSizer->SetFlexibleDirection( wxBOTH ); m_fgUpperLeftGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_StartPointXLabel = new wxStaticText( this, wxID_ANY, _("Start point X:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_StartPointXLabel->Wrap( -1 ); - m_fgUpperLeftGridSizer->Add( m_StartPointXLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP, 5 ); + m_startXLabel = new wxStaticText( this, wxID_ANY, _("Start point X:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_startXLabel->Wrap( -1 ); + m_fgUpperLeftGridSizer->Add( m_startXLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP, 5 ); - m_Center_StartXCtrl = new TEXT_CTRL_EVAL( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_fgUpperLeftGridSizer->Add( m_Center_StartXCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); + m_startXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_fgUpperLeftGridSizer->Add( m_startXCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); - m_StartPointXUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 ); - m_StartPointXUnit->Wrap( -1 ); - m_fgUpperLeftGridSizer->Add( m_StartPointXUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_startXUnits = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_startXUnits->Wrap( -1 ); + m_fgUpperLeftGridSizer->Add( m_startXUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_StartPointYLabel = new wxStaticText( this, wxID_ANY, _("Start point Y:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_StartPointYLabel->Wrap( -1 ); - m_fgUpperLeftGridSizer->Add( m_StartPointYLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP, 5 ); + m_startYLabel = new wxStaticText( this, wxID_ANY, _("Start point Y:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_startYLabel->Wrap( -1 ); + m_fgUpperLeftGridSizer->Add( m_startYLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP, 5 ); - m_Center_StartYCtrl = new TEXT_CTRL_EVAL( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_fgUpperLeftGridSizer->Add( m_Center_StartYCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); + m_startYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_fgUpperLeftGridSizer->Add( m_startYCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); - m_StartPointYUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 ); - m_StartPointYUnit->Wrap( -1 ); - m_fgUpperLeftGridSizer->Add( m_StartPointYUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_startYUnits = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_startYUnits->Wrap( -1 ); + m_fgUpperLeftGridSizer->Add( m_startYUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_EndPointXLabel = new wxStaticText( this, wxID_ANY, _("End point X:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_EndPointXLabel->Wrap( -1 ); - m_fgUpperLeftGridSizer->Add( m_EndPointXLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP, 5 ); + m_endXLabel = new wxStaticText( this, wxID_ANY, _("End point X:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_endXLabel->Wrap( -1 ); + m_fgUpperLeftGridSizer->Add( m_endXLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP, 5 ); - m_EndX_Radius_Ctrl = new TEXT_CTRL_EVAL( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_fgUpperLeftGridSizer->Add( m_EndX_Radius_Ctrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); + m_endXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_fgUpperLeftGridSizer->Add( m_endXCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); - m_EndPointXUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 ); - m_EndPointXUnit->Wrap( -1 ); - m_fgUpperLeftGridSizer->Add( m_EndPointXUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_endXUnits = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_endXUnits->Wrap( -1 ); + m_fgUpperLeftGridSizer->Add( m_endXUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_EndPointYLabel = new wxStaticText( this, wxID_ANY, _("End point Y:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_EndPointYLabel->Wrap( -1 ); - m_fgUpperLeftGridSizer->Add( m_EndPointYLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP, 5 ); + m_endYLabel = new wxStaticText( this, wxID_ANY, _("End point Y:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_endYLabel->Wrap( -1 ); + m_fgUpperLeftGridSizer->Add( m_endYLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP, 5 ); - m_EndY_Ctrl = new TEXT_CTRL_EVAL( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_fgUpperLeftGridSizer->Add( m_EndY_Ctrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); + m_endYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_fgUpperLeftGridSizer->Add( m_endYCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); - m_EndPointYUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 ); - m_EndPointYUnit->Wrap( -1 ); - m_fgUpperLeftGridSizer->Add( m_EndPointYUnit, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT|wxTOP, 5 ); + m_endYUnits = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_endYUnits->Wrap( -1 ); + m_fgUpperLeftGridSizer->Add( m_endYUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - bUpperSizer->Add( m_fgUpperLeftGridSizer, 0, wxEXPAND, 5 ); - - m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); - bUpperSizer->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 ); + bUpperSizer->Add( m_fgUpperLeftGridSizer, 1, wxEXPAND|wxRIGHT, 30 ); wxBoxSizer* bUpperRightSizer; bUpperRightSizer = new wxBoxSizer( wxVERTICAL ); @@ -86,45 +82,34 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind fgUpperRightGridSizer->SetFlexibleDirection( wxBOTH ); fgUpperRightGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_AngleText = new wxStaticText( this, wxID_ANY, _("Arc angle:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_AngleText->Wrap( -1 ); - fgUpperRightGridSizer->Add( m_AngleText, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP, 5 ); + m_angleLabel = new wxStaticText( this, wxID_ANY, _("Arc angle:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_angleLabel->Wrap( -1 ); + fgUpperRightGridSizer->Add( m_angleLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP, 5 ); - m_AngleCtrl = new TEXT_CTRL_EVAL( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgUpperRightGridSizer->Add( m_AngleCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); + m_angleCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgUpperRightGridSizer->Add( m_angleCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 ); - m_AngleUnit = new wxStaticText( this, wxID_ANY, _("degrees"), wxDefaultPosition, wxDefaultSize, 0 ); - m_AngleUnit->Wrap( -1 ); - fgUpperRightGridSizer->Add( m_AngleUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_angleUnits = new wxStaticText( this, wxID_ANY, _("deg"), wxDefaultPosition, wxDefaultSize, 0 ); + m_angleUnits->Wrap( -1 ); + fgUpperRightGridSizer->Add( m_angleUnits, 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_thicknessLabel = new wxStaticText( this, wxID_ANY, _("Line thickness:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_thicknessLabel->Wrap( -1 ); + fgUpperRightGridSizer->Add( m_thicknessLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); - m_ThicknessCtrl = new TEXT_CTRL_EVAL( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgUpperRightGridSizer->Add( m_ThicknessCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); + m_thicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgUpperRightGridSizer->Add( m_thicknessCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 ); - m_ThicknessTextUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ThicknessTextUnit->Wrap( -1 ); - fgUpperRightGridSizer->Add( m_ThicknessTextUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - m_DefaultThicknessLabel = new wxStaticText( this, wxID_ANY, _("Default thickness:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_DefaultThicknessLabel->Wrap( -1 ); - fgUpperRightGridSizer->Add( m_DefaultThicknessLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP, 5 ); - - m_DefaultThicknessCtrl = new TEXT_CTRL_EVAL( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgUpperRightGridSizer->Add( m_DefaultThicknessCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); - - m_DefaulThicknessTextUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 ); - m_DefaulThicknessTextUnit->Wrap( -1 ); - fgUpperRightGridSizer->Add( m_DefaulThicknessTextUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_thicknessUnits = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_thicknessUnits->Wrap( -1 ); + fgUpperRightGridSizer->Add( m_thicknessUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); m_LayerLabel = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 ); m_LayerLabel->Wrap( -1 ); - fgUpperRightGridSizer->Add( m_LayerLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 ); + fgUpperRightGridSizer->Add( m_LayerLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - fgUpperRightGridSizer->Add( m_LayerSelectionCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP, 5 ); + fgUpperRightGridSizer->Add( m_LayerSelectionCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgUpperRightGridSizer->Add( 0, 0, 1, wxEXPAND, 5 ); @@ -136,10 +121,10 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind bUpperSizer->Add( bUpperRightSizer, 0, wxEXPAND, 5 ); - bMainSizer->Add( bUpperSizer, 1, wxALL|wxEXPAND, 5 ); + bMainSizer->Add( bUpperSizer, 1, wxEXPAND|wxALL, 10 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + bMainSizer->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 ); m_StandardButtonsSizer = new wxStdDialogButtonSizer(); m_StandardButtonsSizerOK = new wxButton( this, wxID_OK ); diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp b/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp index 1ce1fd0e3e..3fc3905dca 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp @@ -94,8 +94,8 @@ wxVERTICAL none - 5 - wxALL|wxEXPAND + 10 + wxEXPAND|wxALL 1 @@ -103,9 +103,9 @@ wxHORIZONTAL none - 5 - wxEXPAND - 0 + 30 + wxEXPAND|wxRIGHT + 1 3 wxBOTH @@ -120,7 +120,7 @@ 0 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP 0 1 @@ -158,7 +158,7 @@ 0 1 - m_StartPointXLabel + m_startXLabel 1 @@ -241,7 +241,7 @@ 0 1 - m_Center_StartXCtrl + m_startXCtrl 1 @@ -252,7 +252,7 @@ 1 - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h + ; ; forward_declare 0 @@ -332,7 +332,7 @@ 0 1 - m_StartPointXUnit + m_startXUnits 1 @@ -377,7 +377,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP 0 1 @@ -415,7 +415,7 @@ 0 1 - m_StartPointYLabel + m_startYLabel 1 @@ -498,7 +498,7 @@ 0 1 - m_Center_StartYCtrl + m_startYCtrl 1 @@ -509,7 +509,7 @@ 1 - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h + ; ; forward_declare 0 @@ -589,7 +589,7 @@ 0 1 - m_StartPointYUnit + m_startYUnits 1 @@ -634,7 +634,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP 0 1 @@ -672,7 +672,7 @@ 0 1 - m_EndPointXLabel + m_endXLabel 1 @@ -755,7 +755,7 @@ 0 1 - m_EndX_Radius_Ctrl + m_endXCtrl 1 @@ -766,7 +766,7 @@ 1 - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h + ; ; forward_declare 0 @@ -846,7 +846,7 @@ 0 1 - m_EndPointXUnit + m_endXUnits 1 @@ -891,7 +891,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP 0 1 @@ -929,7 +929,7 @@ 0 1 - m_EndPointYLabel + m_endYLabel 1 @@ -1012,7 +1012,7 @@ 0 1 - m_EndY_Ctrl + m_endYCtrl 1 @@ -1023,7 +1023,7 @@ 1 - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h + ; ; forward_declare 0 @@ -1065,7 +1065,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT|wxTOP + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -1103,7 +1103,7 @@ 0 1 - m_EndPointYUnit + m_endYUnits 1 @@ -1148,87 +1148,6 @@ - - 5 - wxEXPAND | wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline2 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_VERTICAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 wxEXPAND @@ -1256,7 +1175,7 @@ 0 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP 0 1 @@ -1294,7 +1213,7 @@ 0 1 - m_AngleText + m_angleLabel 1 @@ -1339,7 +1258,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL 0 1 @@ -1377,7 +1296,7 @@ 0 1 - m_AngleCtrl + m_angleCtrl 1 @@ -1388,7 +1307,7 @@ 1 - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h + ; ; forward_declare 0 @@ -1430,7 +1349,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALL + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT 0 1 @@ -1460,7 +1379,7 @@ 0 0 wxID_ANY - degrees + deg 0 @@ -1468,7 +1387,7 @@ 0 1 - m_AngleUnit + m_angleUnits 1 @@ -1513,7 +1432,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT 0 1 @@ -1543,7 +1462,7 @@ 0 0 wxID_ANY - Item thickness: + Line thickness: 0 @@ -1551,7 +1470,7 @@ 0 1 - m_ThicknessLabel + m_thicknessLabel 1 @@ -1596,7 +1515,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL 0 1 @@ -1634,7 +1553,7 @@ 0 1 - m_ThicknessCtrl + m_thicknessCtrl 1 @@ -1645,7 +1564,7 @@ 1 - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h + 0 @@ -1687,7 +1606,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALL + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT 0 1 @@ -1725,264 +1644,7 @@ 0 1 - m_ThicknessTextUnit - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Default thickness: - - 0 - - - 0 - - 1 - m_DefaultThicknessLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_DefaultThicknessCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Unit - - 0 - - - 0 - - 1 - m_DefaulThicknessTextUnit + m_thicknessUnits 1 @@ -2027,7 +1689,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT 0 1 @@ -2109,8 +1771,8 @@ - 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP + 3 + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -2216,8 +1878,8 @@ - 5 - wxEXPAND | wxALL + 10 + wxEXPAND|wxRIGHT|wxLEFT 0 1 diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_base.h b/pcbnew/dialogs/dialog_graphic_item_properties_base.h index a7e703db4a..b670de0aed 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_base.h +++ b/pcbnew/dialogs/dialog_graphic_item_properties_base.h @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 4 2017) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // -// PLEASE DO "NOT" EDIT THIS FILE! +// PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #ifndef __DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE_H__ @@ -11,9 +11,7 @@ #include #include #include -class DIALOG_SHIM; class PCB_LAYER_BOX_SELECTOR; -class TEXT_CTRL_EVAL; #include "dialog_shim.h" #include @@ -24,8 +22,8 @@ class TEXT_CTRL_EVAL; #include #include #include -#include #include +#include #include #include @@ -41,28 +39,24 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE : public DIALOG_SHIM protected: wxFlexGridSizer* m_fgUpperLeftGridSizer; - wxStaticText* m_StartPointXLabel; - TEXT_CTRL_EVAL* m_Center_StartXCtrl; - wxStaticText* m_StartPointXUnit; - wxStaticText* m_StartPointYLabel; - TEXT_CTRL_EVAL* m_Center_StartYCtrl; - wxStaticText* m_StartPointYUnit; - wxStaticText* m_EndPointXLabel; - TEXT_CTRL_EVAL* m_EndX_Radius_Ctrl; - wxStaticText* m_EndPointXUnit; - wxStaticText* m_EndPointYLabel; - TEXT_CTRL_EVAL* m_EndY_Ctrl; - wxStaticText* m_EndPointYUnit; - wxStaticLine* m_staticline2; - wxStaticText* m_AngleText; - TEXT_CTRL_EVAL* m_AngleCtrl; - wxStaticText* m_AngleUnit; - wxStaticText* m_ThicknessLabel; - TEXT_CTRL_EVAL* m_ThicknessCtrl; - wxStaticText* m_ThicknessTextUnit; - wxStaticText* m_DefaultThicknessLabel; - TEXT_CTRL_EVAL* m_DefaultThicknessCtrl; - wxStaticText* m_DefaulThicknessTextUnit; + wxStaticText* m_startXLabel; + wxTextCtrl* m_startXCtrl; + wxStaticText* m_startXUnits; + wxStaticText* m_startYLabel; + wxTextCtrl* m_startYCtrl; + wxStaticText* m_startYUnits; + wxStaticText* m_endXLabel; + wxTextCtrl* m_endXCtrl; + wxStaticText* m_endXUnits; + wxStaticText* m_endYLabel; + wxTextCtrl* m_endYCtrl; + wxStaticText* m_endYUnits; + wxStaticText* m_angleLabel; + wxTextCtrl* m_angleCtrl; + wxStaticText* m_angleUnits; + wxStaticText* m_thicknessLabel; + wxTextCtrl* m_thicknessCtrl; + wxStaticText* m_thicknessUnits; wxStaticText* m_LayerLabel; PCB_LAYER_BOX_SELECTOR* m_LayerSelectionCtrl; wxStaticLine* m_staticline1; diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_for_fp_editor.cpp b/pcbnew/dialogs/dialog_graphic_item_properties_for_fp_editor.cpp deleted file mode 100644 index 46d57a648f..0000000000 --- a/pcbnew/dialogs/dialog_graphic_item_properties_for_fp_editor.cpp +++ /dev/null @@ -1,389 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2012-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -/** - * @file dialog_graphic_item_properties_for_fp_editor.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 graphic items and are not handled here - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -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; - - wxFloatingPointValidator m_AngleValidator; - double m_AngleValue; - -public: - DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES( FOOTPRINT_EDIT_FRAME* aParent, - EDGE_MODULE* aItem ); - ~DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES() {}; - -private: - bool TransferDataToWindow() override; - bool TransferDataFromWindow() override; - void OnLayerChoice( wxCommandEvent& event ); - - void OnInitDlg( wxInitDialogEvent& event ) override - { - // Call the default wxDialog handler of a wxInitDialogEvent - TransferDataToWindow(); - - // Now all widgets have the size fixed, call FinishDialogSettings - FinishDialogSettings(); - } - - bool Validate() override; -}; - -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_AngleValidator( 1, &m_AngleValue ), - m_AngleValue( 0.0 ) -{ - m_parent = aParent; - m_item = aItem; - m_brdSettings = m_parent->GetDesignSettings(); - m_module = m_parent->GetBoard()->m_Modules; - - m_AngleValidator.SetRange( -360.0, 360.0 ); - m_AngleCtrl->SetValidator( m_AngleValidator ); - m_AngleValidator.SetWindow( m_AngleCtrl ); - - SetFocus(); - m_StandardButtonsSizerOK->SetDefault(); - - 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 ); -} - - -bool DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataToWindow() -{ - // Set unit symbol - wxStaticText* texts_unit[] = - { - m_StartPointXUnit, - m_StartPointYUnit, - m_EndPointXUnit, - m_EndPointYUnit, - m_ThicknessTextUnit, - m_DefaulThicknessTextUnit, - }; - - for( size_t ii = 0; ii < DIM( texts_unit ); ii++ ) - { - texts_unit[ii]->SetLabel( GetAbbreviatedUnitsLabel() ); - } - - // Only an arc has a angle parameter. So do not show this parameter for other shapes - if( m_item->GetShape() != S_ARC ) - { - m_AngleText->Show( false ); - m_AngleCtrl->Show( false ); - m_AngleUnit->Show( false ); - } - - wxString msg; - - // Change texts according to the segment shape: - switch( m_item->GetShape() ) - { - case S_CIRCLE: - SetTitle( _( "Circle Properties" ) ); - m_StartPointXLabel->SetLabel( _( "Center X:" ) ); - m_StartPointYLabel->SetLabel( _( "Center Y:" ) ); - m_EndPointXLabel->SetLabel( _( "Radius:" ) ); - m_EndPointYLabel->Show( false ); - m_EndPointYUnit->Show( false ); - m_EndY_Ctrl->Show( false ); - break; - - case S_ARC: - SetTitle( _( "Arc Properties" ) ); - m_StartPointXLabel->SetLabel( _( "Center X:" ) ); - m_StartPointYLabel->SetLabel( _( "Center Y:" ) ); - m_EndPointXLabel->SetLabel( _( "Start Point X:" ) ); - m_EndPointYLabel->SetLabel( _( "Start Point Y:" ) ); - - m_AngleValue = m_item->GetAngle() / 10.0; - break; - - case S_POLYGON: - SetTitle( _( "Polygon Properties" ) ); - m_fgUpperLeftGridSizer->Show( false ); - break; - - case S_SEGMENT: - SetTitle( _( "Line Segment Properties" ) ); - break; - - default: - break; - } - - PutValueInLocalUnits( *m_Center_StartXCtrl, m_item->GetStart().x ); - - PutValueInLocalUnits( *m_Center_StartYCtrl, m_item->GetStart().y ); - - if( m_item->GetShape() == S_CIRCLE ) - { - PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_item->GetRadius() ); - } - else - { - PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_item->GetEnd().x ); - PutValueInLocalUnits( *m_EndY_Ctrl, m_item->GetEnd().y ); - } - - PutValueInLocalUnits( *m_ThicknessCtrl, m_item->GetWidth() ); - - PutValueInLocalUnits( *m_DefaultThicknessCtrl, m_brdSettings.m_ModuleSegmentWidth ); - - // Configure the layers list selector - m_LayerSelectionCtrl->SetLayersHotkeys( false ); - m_LayerSelectionCtrl->SetNotAllowedLayerSet( LSET::InternalCuMask().set( Edge_Cuts ) ); - m_LayerSelectionCtrl->SetBoardFrame( m_parent ); - m_LayerSelectionCtrl->Resync(); - - if( m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() ) < 0 ) - { - wxMessageBox( _( "This item was on an unknown layer.\n" - "It has been moved to the front silk screen layer. Please fix it." ) ); - m_LayerSelectionCtrl->SetLayerSelection( F_SilkS ); - } - - return DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::TransferDataToWindow(); -} - - -void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& event ) -{ -} - - -bool DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataFromWindow() -{ - BOARD_COMMIT commit( m_parent ); - commit.Modify( m_module ); - - if( !DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::TransferDataFromWindow() ) - return false; - - LAYER_NUM layer = m_LayerSelectionCtrl->GetLayerSelection(); - - if( IsCopperLayer( layer ) ) - { - // An graphic item is put on a copper layer. - // This is sometimes useful, for instance for microwave applications ans net tees. - // Because the DRC does not handle graphic items, it can break boards. - // Therefore a confirmation is requested - if( !IsOK( this, - _( "The graphic item will be on a copper layer.\n" - "This is very dangerous because DRC does not handle it.\n" - "Are you sure?" ) ) ) - return false; - } - - wxString msg; - wxPoint coord; - - msg = m_Center_StartXCtrl->GetValue(); - coord.x = ValueFromString( g_UserUnit, msg ); - msg = m_Center_StartYCtrl->GetValue(); - coord.y = ValueFromString( g_UserUnit, msg ); - m_item->SetStart( coord ); - m_item->SetStart0( coord ); - - if( m_item->GetShape() == S_CIRCLE ) - { - msg = m_EndX_Radius_Ctrl->GetValue(); - m_item->SetEnd( coord + wxPoint( ValueFromString( g_UserUnit, msg ), 0 ) ); - m_item->SetEnd0( m_item->GetEnd() ); - } - else - { - msg = m_EndX_Radius_Ctrl->GetValue(); - coord.x = ValueFromString( g_UserUnit, msg ); - msg = m_EndY_Ctrl->GetValue(); - coord.y = ValueFromString( g_UserUnit, msg ); - m_item->SetEnd( coord ); - m_item->SetEnd0( coord ); - } - - msg = m_ThicknessCtrl->GetValue(); - m_item->SetWidth( ValueFromString( g_UserUnit, msg ) ); - - msg = m_DefaultThicknessCtrl->GetValue(); - int thickness = ValueFromString( g_UserUnit, msg ); - m_brdSettings.m_ModuleSegmentWidth = thickness; - m_parent->SetDesignSettings( m_brdSettings ); - m_parent->OnModify(); - - m_item->SetLayer( ToLAYER_ID( layer ) ); - - if( m_item->GetShape() == S_ARC ) - { - m_item->SetAngle( m_AngleValue * 10.0 ); - } - - commit.Push( "Modify footprint graphic item" ); - - m_parent->SetMsgPanel( m_item ); - - return true; -} - - -bool DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::Validate() -{ - wxArrayString error_msgs; - - if( !DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::Validate() ) - return false; - - // Load the start and end points -- all types use these in the checks. - int startx = ValueFromString( g_UserUnit, m_Center_StartXCtrl->GetValue() ); - int starty = ValueFromString( g_UserUnit, m_Center_StartYCtrl->GetValue() ); - int endx = ValueFromString( g_UserUnit, m_EndX_Radius_Ctrl->GetValue() ); - int endy = ValueFromString( g_UserUnit, m_EndY_Ctrl->GetValue() ); - - // Type specific checks. - switch( m_item->GetShape() ) - { - case S_ARC: - // Check angle of arc. - double angle; - m_AngleCtrl->GetValue().ToDouble( &angle ); - - if( angle == 0.0 ) - { - error_msgs.Add( _( "The arc angle cannot be zero." ) ); - } - - // Fall through. - case S_CIRCLE: - // Check radius. - if( (startx == endx) && (starty == endy) ) - { - error_msgs.Add( _( "The radius must be greater than zero." ) ); - } - - break; - - case S_POLYGON: - break; - - default: - // Check start and end are not the same. - if( (startx == endx) && (starty == endy) ) - { - error_msgs.Add( _( "The start and end points cannot be the same." ) ); - } - - break; - } - - // Check the item thickness. Note the polygon outline thickness is allowed - // to be set to 0, because if the shape is exactly the polygon, its outline - // thickness must be 0 - int thickness = ValueFromString( g_UserUnit, m_ThicknessCtrl->GetValue() ); - - if( m_item->GetShape() == S_POLYGON ) - { - if( thickness < 0 ) - error_msgs.Add( _( "The polygon outline thickness must be >= 0." ) ); - } - else if( thickness <= 0 ) - error_msgs.Add( _( "The item thickness must be greater than zero." ) ); - - // And the default thickness. - thickness = ValueFromString( g_UserUnit, m_DefaultThicknessCtrl->GetValue() ); - - if( thickness <= 0 ) - error_msgs.Add( _( "The default thickness must be greater than zero." ) ); - - if( error_msgs.GetCount() ) - { - HTML_MESSAGE_BOX dlg( this, _( "Error List" ) ); - dlg.ListSet( error_msgs ); - dlg.ShowModal(); - } - - return error_msgs.GetCount() == 0; -} diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index e40649c97e..7080c4eb56 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1144,14 +1144,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_EDIT_DRAWING: -#ifndef USE_WX_OVERLAY - InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) GetCurItem(), &dc ); -#else - // #1277772 - Draw into dialog converted in refresh request - InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) GetCurItem(), NULL ); - m_canvas->Refresh(); -#endif - m_canvas->MoveCursorToCrossHair(); + InstallGraphicItemPropertiesDialog( GetCurItem(), &dc ); break; case ID_POPUP_PCB_MOVE_DRAWING_REQUEST: diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h index 37ebea58bd..f5ff45938a 100644 --- a/pcbnew/footprint_edit_frame.h +++ b/pcbnew/footprint_edit_frame.h @@ -391,13 +391,6 @@ 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 * changes pad characteristics for the given footprint diff --git a/pcbnew/footprint_editor_onclick.cpp b/pcbnew/footprint_editor_onclick.cpp index 333d9cb8a8..611d7b30ca 100644 --- a/pcbnew/footprint_editor_onclick.cpp +++ b/pcbnew/footprint_editor_onclick.cpp @@ -548,9 +548,7 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ) break; case PCB_MODULE_EDGE_T : - m_canvas->MoveCursorToCrossHair(); - InstallFootprintBodyItemPropertiesDlg( static_cast( aItem ) ); - m_canvas->Refresh(); + InstallGraphicItemPropertiesDialog( aItem, nullptr ); break; default: diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index 9a947d042f..83c8a5fd3f 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -730,9 +730,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_MODEDIT_EDIT_BODY_ITEM : - m_canvas->MoveCursorToCrossHair(); - InstallFootprintBodyItemPropertiesDlg( (EDGE_MODULE*) GetScreen()->GetCurItem() ); - m_canvas->Refresh(); + InstallGraphicItemPropertiesDialog( GetScreen()->GetCurItem(), nullptr ); break; case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE: diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp index 8dd2b0507e..9159b585ee 100644 --- a/pcbnew/onleftclick.cpp +++ b/pcbnew/onleftclick.cpp @@ -609,7 +609,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ) break; case PCB_LINE_T: - InstallGraphicItemPropertiesDialog( static_cast( aItem ), aDC ); + InstallGraphicItemPropertiesDialog( aItem, aDC ); break; case PCB_ZONE_AREA_T: diff --git a/pcbnew/pcb_base_edit_frame.h b/pcbnew/pcb_base_edit_frame.h index 64ecbab79f..80a14bc03f 100644 --- a/pcbnew/pcb_base_edit_frame.h +++ b/pcbnew/pcb_base_edit_frame.h @@ -158,6 +158,8 @@ public: */ void SetRotationAngle( int aRotationAngle ); + void InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem, wxDC* aDC ); + ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas() void UseGalCanvas( bool aEnable ) override; diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 3bb2a6a8df..0adfa6614c 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -1100,7 +1100,6 @@ public: // Graphic Segments type DRAWSEGMENT void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ); void Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ); - void InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC ); // Footprint edition (see also PCB_BASE_FRAME) void InstallFootprintPropertiesDialog( MODULE* Module, wxDC* DC );