Replace WinEDAChoiceBox with wxComboBox.

This commit is contained in:
Wayne Stambaugh 2011-04-19 15:19:41 -04:00
parent cb3e36f04b
commit dcccaee2aa
19 changed files with 82 additions and 112 deletions

View File

@ -360,7 +360,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
if( m_SelZoomBox == NULL )
return; // Should not happen!
int id = m_SelZoomBox->GetChoice();
int id = m_SelZoomBox->GetCurrentSelection();
if( id < 0 || !( id < (int)m_SelZoomBox->GetCount() ) )
return;

View File

@ -101,8 +101,8 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( CreateNewLibAndSavePartId, LIB_EDIT_FRAME::OnExportPart )
EVT_TOOL( ImportPartId, LIB_EDIT_FRAME::OnImportPart )
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_PART_NUMBER, LIB_EDIT_FRAME::OnSelectPart )
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnSelectAlias )
EVT_COMBOBOX( ID_LIBEDIT_SELECT_PART_NUMBER, LIB_EDIT_FRAME::OnSelectPart )
EVT_COMBOBOX( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnSelectAlias )
/* Right vertical toolbar. */
EVT_TOOL( ID_NO_TOOL_SELECTED, LIB_EDIT_FRAME::OnSelectTool )

View File

@ -28,8 +28,8 @@ class LIB_EDIT_FRAME : public EDA_DRAW_FRAME
LIB_COMPONENT* m_tempCopyComponent; ///< Temporary copy of current component during edit.
public:
WinEDAChoiceBox* m_SelpartBox; // a Box to select a part to edit (if any)
WinEDAChoiceBox* m_SelAliasBox; // a box to select the alias to edit (if any)
wxComboBox* m_SelpartBox; // a Box to select a part to edit (if any)
wxComboBox* m_SelAliasBox; // a box to select the alias to edit (if any)
public:
LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, const wxString& title,

View File

@ -158,14 +158,20 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
_( "Edit document file" ) );
m_HToolBar->AddSeparator();
m_SelpartBox = new WinEDAChoiceBox( m_HToolBar,
ID_LIBEDIT_SELECT_PART_NUMBER,
wxDefaultPosition,
wxSize( LISTBOX_WIDTH, -1 ) );
m_SelpartBox = new wxComboBox( m_HToolBar,
ID_LIBEDIT_SELECT_PART_NUMBER,
wxEmptyString,
wxDefaultPosition,
wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY );
m_HToolBar->AddControl( m_SelpartBox );
m_SelAliasBox = new WinEDAChoiceBox( m_HToolBar, ID_LIBEDIT_SELECT_ALIAS, wxDefaultPosition,
wxSize( LISTBOX_WIDTH, -1 ) );
m_SelAliasBox = new wxComboBox( m_HToolBar,
ID_LIBEDIT_SELECT_ALIAS,
wxEmptyString,
wxDefaultPosition,
wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY );
m_HToolBar->AddControl( m_SelAliasBox );
m_HToolBar->AddSeparator();

View File

@ -82,9 +82,9 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
m_HToolBar->AddSeparator();
SelpartBox =
new WinEDAChoiceBox( m_HToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
wxDefaultPosition, wxSize( 150, -1 ) );
SelpartBox = new wxComboBox( m_HToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
wxEmptyString, wxDefaultPosition,
wxSize( 150, -1 ), 0, NULL, wxCB_READONLY );
m_HToolBar->AddControl( SelpartBox );
m_HToolBar->AddSeparator();

View File

@ -48,10 +48,8 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
EVT_TOOL_RANGE( ID_LIBVIEW_NEXT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT,
LIB_VIEW_FRAME::Process_Special_Functions )
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
LIB_VIEW_FRAME::ExportToSchematicLibraryPart )
EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER,
LIB_VIEW_FRAME::Process_Special_Functions )
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, LIB_VIEW_FRAME::ExportToSchematicLibraryPart )
EVT_COMBOBOX( ID_LIBVIEW_SELECT_PART_NUMBER, LIB_VIEW_FRAME::Process_Special_Functions )
/* listbox events */
EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, LIB_VIEW_FRAME::ClickOnLibList )

View File

