LayerBox little enhancements and adjust; fix bug #669495

This commit is contained in:
Marco Serantoni 2010-11-03 22:19:46 +01:00
parent eb4a7dad7c
commit ec35a66ffb
4 changed files with 49 additions and 13 deletions

View File

@ -9,6 +9,9 @@
class WinEDALayerChoiceBox : public wxBitmapComboBox
{
private:
bool m_layerhotkeys;
bool m_layerorder;
public:
WinEDALayerChoiceBox( WinEDA_Toolbar* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
@ -23,13 +26,16 @@ public:
int GetChoice();
// Get Current Layer
int GetLayerChoice();
int GetLayerSelection();
// Set Layer #
int SetLayerSelection(int layer);
// Reload the Layers
void Resync();
bool SetLayersOrdered(bool value);
bool SetLayersHotkeys(bool value);
};
#define DECLARE_LAYERS_HOTKEY(list) int list[LAYER_COUNT] = \

View File

@ -27,6 +27,8 @@ WinEDALayerChoiceBox::WinEDALayerChoiceBox( WinEDA_Toolbar* parent, wxWindowID i
wxBitmapComboBox( parent, id, wxEmptyString, pos, size,
n, choices, wxCB_READONLY )
{
m_layerorder = true;
m_layerhotkeys = true;
}
@ -36,6 +38,22 @@ WinEDALayerChoiceBox::WinEDALayerChoiceBox( WinEDA_Toolbar* parent, wxWindowID i
wxBitmapComboBox( parent, id, wxEmptyString, pos, size,
choices, wxCB_READONLY )
{
m_layerorder = true;
m_layerhotkeys = true;
}
bool WinEDALayerChoiceBox::SetLayersOrdered( bool value )
{
m_layerorder = value;
return m_layerorder;
}
bool WinEDALayerChoiceBox::SetLayersHotkeys( bool value )
{
m_layerhotkeys = value;
return m_layerhotkeys;
}
@ -47,7 +65,7 @@ int WinEDALayerChoiceBox::GetChoice()
// Get Current Layer
int WinEDALayerChoiceBox::GetLayerChoice()
int WinEDALayerChoiceBox::GetLayerSelection()
{
return (long) GetClientData( GetSelection() );
}
@ -97,9 +115,12 @@ void WinEDALayerChoiceBox::Resync()
wxMemoryDC bmpDC;
wxBrush brush;
wxString layername;
int layerid = i;
int layerid = layertranscode[i];
if( ! board->IsLayerEnabled( layerid ) )
if( m_layerorder )
layerid = layertranscode[i];
if( !board->IsLayerEnabled( layerid ) )
continue;
// Prepare Bitmap
@ -114,7 +135,11 @@ void WinEDALayerChoiceBox::Resync()
bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );
layername = board->GetLayerName( layerid );
layername = AddHotkeyName( layername, s_Board_Editor_Hokeys_Descr, layerhk[layerid], false );
if( m_layerhotkeys )
layername = AddHotkeyName( layername, s_Board_Editor_Hokeys_Descr,
layerhk[layerid], false );
Append( layername, layerbmp, (void*) layerid );
}
}

View File

@ -861,8 +861,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_TOOLBARH_PCB_SELECT_LAYER:
itmp = m_SelLayerBox->GetChoice();
setActiveLayer( (size_t) m_SelLayerBox->wxItemContainer::GetClientData( itmp ) );
setActiveLayer( (size_t) m_SelLayerBox->GetLayerSelection());
if( DisplayOpt.ContrastModeDisplay )
DrawPanel->Refresh( true );
break;

View File

@ -55,9 +55,12 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
}
#ifdef USE_WX_OVERLAY
DrawPanel->m_overlay.Reset();
wxDCOverlay overlaydc( DrawPanel->m_overlay, DC );
overlaydc.Clear();
if(IsShown())
{
DrawPanel->m_overlay.Reset();
wxDCOverlay overlaydc( DrawPanel->m_overlay, DC );
overlaydc.Clear();
}
#endif
screen->ClrRefreshReq();
@ -91,9 +94,12 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DrawGeneralRatsnest( DC );
#ifdef USE_WX_OVERLAY
DrawPanel->m_overlay.Reset();
wxDCOverlay overlaydc( DrawPanel->m_overlay, DC );
overlaydc.Clear();
if(IsShown())
{
DrawPanel->m_overlay.Reset();
wxDCOverlay overlaydc( DrawPanel->m_overlay, DC );
overlaydc.Clear();
}
#endif
GetScreen()->ClrRefreshReq();