Fix issue with new layer box, mainly with wxWidgets 2.9.1
This commit is contained in:
parent
aeb6dd8cc7
commit
c0eeafa070
|
@ -10,12 +10,12 @@
|
||||||
class WinEDALayerChoiceBox : public wxBitmapComboBox
|
class WinEDALayerChoiceBox : public wxBitmapComboBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WinEDALayerChoiceBox( wxWindow* parent, wxWindowID id,
|
WinEDALayerChoiceBox( WinEDA_Toolbar* parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
int n = 0, const wxString choices[] = NULL );
|
int n = 0, const wxString choices[] = NULL );
|
||||||
|
|
||||||
WinEDALayerChoiceBox( wxWindow* parent, wxWindowID id,
|
WinEDALayerChoiceBox( WinEDA_Toolbar* parent, wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size,
|
const wxPoint& pos, const wxSize& size,
|
||||||
const wxArrayString& choices );
|
const wxArrayString& choices );
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
WinEDALayerChoiceBox::WinEDALayerChoiceBox( wxWindow* parent, wxWindowID id,
|
WinEDALayerChoiceBox::WinEDALayerChoiceBox( WinEDA_Toolbar* parent, wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size,
|
const wxPoint& pos, const wxSize& size,
|
||||||
int n, const wxString choices[] ) :
|
int n, const wxString choices[] ) :
|
||||||
wxBitmapComboBox( parent, id, wxEmptyString, pos, size,
|
wxBitmapComboBox( parent, id, wxEmptyString, pos, size,
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WinEDALayerChoiceBox::WinEDALayerChoiceBox( wxWindow* parent, wxWindowID id,
|
WinEDALayerChoiceBox::WinEDALayerChoiceBox( WinEDA_Toolbar* parent, wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size,
|
const wxPoint& pos, const wxSize& size,
|
||||||
const wxArrayString& choices ) :
|
const wxArrayString& choices ) :
|
||||||
wxBitmapComboBox( parent, id, wxEmptyString, pos, size,
|
wxBitmapComboBox( parent, id, wxEmptyString, pos, size,
|
||||||
|
@ -38,25 +38,30 @@
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get Current Item #
|
// Get Current Item #
|
||||||
int WinEDALayerChoiceBox::GetChoice()
|
int WinEDALayerChoiceBox::GetChoice()
|
||||||
{
|
{
|
||||||
return GetSelection();
|
return GetSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get Current Layer
|
// Get Current Layer
|
||||||
int WinEDALayerChoiceBox::GetLayerChoice()
|
int WinEDALayerChoiceBox::GetLayerChoice()
|
||||||
{
|
{
|
||||||
return (long) GetClientData( GetSelection() );
|
return (long) GetClientData( GetSelection() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set Layer #
|
// Set Layer #
|
||||||
int WinEDALayerChoiceBox::SetLayerSelection( int layer )
|
int WinEDALayerChoiceBox::SetLayerSelection( int layer )
|
||||||
{
|
{
|
||||||
int elements = GetCount();
|
int elements = GetCount();
|
||||||
|
|
||||||
for( int i = 0; i < elements; i++ )
|
for( int i = 0; i < elements; i++ )
|
||||||
|
{
|
||||||
if( GetClientData( i ) == (void*) layer )
|
if( GetClientData( i ) == (void*) layer )
|
||||||
|
{
|
||||||
if( GetSelection() != i ) // Element (i) is not selected
|
if( GetSelection() != i ) // Element (i) is not selected
|
||||||
{
|
{
|
||||||
SetSelection( i );
|
SetSelection( i );
|
||||||
|
@ -64,16 +69,21 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return i; //If element already selected; do nothing
|
return i; //If element already selected; do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Not Found
|
// Not Found
|
||||||
SetSelection( -1 );
|
SetSelection( -1 );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Reload the Layers
|
// Reload the Layers
|
||||||
void WinEDALayerChoiceBox::Resync()
|
void WinEDALayerChoiceBox::Resync()
|
||||||
{
|
{
|
||||||
BOARD* board = ((WinEDA_BasePcbFrame*)GetParent())->GetBoard();
|
WinEDA_BasePcbFrame* pcbFrame = (WinEDA_BasePcbFrame*) GetParent()->GetParent();
|
||||||
|
BOARD* board = pcbFrame->GetBoard();
|
||||||
|
|
||||||
wxASSERT( board != NULL );
|
wxASSERT( board != NULL );
|
||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
|
@ -83,12 +93,14 @@
|
||||||
|
|
||||||
for( int i = 0; i < LAYER_COUNT; i++ )
|
for( int i = 0; i < LAYER_COUNT; i++ )
|
||||||
{
|
{
|
||||||
wxBitmap layerbmp (20,18);
|
wxBitmap layerbmp( 14, 14 );
|
||||||
wxMemoryDC bmpDC;
|
wxMemoryDC bmpDC;
|
||||||
wxBrush brush;
|
wxBrush brush;
|
||||||
wxString layername;
|
wxString layername;
|
||||||
|
|
||||||
int layerid = layertranscode[i];
|
int layerid = layertranscode[i];
|
||||||
|
if( ! board->IsLayerEnabled( layerid ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
// Prepare Bitmap
|
// Prepare Bitmap
|
||||||
bmpDC.SelectObject( layerbmp );
|
bmpDC.SelectObject( layerbmp );
|
||||||
|
@ -102,14 +114,7 @@
|
||||||
bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );
|
bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );
|
||||||
|
|
||||||
layername = board->GetLayerName( layerid );
|
layername = board->GetLayerName( layerid );
|
||||||
|
|
||||||
layername.Append( wxT( "\t" ) );
|
|
||||||
layername = AddHotkeyName( layername, s_Board_Editor_Hokeys_Descr, layerhk[layerid], false );
|
layername = AddHotkeyName( layername, s_Board_Editor_Hokeys_Descr, layerhk[layerid], false );
|
||||||
|
|
||||||
|
|
||||||
if(board->IsLayerEnabled(layerid))
|
|
||||||
Append( layername, layerbmp, (void*) layerid );
|
Append( layername, layerbmp, (void*) layerid );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -342,7 +342,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
|
||||||
vert.TopDockable( false ).BottomDockable( false );
|
vert.TopDockable( false ).BottomDockable( false );
|
||||||
horiz.LeftDockable( false ).RightDockable( false );
|
horiz.LeftDockable( false ).RightDockable( false );
|
||||||
|
|
||||||
// Create a template from the horiz wxAuiPaneInfo, specific for horizontal toolbars:
|
// Create a template from the horiz wxAuiPaneInfo, specific to horizontal toolbars:
|
||||||
wxAuiPaneInfo horiz_tb( horiz );
|
wxAuiPaneInfo horiz_tb( horiz );
|
||||||
horiz_tb.ToolbarPane().Gripper( false );
|
horiz_tb.ToolbarPane().Gripper( false );
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
|
|
||||||
if(m_SelLayerBox == NULL)
|
if(m_SelLayerBox == NULL)
|
||||||
m_SelLayerBox = new WinEDALayerChoiceBox( this, ID_TOOLBARH_PCB_SELECT_LAYER);
|
m_SelLayerBox = new WinEDALayerChoiceBox( m_HToolBar, ID_TOOLBARH_PCB_SELECT_LAYER);
|
||||||
|
|
||||||
ReCreateLayerBox( m_HToolBar );
|
ReCreateLayerBox( m_HToolBar );
|
||||||
m_HToolBar->AddControl( m_SelLayerBox );
|
m_HToolBar->AddControl( m_SelLayerBox );
|
||||||
|
@ -683,7 +683,6 @@ an existing track use its width\notherwise, use current width setting" ),
|
||||||
|
|
||||||
m_TrackAndViasSizesList_Changed = true;
|
m_TrackAndViasSizesList_Changed = true;
|
||||||
m_AuxiliaryToolBar->AddSeparator();
|
m_AuxiliaryToolBar->AddSeparator();
|
||||||
ReCreateLayerBox( NULL );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,8 @@ void WinEDA_PcbFrame::SetToolbars()
|
||||||
|
|
||||||
state = GetScreen()->GetRedoCommandCount() > 0;
|
state = GetScreen()->GetRedoCommandCount() > 0;
|
||||||
m_HToolBar->EnableTool( wxID_REDO, state );
|
m_HToolBar->EnableTool( wxID_REDO, state );
|
||||||
|
syncLayerBox();
|
||||||
|
PrepareLayerIndicator();
|
||||||
m_HToolBar->Refresh();
|
m_HToolBar->Refresh();
|
||||||
|
|
||||||
if( m_OptionsToolBar )
|
if( m_OptionsToolBar )
|
||||||
|
@ -276,9 +278,5 @@ void WinEDA_PcbFrame::SetToolbars()
|
||||||
|
|
||||||
if( m_AuxiliaryToolBar )
|
if( m_AuxiliaryToolBar )
|
||||||
AuxiliaryToolBar_Update_UI();
|
AuxiliaryToolBar_Update_UI();
|
||||||
|
|
||||||
syncLayerBox();
|
|
||||||
|
|
||||||
PrepareLayerIndicator();
|
|
||||||
DisplayUnitsMsg();
|
DisplayUnitsMsg();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue