From 1311f81448c8fb2dddd49d56e5ae8440e6c9f6af Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 2 Jul 2015 11:50:38 +0200 Subject: [PATCH] Replace wxComboBoxes by wxChoice in auxiliary horizontal toolbar, to try to avoid issues on OSX. --- common/draw_frame.cpp | 2 +- include/draw_frame.h | 4 ++-- include/wxPcbStruct.h | 4 ++-- pcbnew/basepcbframe.cpp | 8 ++++---- pcbnew/moduleframe.cpp | 4 ++-- pcbnew/pcbframe.cpp | 8 ++++---- pcbnew/tool_modedit.cpp | 12 ++++-------- pcbnew/tool_pcb.cpp | 21 ++++++++------------- 8 files changed, 27 insertions(+), 36 deletions(-) diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index 37fc1b3106..3b01cc4691 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -379,7 +379,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event ) int* clientData; int eventId = ID_POPUP_GRID_LEVEL_100; - if( event.GetEventType() == wxEVT_COMMAND_COMBOBOX_SELECTED ) + if( event.GetEventType() == wxEVT_CHOICE ) { if( m_gridSelectBox == NULL ) // Should not happen return; diff --git a/include/draw_frame.h b/include/draw_frame.h index 8c1d8cf42b..ad35c5a4a5 100644 --- a/include/draw_frame.h +++ b/include/draw_frame.h @@ -97,10 +97,10 @@ protected: bool m_showBorderAndTitleBlock; /// Choice box to choose the grid size. - wxComboBox* m_gridSelectBox; + wxChoice* m_gridSelectBox; /// Choice box to choose the zoom value. - wxComboBox* m_zoomSelectBox; + wxChoice* m_zoomSelectBox; /// The tool bar that contains the buttons for quick access to the application draw /// tools. It typically is located on the right side of the main window. diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 53689c40c1..5835dab0fa 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -217,8 +217,8 @@ protected: public: PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer - wxComboBox* m_SelTrackWidthBox; // a combo box to display and select current track width - wxComboBox* m_SelViaSizeBox; // a combo box to display and select current via diameter + wxChoice* m_SelTrackWidthBox; // a choice box to display and select current track width + wxChoice* m_SelViaSizeBox; // a choice box to display and select current via diameter bool m_show_microwave_tools; bool m_show_layer_manager_tools; diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 33d0482424..852c9f881c 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -858,7 +858,7 @@ void PCB_BASE_FRAME::SetFastGrid1() if( m_gridSelectBox ) { - wxCommandEvent cmd( wxEVT_COMMAND_COMBOBOX_SELECTED ); + wxCommandEvent cmd( wxEVT_CHOICE ); cmd.SetEventObject( this ); OnSelectGrid( cmd ); } @@ -877,7 +877,7 @@ void PCB_BASE_FRAME::SetFastGrid2() if( m_gridSelectBox ) { - wxCommandEvent cmd( wxEVT_COMMAND_COMBOBOX_SELECTED ); + wxCommandEvent cmd( wxEVT_CHOICE ); cmd.SetEventObject( this ); OnSelectGrid( cmd ); } @@ -891,7 +891,7 @@ void PCB_BASE_FRAME::SetNextGrid() if( m_gridSelectBox ) { - wxCommandEvent cmd( wxEVT_COMMAND_COMBOBOX_SELECTED ); + wxCommandEvent cmd( wxEVT_CHOICE ); cmd.SetEventObject( this ); OnSelectGrid( cmd ); } @@ -906,7 +906,7 @@ void PCB_BASE_FRAME::SetPrevGrid() if( m_gridSelectBox ) { - wxCommandEvent cmd( wxEVT_COMMAND_COMBOBOX_SELECTED ); + wxCommandEvent cmd( wxEVT_CHOICE ); cmd.SetEventObject( this ); OnSelectGrid( cmd ); } diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 336dcf4cdf..9aa87c171b 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -77,8 +77,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) EVT_SIZE( FOOTPRINT_EDIT_FRAME::OnSize ) - EVT_COMBOBOX( ID_ON_ZOOM_SELECT, FOOTPRINT_EDIT_FRAME::OnSelectZoom ) - EVT_COMBOBOX( ID_ON_GRID_SELECT, FOOTPRINT_EDIT_FRAME::OnSelectGrid ) + EVT_CHOICE( ID_ON_ZOOM_SELECT, FOOTPRINT_EDIT_FRAME::OnSelectZoom ) + EVT_CHOICE( ID_ON_GRID_SELECT, FOOTPRINT_EDIT_FRAME::OnSelectGrid ) EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 158830c764..2d27828fb7 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -92,8 +92,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, PCB_EDIT_FRAME::OnSockRequestServer ) EVT_SOCKET( ID_EDA_SOCKET_EVENT, PCB_EDIT_FRAME::OnSockRequest ) - EVT_COMBOBOX( ID_ON_ZOOM_SELECT, PCB_EDIT_FRAME::OnSelectZoom ) - EVT_COMBOBOX( ID_ON_GRID_SELECT, PCB_EDIT_FRAME::OnSelectGrid ) + EVT_CHOICE( ID_ON_ZOOM_SELECT, PCB_EDIT_FRAME::OnSelectZoom ) + EVT_CHOICE( ID_ON_GRID_SELECT, PCB_EDIT_FRAME::OnSelectGrid ) EVT_CLOSE( PCB_EDIT_FRAME::OnCloseWindow ) EVT_SIZE( PCB_EDIT_FRAME::OnSize ) @@ -201,8 +201,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event ) EVT_COMBOBOX( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::Process_Special_Functions ) - EVT_COMBOBOX( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event ) - EVT_COMBOBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event ) + EVT_CHOICE( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event ) + EVT_CHOICE( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event ) EVT_TOOL( ID_TOOLBARH_PCB_MODE_MODULE, PCB_EDIT_FRAME::OnSelectAutoPlaceMode ) EVT_TOOL( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::OnSelectAutoPlaceMode ) EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, PCB_EDIT_FRAME::Access_to_External_Tool ) diff --git a/pcbnew/tool_modedit.cpp b/pcbnew/tool_modedit.cpp index 94ca85c075..19b1de319c 100644 --- a/pcbnew/tool_modedit.cpp +++ b/pcbnew/tool_modedit.cpp @@ -247,8 +247,6 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar() void FOOTPRINT_EDIT_FRAME::ReCreateAuxiliaryToolbar() { - wxString msg; - if( m_auxiliaryToolBar ) return; @@ -259,22 +257,20 @@ void FOOTPRINT_EDIT_FRAME::ReCreateAuxiliaryToolbar() m_auxiliaryToolBar->AddSeparator(); // Grid selection choice box. - m_gridSelectBox = new wxComboBox( m_auxiliaryToolBar, + m_gridSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_GRID_SELECT, - wxEmptyString, wxDefaultPosition, wxDefaultSize, - 0, NULL, wxCB_READONLY ); + 0, NULL ); // Update tool bar to reflect setting. updateGridSelectBox(); m_auxiliaryToolBar->AddControl( m_gridSelectBox ); // Zoom selection choice box. m_auxiliaryToolBar->AddSeparator(); - m_zoomSelectBox = new wxComboBox( m_auxiliaryToolBar, + m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_ZOOM_SELECT, - wxEmptyString, wxDefaultPosition, wxDefaultSize, - 0, NULL, wxCB_READONLY ); + 0, NULL ); updateZoomSelectBox(); m_auxiliaryToolBar->AddControl( m_zoomSelectBox ); diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 3f6553b1de..0cb40d55ae 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -565,21 +565,18 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar() /* Set up toolbar items */ // Creates box to display and choose tracks widths: - m_SelTrackWidthBox = new wxComboBox( m_auxiliaryToolBar, + m_SelTrackWidthBox = new wxChoice( m_auxiliaryToolBar, ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, - wxEmptyString, wxDefaultPosition, wxDefaultSize, - 0, NULL, wxCB_READONLY ); + 0, NULL ); updateTraceWidthSelectBox(); m_auxiliaryToolBar->AddControl( m_SelTrackWidthBox ); -// m_auxiliaryToolBar->AddSeparator(); // Creates box to display and choose vias diameters: - m_SelViaSizeBox = new wxComboBox( m_auxiliaryToolBar, + m_SelViaSizeBox = new wxChoice( m_auxiliaryToolBar, ID_AUX_TOOLBAR_PCB_VIA_SIZE, - wxEmptyString, wxDefaultPosition, wxDefaultSize, - 0, NULL, wxCB_READONLY ); + 0, NULL ); updateViaSizeSelectBox(); m_auxiliaryToolBar->AddControl( m_SelViaSizeBox ); m_auxiliaryToolBar->AddSeparator(); @@ -594,21 +591,19 @@ an existing track use its width\notherwise, use current width setting" ), // Add the box to display and select the current grid size: m_auxiliaryToolBar->AddSeparator(); - m_gridSelectBox = new wxComboBox( m_auxiliaryToolBar, + m_gridSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_GRID_SELECT, - wxEmptyString, wxDefaultPosition, wxDefaultSize, - 0, NULL, wxCB_READONLY ); + 0, NULL ); updateGridSelectBox(); m_auxiliaryToolBar->AddControl( m_gridSelectBox ); // Add the box to display and select the current Zoom m_auxiliaryToolBar->AddSeparator(); - m_zoomSelectBox = new wxComboBox( m_auxiliaryToolBar, + m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_ZOOM_SELECT, - wxEmptyString, wxDefaultPosition, wxDefaultSize, - 0, NULL, wxCB_READONLY ); + 0, NULL ); updateZoomSelectBox(); m_auxiliaryToolBar->AddControl( m_zoomSelectBox );