@ -10,7 +10,6 @@
class wxSashLayoutWindow;
class wxListBox;
class wxSemaphore;
class WinEDAChoiceBox;
class SCH_SCREEN;
class CMP_LIBRARY;
@ -21,7 +20,7 @@ class CMP_LIBRARY;
class LIB_VIEW_FRAME : public EDA_DRAW_FRAME
{
private:
WinEDAChoiceBox* SelpartBox;
wxComboBox* SelpartBox;
// List of libraries (for selection )
wxSashLayoutWindow* m_LibListWindow;

View File

@ -72,7 +72,7 @@ void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_LIBVIEW_SELECT_PART_NUMBER:
ii = SelpartBox->GetChoice();
ii = SelpartBox->GetCurrentSelection();
if( ii < 0 )
return;
m_unit = ii + 1;

View File

@ -68,8 +68,8 @@ EVT_TOOL( wxID_COPY, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_PASTE, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_UNDO, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_PRINT, GERBVIEW_FRAME::ToPrinter )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
GERBVIEW_FRAME::OnSelectActiveLayer )
EVT_COMBOBOX( ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
GERBVIEW_FRAME::OnSelectActiveLayer )
EVT_SELECT_DCODE( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnSelectActiveDCode )

View File

@ -211,44 +211,5 @@ public:
}
};
/*************************/
/* class WinEDAChoiceBox */
/*************************/
/* class to display a choice list.
* This is a wrapper to wxComboBox (or wxChoice)
* but because they have some problems, WinEDAChoiceBox uses workarounds:
* - in wxGTK 2.6.2 wxGetSelection() does not work properly,
* - and wxChoice crashes if compiled in non unicode mode and uses utf8 codes
*/
#define EVT_KICAD_CHOICEBOX EVT_COMBOBOX
class WinEDAChoiceBox : public wxComboBox
{
public:
WinEDAChoiceBox( wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL ) :
wxComboBox( parent, id, wxEmptyString, pos, size,
n, choices, wxCB_READONLY )
{
}
WinEDAChoiceBox( wxWindow* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices ) :
wxComboBox( parent, id, wxEmptyString, pos, size,
choices, wxCB_READONLY )
{
}
int GetChoice()
{
return GetCurrentSelection();
}
};
#endif

View File

@ -58,7 +58,7 @@ enum fl_rot_cmp {
class SCH_EDIT_FRAME : public EDA_DRAW_FRAME
{
public:
WinEDAChoiceBox* m_SelPartBox;
wxComboBox* m_SelPartBox;
SCH_SHEET_PATH* m_CurrentSheet; ///< which sheet we are presently working on.
int m_Multiflag;
int m_NetlistFormat;

View File

@ -112,12 +112,9 @@ protected:
virtual void unitsChangeRefresh();
public:
LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and
// select active layer
WinEDAChoiceBox* m_SelTrackWidthBox; // a combo box to display and
// select current track width
WinEDAChoiceBox* m_SelViaSizeBox; // a combo box to display and
// select current via diameter
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
bool m_show_microwave_tools;
bool m_show_layer_manager_tools;

View File

@ -39,7 +39,6 @@ class EDA_DRAW_PANEL;
class EDA_MSG_PANEL;
class BASE_SCREEN;
class EDA_TOOLBAR;
class WinEDAChoiceBox;
class PARAM_CFG_BASE;
class Ki_PageDescr;
class Ki_HotkeyInfo;
@ -245,10 +244,8 @@ public:
EDA_TOOLBAR* m_OptionsToolBar; // Options Toolbar (left side)
EDA_TOOLBAR* m_AuxiliaryToolBar; // Auxiliary Toolbar used in pcbnew
WinEDAChoiceBox* m_SelGridBox; // Choice box to choose the grid
// size
WinEDAChoiceBox* m_SelZoomBox; // Choice box to choose the zoom
// value
wxComboBox* m_SelGridBox; // Choice box to choose the grid size
wxComboBox* m_SelZoomBox; // Choice box to choose the zoom value
int m_CursorShape; // shape for cursor (0 = default
// cursor)

View File

@ -49,7 +49,7 @@ private:
WinEDA_SizeCtrl* m_TxtSizeCtrl;
WinEDA_ValueCtrl* m_TxtWidthCtrl;
wxRadioBox* m_Mirror;
WinEDAChoiceBox* m_SelLayerBox;
wxComboBox* m_SelLayerBox;
public:
@ -122,8 +122,9 @@ DIMENSION_EDITOR_DIALOG::DIMENSION_EDITOR_DIALOG( PCB_EDIT_FRAME* parent,
wxStaticText* text = new wxStaticText( this, -1, _( "Layer:" ) );
LeftBoxSizer->Add( text, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
m_SelLayerBox = new WinEDAChoiceBox( this, wxID_ANY,
wxDefaultPosition, wxDefaultSize );
m_SelLayerBox = new wxComboBox( this, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxDefaultSize,
0, NULL, wxCB_READONLY );
LeftBoxSizer->Add( m_SelLayerBox, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
for( int layer = FIRST_NO_COPPER_LAYER; layer<NB_LAYERS; layer++ )
@ -175,7 +176,7 @@ void DIMENSION_EDITOR_DIALOG::OnOkClick( wxCommandEvent& event )
CurrentDimension->m_Text->m_Mirror = ( m_Mirror->GetSelection() == 1 ) ? true : false;
CurrentDimension->SetLayer( m_SelLayerBox->GetChoice() + FIRST_NO_COPPER_LAYER );
CurrentDimension->SetLayer( m_SelLayerBox->GetCurrentSelection() + FIRST_NO_COPPER_LAYER );
CurrentDimension->AdjustDimensionDetails( true );

View File

@ -78,12 +78,12 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
break;
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
ii = m_SelTrackWidthBox->GetChoice();
ii = m_SelTrackWidthBox->GetCurrentSelection();
GetBoard()->m_TrackWidthSelector = ii;
break;
case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
ii = m_SelViaSizeBox->GetChoice();
ii = m_SelViaSizeBox->GetCurrentSelection();
GetBoard()->m_ViaSizeSelector = ii;
break;

View File

@ -36,8 +36,8 @@ BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, PCB_BASE_FRAME )
EVT_SIZE( WinEDA_ModuleEditFrame::OnSize )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_ModuleEditFrame::OnSelectZoom )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_ModuleEditFrame::OnSelectGrid )
EVT_COMBOBOX( ID_ON_ZOOM_SELECT, WinEDA_ModuleEditFrame::OnSelectZoom )
EVT_COMBOBOX( ID_ON_GRID_SELECT, WinEDA_ModuleEditFrame::OnSelectGrid )
EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE, WinEDA_ModuleEditFrame::Process_Special_Functions )

View File

@ -68,8 +68,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_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, PCB_EDIT_FRAME::OnSelectZoom )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, PCB_EDIT_FRAME::OnSelectGrid )
EVT_COMBOBOX( ID_ON_ZOOM_SELECT, PCB_EDIT_FRAME::OnSelectZoom )
EVT_COMBOBOX( ID_ON_GRID_SELECT, PCB_EDIT_FRAME::OnSelectGrid )
EVT_CLOSE( PCB_EDIT_FRAME::OnCloseWindow )
EVT_SIZE( PCB_EDIT_FRAME::OnSize )
@ -164,10 +164,9 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_DRC_CONTROL, PCB_EDIT_FRAME::Process_Special_Functions )
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_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE, 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_TOOL( ID_TOOLBARH_PCB_MODE_MODULE, PCB_EDIT_FRAME::AutoPlace )
EVT_TOOL( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::AutoPlace )
EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, PCB_EDIT_FRAME::Access_to_External_Tool )

