From 580d42a63ed2c316af638b79450b26365aad8644 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 3 Sep 2013 21:37:52 +0200 Subject: [PATCH] pcbnew: fix wxWidgets 2.8 compatibility issue (temporary fix, still have a minor cosmetic issue), and add missing file. --- pcbnew/class_pcb_layer_box_selector.cpp | 2 +- .../dialog_graphic_item_properties_base.cpp | 20 +- .../dialog_graphic_item_properties_base.fbp | 32 +- .../dialog_graphic_item_properties_base.h | 2 +- .../dialogs/dialog_layer_selection_base.cpp | 12 +- .../dialogs/dialog_layer_selection_base.fbp | 1143 +++++++++++++++++ pcbnew/dialogs/dialog_layer_selection_base.h | 4 +- pcbnew/hotkeys_module_editor.cpp | 6 + pcbnew/modedit.cpp | 14 - pcbnew/modedit_onclick.cpp | 27 +- pcbnew/moduleframe.cpp | 4 - pcbnew/pcbnew_id.h | 3 +- pcbnew/sel_layer.cpp | 61 +- 13 files changed, 1212 insertions(+), 118 deletions(-) create mode 100644 pcbnew/dialogs/dialog_layer_selection_base.fbp diff --git a/pcbnew/class_pcb_layer_box_selector.cpp b/pcbnew/class_pcb_layer_box_selector.cpp index 4e4bc1f96d..fb68ddbdb7 100644 --- a/pcbnew/class_pcb_layer_box_selector.cpp +++ b/pcbnew/class_pcb_layer_box_selector.cpp @@ -85,7 +85,7 @@ void PCB_LAYER_BOX_SELECTOR::Resync() } minwidth += BM_SIZE + 35; // Take in account the bitmap size and margins - SetMinClientSize( wxSize( minwidth, -1 ) ); + SetMinSize( wxSize( minwidth, -1 ) ); } diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp b/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp index 3aa70b5b7b..08498ae2a7 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp @@ -85,7 +85,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind bUpperRightSizer = new wxBoxSizer( wxVERTICAL ); wxFlexGridSizer* fgUpperRightGridSizer; - fgUpperRightGridSizer = new wxFlexGridSizer( 3, 3, 0, 0 ); + fgUpperRightGridSizer = new wxFlexGridSizer( 0, 3, 0, 0 ); fgUpperRightGridSizer->AddGrowableCol( 1 ); fgUpperRightGridSizer->SetFlexibleDirection( wxBOTH ); fgUpperRightGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); @@ -126,24 +126,18 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind 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 ); + fgUpperRightGridSizer->Add( m_LayerLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 ); m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - fgLowerRightSizer->Add( m_LayerSelectionCtrl, 0, wxALL, 5 ); + fgUpperRightGridSizer->Add( m_LayerSelectionCtrl, 0, wxALL, 5 ); - bUpperRightSizer->Add( fgLowerRightSizer, 1, wxEXPAND, 5 ); + fgUpperRightGridSizer->Add( 0, 0, 1, wxEXPAND, 5 ); + + + bUpperRightSizer->Add( fgUpperRightGridSizer, 0, wxEXPAND, 5 ); bUpperSizer->Add( bUpperRightSizer, 1, wxEXPAND, 5 ); diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp b/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp index b538865a4a..f661130d58 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp @@ -42,7 +42,7 @@ -1,-1 DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE - 537,215 + 576,215 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU DIALOG_SHIM; dialog_shim.h Graphic Item Properties @@ -1250,7 +1250,7 @@ fgUpperRightGridSizer wxFLEX_GROWMODE_SPECIFIED none - 3 + 0 0 5 @@ -2023,24 +2023,6 @@ - - - - 5 - wxEXPAND - 1 - - 2 - wxBOTH - 1 - - 0 - - fgLowerRightSizer - wxFLEX_GROWMODE_SPECIFIED - none - 1 - 0 5 wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT @@ -2215,6 +2197,16 @@ + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_base.h b/pcbnew/dialogs/dialog_graphic_item_properties_base.h index bb78ca4782..33857856d5 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_base.h +++ b/pcbnew/dialogs/dialog_graphic_item_properties_base.h @@ -76,7 +76,7 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE : public DIALOG_SHIM 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( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Graphic Item Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 576,215 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU ); ~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE(); }; diff --git a/pcbnew/dialogs/dialog_layer_selection_base.cpp b/pcbnew/dialogs/dialog_layer_selection_base.cpp index ccb42218d5..37e90f562b 100644 --- a/pcbnew/dialogs/dialog_layer_selection_base.cpp +++ b/pcbnew/dialogs/dialog_layer_selection_base.cpp @@ -22,7 +22,7 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi m_leftGridLayers = new wxGrid( this, ID_LEFT_LIST, wxDefaultPosition, wxDefaultSize, 0 ); // Grid - m_leftGridLayers->CreateGrid( 1, 4 ); + m_leftGridLayers->CreateGrid( 1, 3 ); m_leftGridLayers->EnableEditing( false ); m_leftGridLayers->EnableGridLines( true ); m_leftGridLayers->EnableDragGridSize( false ); @@ -45,12 +45,12 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi // Cell Defaults m_leftGridLayers->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) ); m_leftGridLayers->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - bSizerUpper->Add( m_leftGridLayers, 0, wxALL|wxEXPAND, 5 ); + bSizerUpper->Add( m_leftGridLayers, 1, wxALL|wxEXPAND, 5 ); m_rightGridLayers = new wxGrid( this, ID_RIGHT_LIST, wxDefaultPosition, wxDefaultSize, 0 ); // Grid - m_rightGridLayers->CreateGrid( 1, 4 ); + m_rightGridLayers->CreateGrid( 1, 3 ); m_rightGridLayers->EnableEditing( false ); m_rightGridLayers->EnableGridLines( true ); m_rightGridLayers->EnableDragGridSize( false ); @@ -72,7 +72,7 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi // Cell Defaults m_rightGridLayers->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) ); m_rightGridLayers->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - bSizerUpper->Add( m_rightGridLayers, 0, wxALL|wxEXPAND, 5 ); + bSizerUpper->Add( m_rightGridLayers, 1, wxALL|wxEXPAND, 5 ); bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 ); @@ -121,7 +121,7 @@ DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE m_leftGridLayers = new wxGrid( this, ID_LEFT_LIST, wxDefaultPosition, wxDefaultSize, 0 ); // Grid - m_leftGridLayers->CreateGrid( 1, 4 ); + m_leftGridLayers->CreateGrid( 1, 3 ); m_leftGridLayers->EnableEditing( false ); m_leftGridLayers->EnableGridLines( true ); m_leftGridLayers->EnableDragGridSize( false ); @@ -159,7 +159,7 @@ DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE m_rightGridLayers = new wxGrid( this, ID_RIGHT_LIST, wxDefaultPosition, wxDefaultSize, 0 ); // Grid - m_rightGridLayers->CreateGrid( 1, 4 ); + m_rightGridLayers->CreateGrid( 1, 3 ); m_rightGridLayers->EnableEditing( false ); m_rightGridLayers->EnableGridLines( true ); m_rightGridLayers->EnableDragGridSize( false ); diff --git a/pcbnew/dialogs/dialog_layer_selection_base.fbp b/pcbnew/dialogs/dialog_layer_selection_base.fbp new file mode 100644 index 0000000000..2a702b9e3c --- /dev/null +++ b/pcbnew/dialogs/dialog_layer_selection_base.fbp @@ -0,0 +1,1143 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_layer_selection_base + 1000 + none + 1 + dialog_layer_selection_base + + . + + 1 + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_LAYER_SELECTION_BASE + + 337,183 + wxDEFAULT_DIALOG_STYLE + + Select Layer: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizerUpper + wxHORIZONTAL + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + wxSYS_COLOUR_MENU + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + 3 + + + 1 + 0 + Dock + 0 + Left + 0 + 0 + 0 + 0 + 0 + 1 + + 1 + + + 1 + 0 + 0 + ID_LEFT_LIST + wxSYS_COLOUR_WINDOW + + + 3 + 0 + + 0 + + + 0 + + 1 + m_leftGridLayers + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + + 1 + 1 + + + 0 + + + + + + + + + OnLeftGridClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + wxSYS_COLOUR_MENU + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + 3 + + + 1 + 0 + Dock + 0 + Left + 0 + 0 + 0 + 0 + 0 + 1 + + 1 + + + 1 + 0 + 0 + ID_RIGHT_LIST + + + + 3 + 0 + + 0 + + + 0 + + 1 + m_rightGridLayers + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + + 1 + 1 + + + 0 + + + + + + + + + OnRightGridClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_RIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Clear Selection + + 0 + + + 0 + + 1 + m_buttonClear + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnClearSelection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE + + 400,175 + wxDEFAULT_DIALOG_STYLE + + Select Copper Layer Pair: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizerUpper + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizerLeft + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Top/Front Layer + + 0 + + + 0 + + 1 + m_staticTextTopLayer + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + wxSYS_COLOUR_MENU + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + 3 + + + 1 + 0 + Dock + 0 + Left + 0 + 0 + 0 + 0 + 0 + 1 + + 1 + + + 1 + 0 + 0 + ID_LEFT_LIST + wxSYS_COLOUR_WINDOW + + + 3 + 0 + + 0 + + + 0 + + 1 + m_leftGridLayers + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + + 1 + 1 + + + 0 + + + + + + + + + OnLeftGridClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerRight + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Bottom/Back Layer + + 0 + + + 0 + + 1 + m_staticTextBottomLayer + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + wxSYS_COLOUR_MENU + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + 3 + + + 1 + 0 + Dock + 0 + Left + 0 + 0 + 0 + 0 + 0 + 1 + + 1 + + + 1 + 0 + 0 + ID_RIGHT_LIST + + + + 3 + 0 + + 0 + + + 0 + + 1 + m_rightGridLayers + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + + 1 + 1 + + + 0 + + + + + + + + + OnRightGridClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + OnCancelClick + + + + OnOKClick + + + + + + + + diff --git a/pcbnew/dialogs/dialog_layer_selection_base.h b/pcbnew/dialogs/dialog_layer_selection_base.h index a124524afa..4a2b40f2ac 100644 --- a/pcbnew/dialogs/dialog_layer_selection_base.h +++ b/pcbnew/dialogs/dialog_layer_selection_base.h @@ -48,7 +48,7 @@ class DIALOG_LAYER_SELECTION_BASE : public wxDialog public: - DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Layer:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 452,183 ), long style = wxCAPTION|wxCLOSE_BOX ); + DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Layer:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 337,183 ), long style = wxDEFAULT_DIALOG_STYLE ); ~DIALOG_LAYER_SELECTION_BASE(); }; @@ -79,7 +79,7 @@ class DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE : public wxDialog public: - DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Cpper Layer Pair:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 332,175 ), long style = wxDEFAULT_DIALOG_STYLE ); + DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Copper Layer Pair:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 400,175 ), long style = wxDEFAULT_DIALOG_STYLE ); ~DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE(); }; diff --git a/pcbnew/hotkeys_module_editor.cpp b/pcbnew/hotkeys_module_editor.cpp index 0bff61af9e..2e2adcd11c 100644 --- a/pcbnew/hotkeys_module_editor.cpp +++ b/pcbnew/hotkeys_module_editor.cpp @@ -166,6 +166,12 @@ bool FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand ) break; + case PCB_MODULE_EDGE_T: + if( aIdCommand == HK_EDIT_ITEM ) + evt_type = ID_POPUP_MODEDIT_EDIT_BODY_ITEM; + + break; + default: break; } diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index ca026f9f11..37fc32f77f 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -214,9 +214,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_STOP_CURRENT_DRAWING: 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_PCB_DELETE_EDGE: @@ -670,24 +668,12 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) 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_MODEDIT_EDIT_WIDTH_ALL_EDGE: m_canvas->MoveCursorToCrossHair(); Edit_Edge_Width( NULL ); m_canvas->Refresh(); break; - 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_MODEDIT_EDIT_LAYER_ALL_EDGE: m_canvas->MoveCursorToCrossHair(); Edit_Edge_Layer( NULL ); diff --git a/pcbnew/modedit_onclick.cpp b/pcbnew/modedit_onclick.cpp index 145959aa6d..8418b01725 100644 --- a/pcbnew/modedit_onclick.cpp +++ b/pcbnew/modedit_onclick.cpp @@ -331,7 +331,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen if( !flags ) { - msg = AddHotkeyName( _("Move edge" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM ); + msg = AddHotkeyName( _("Move Edge" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM ); AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_EDGE, msg, KiBitmap( move_line_xpm ) ); } @@ -339,21 +339,20 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_EDGE, _( "Place edge" ), KiBitmap( apply_xpm ) ); - wxMenu* edit_mnu = new wxMenu; - 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 ); + msg = AddHotkeyName( _("Edit" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM ); + AddMenuItem( PopMenu, ID_POPUP_MODEDIT_EDIT_BODY_ITEM, + msg, KiBitmap( options_segment_xpm ) ); + msg = AddHotkeyName( _("Delete Edge" ), g_Module_Editor_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_EDGE, msg, KiBitmap( delete_xpm ) ); + + wxMenu* edit_global_mnu = new wxMenu; + AddMenuItem( PopMenu, edit_global_mnu, ID_POPUP_MODEDIT_GLOBAL_EDIT_EDGE, + _( "Global Changes" ), KiBitmap( edit_xpm ) ); + AddMenuItem( edit_global_mnu, ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE, + _( "Change Body Items Width" ), KiBitmap( width_segment_xpm ) ); + AddMenuItem( edit_global_mnu, ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE, + _( "Change Body Items Layer" ), KiBitmap( select_layer_pair_xpm ) ); } break; diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 4e9834fb72..fed5c049e1 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -115,12 +115,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU( ID_POPUP_MODEDIT_EDIT_BODY_ITEM, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) - EVT_MENU( ID_POPUP_MODEDIT_EDIT_WIDTH_CURRENT_EDGE, - 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 ) diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index f4e5caa83b..8d89a6116a 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -312,9 +312,8 @@ enum pcbnew_ids ID_MODEDIT_PLACE_GRID_COORD, // ID used in module editor: - ID_POPUP_MODEDIT_EDIT_WIDTH_CURRENT_EDGE, + ID_POPUP_MODEDIT_GLOBAL_EDIT_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, diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 0634c7fb28..fc8ebc10e1 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -83,6 +83,8 @@ class PCB_ONE_LAYER_SELECTOR : public PCB_LAYER_SELECTOR, LAYER_NUM m_layerSelected; LAYER_NUM m_minLayer; LAYER_NUM m_maxLayer; + std::vector m_layersIdLeftColumn; + std::vector m_layersIdRightColumn; public: PCB_ONE_LAYER_SELECTOR( wxWindow* aParent, BOARD * aBrd, @@ -122,25 +124,17 @@ private: #define SELECT_COLNUM 0 #define COLOR_COLNUM 1 #define LAYERNAME_COLNUM 2 -#define LAYERID_COLNUM 3 static DECLARE_LAYERS_ORDER_LIST( layertranscode ); void PCB_ONE_LAYER_SELECTOR::BuildList() { - m_leftGridLayers->SetColFormatNumber( LAYERID_COLNUM ); - m_rightGridLayers->SetColFormatNumber( LAYERID_COLNUM ); - m_leftGridLayers->HideCol( LAYERID_COLNUM ); - m_rightGridLayers->HideCol( LAYERID_COLNUM ); + // Hide layerid column which is used only to know the layer id + // not to be shown in dialogs m_leftGridLayers->SetColSize( COLOR_COLNUM, 20 ); m_rightGridLayers->SetColSize( COLOR_COLNUM, 20 ); - // Select a not show cell, to avoid a wrong cell selection for user - m_leftGridLayers->GoToCell( 0, LAYERID_COLNUM ); - m_rightGridLayers->GoToCell( 0, LAYERID_COLNUM ); - int left_row = 0; int right_row = 0; - wxString layernum; wxString layername; for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i ) { @@ -160,7 +154,6 @@ void PCB_ONE_LAYER_SELECTOR::BuildList() wxColour color = MakeColour( GetLayerColor( layerid ) ); layername = GetLayerName( layerid ); - layernum.Printf( wxT("%d"), layerid ); if( layerid <= LAST_COPPER_LAYER ) { @@ -171,8 +164,6 @@ void PCB_ONE_LAYER_SELECTOR::BuildList() color ); m_leftGridLayers->SetCellValue( left_row, LAYERNAME_COLNUM, layername ); - m_leftGridLayers->SetCellValue( left_row, LAYERID_COLNUM, - layernum ); if( m_layerSelected == layerid ) { @@ -180,8 +171,10 @@ void PCB_ONE_LAYER_SELECTOR::BuildList() wxT("X") ); m_leftGridLayers->SetCellBackgroundColour ( left_row, SELECT_COLNUM, color ); + m_leftGridLayers->SetGridCursor( left_row, LAYERNAME_COLNUM ); } + m_layersIdLeftColumn.push_back( layerid ); left_row++; } else @@ -193,8 +186,6 @@ void PCB_ONE_LAYER_SELECTOR::BuildList() color ); m_rightGridLayers->SetCellValue( right_row, LAYERNAME_COLNUM, layername ); - m_rightGridLayers->SetCellValue( right_row, LAYERID_COLNUM, - layernum ); if( m_layerSelected == layerid ) { @@ -202,8 +193,10 @@ void PCB_ONE_LAYER_SELECTOR::BuildList() wxT("X") ); m_rightGridLayers->SetCellBackgroundColour ( right_row, SELECT_COLNUM, color ); + m_rightGridLayers->SetGridCursor( right_row, LAYERNAME_COLNUM ); } + m_layersIdRightColumn.push_back( layerid ); right_row++; } } @@ -223,19 +216,13 @@ void PCB_ONE_LAYER_SELECTOR::BuildList() void PCB_ONE_LAYER_SELECTOR::OnLeftGridClick( wxGridEvent& event ) { - wxString text = m_leftGridLayers->GetCellValue(event.GetRow(), LAYERID_COLNUM); - long layer; - text.ToLong( &layer ); - m_layerSelected = layer; + m_layerSelected = m_layersIdLeftColumn[ event.GetRow() ]; EndModal( 1 ); } void PCB_ONE_LAYER_SELECTOR::OnRightGridClick( wxGridEvent& event ) { - wxString text = m_rightGridLayers->GetCellValue(event.GetRow(), LAYERID_COLNUM); - long layer; - text.ToLong( &layer ); - m_layerSelected = layer; + m_layerSelected = m_layersIdRightColumn[ event.GetRow() ]; EndModal( 2 ); } @@ -283,6 +270,7 @@ private: LAYER_NUM m_backLayer; int m_leftRowSelected; int m_rightRowSelected; + std::vector m_layersId; public: SELECT_COPPER_LAYERS_PAIR_DIALOG( wxWindow* aParent, BOARD * aPcb, @@ -354,20 +342,14 @@ SELECT_COPPER_LAYERS_PAIR_DIALOG:: void SELECT_COPPER_LAYERS_PAIR_DIALOG::BuildList() { - m_leftGridLayers->SetColFormatNumber( LAYERID_COLNUM ); - m_rightGridLayers->SetColFormatNumber( LAYERID_COLNUM ); - m_leftGridLayers->HideCol( LAYERID_COLNUM ); - m_rightGridLayers->HideCol( LAYERID_COLNUM ); m_leftGridLayers->SetColSize( COLOR_COLNUM, 20 ); m_rightGridLayers->SetColSize( COLOR_COLNUM, 20 ); // Select a not show cell, to avoid a wrong cell selection for user - m_leftGridLayers->GoToCell( 0, LAYERID_COLNUM ); - m_rightGridLayers->GoToCell( 0, LAYERID_COLNUM ); int row = 0; - wxString layernum; wxString layername; + for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i ) { LAYER_NUM layerid = i; @@ -383,16 +365,15 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::BuildList() wxColour color = MakeColour( GetLayerColor( layerid ) ); layername = GetLayerName( layerid ); - layernum.Printf( wxT("%d"), layerid ); if( row ) m_leftGridLayers->AppendRows( 1 ); + m_leftGridLayers->SetCellBackgroundColour ( row, COLOR_COLNUM, color ); m_leftGridLayers->SetCellValue( row, LAYERNAME_COLNUM, layername ); - m_leftGridLayers->SetCellValue( row, LAYERID_COLNUM, - layernum ); + m_layersId.push_back( layerid ); if( m_frontLayer == layerid ) { @@ -401,6 +382,7 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::BuildList() m_leftGridLayers->SetCellBackgroundColour( row, SELECT_COLNUM, color ); m_leftRowSelected = row; + m_leftGridLayers->SetGridCursor( row, LAYERNAME_COLNUM ); } if( row ) @@ -409,8 +391,6 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::BuildList() color ); m_rightGridLayers->SetCellValue( row, LAYERNAME_COLNUM, layername ); - m_rightGridLayers->SetCellValue( row, LAYERID_COLNUM, - layernum ); if( m_backLayer == layerid ) { @@ -419,6 +399,7 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::BuildList() m_rightGridLayers->SetCellBackgroundColour ( row, SELECT_COLNUM, color ); m_rightRowSelected = row; + m_rightGridLayers->SetGridCursor( row, LAYERNAME_COLNUM ); } row++; @@ -433,9 +414,7 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::BuildList() void SELECT_COPPER_LAYERS_PAIR_DIALOG::OnLeftGridClick( wxGridEvent& event ) { int row = event.GetRow(); - wxString text = m_leftGridLayers->GetCellValue( row, LAYERID_COLNUM ); - long layer; - text.ToLong( &layer ); + LAYER_NUM layer = m_layersId[row]; if( m_frontLayer == layer ) return; @@ -452,14 +431,13 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::OnLeftGridClick( wxGridEvent& event ) m_leftGridLayers->SetCellBackgroundColour( row, SELECT_COLNUM, MakeColour( GetLayerColor( layer ) ) ); + m_leftGridLayers->SetGridCursor( row, LAYERNAME_COLNUM ); } void SELECT_COPPER_LAYERS_PAIR_DIALOG::OnRightGridClick( wxGridEvent& event ) { int row = event.GetRow(); - wxString text = m_rightGridLayers->GetCellValue( row, LAYERID_COLNUM ); - long layer; - text.ToLong( &layer ); + LAYER_NUM layer = m_layersId[row]; if( m_backLayer == layer ) return; @@ -475,4 +453,5 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::OnRightGridClick( wxGridEvent& event ) wxT("X") ); m_rightGridLayers->SetCellBackgroundColour ( row, SELECT_COLNUM, MakeColour( GetLayerColor( layer ) ) ); + m_rightGridLayers->SetGridCursor( row, LAYERNAME_COLNUM ); }