View File

@ -219,18 +219,22 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
m_AuxiliaryToolBar->AddSeparator();
// Grid selection choice box.
m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_GRID_SELECT,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) );
m_SelGridBox = new wxComboBox( m_AuxiliaryToolBar,
ID_ON_GRID_SELECT,
wxEmptyString,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY );
m_AuxiliaryToolBar->AddControl( m_SelGridBox );
// Zoom selection choice box.
m_AuxiliaryToolBar->AddSeparator();
m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_ZOOM_SELECT,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) );
m_SelZoomBox = new wxComboBox( m_AuxiliaryToolBar,
ID_ON_ZOOM_SELECT,
wxEmptyString,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY );
m_AuxiliaryToolBar->AddControl( m_SelZoomBox );
// Update tool bar to reflect setting.

View File

@ -509,18 +509,22 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
/* Set up toolbar items */
// Creates box to display and choose tracks widths:
m_SelTrackWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) );
m_SelTrackWidthBox = new wxComboBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxEmptyString,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY );
m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox );
m_AuxiliaryToolBar->AddSeparator();
// Creates box to display and choose vias diameters:
m_SelViaSizeBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
wxPoint( -1, -1 ),
wxSize( (LISTBOX_WIDTH*12)/10, -1 ) );
m_SelViaSizeBox = new wxComboBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
wxEmptyString,
wxPoint( -1, -1 ),
wxSize( (LISTBOX_WIDTH*12)/10, -1 ),
0, NULL, wxCB_READONLY );
m_AuxiliaryToolBar->AddControl( m_SelViaSizeBox );
m_AuxiliaryToolBar->AddSeparator();
@ -534,18 +538,22 @@ 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_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_GRID_SELECT,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) );
m_SelGridBox = new wxComboBox( m_AuxiliaryToolBar,
ID_ON_GRID_SELECT,
wxEmptyString,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY );
m_AuxiliaryToolBar->AddControl( m_SelGridBox );
// Add the box to display and select the current Zoom
m_AuxiliaryToolBar->AddSeparator();
m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_ZOOM_SELECT,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) );
m_SelZoomBox = new wxComboBox( m_AuxiliaryToolBar,
ID_ON_ZOOM_SELECT,
wxEmptyString,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY );
m_AuxiliaryToolBar->AddControl( m_SelZoomBox );
updateZoomSelectBox();