Commit ec35a66f authored by Marco Serantoni's avatar Marco Serantoni

LayerBox little enhancements and adjust; fix bug #669495

parent eb4a7dad
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
class WinEDALayerChoiceBox : public wxBitmapComboBox class WinEDALayerChoiceBox : public wxBitmapComboBox
{ {
private:
bool m_layerhotkeys;
bool m_layerorder;
public: public:
WinEDALayerChoiceBox( WinEDA_Toolbar* parent, wxWindowID id, WinEDALayerChoiceBox( WinEDA_Toolbar* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
...@@ -23,13 +26,16 @@ public: ...@@ -23,13 +26,16 @@ public:
int GetChoice(); int GetChoice();
// Get Current Layer // Get Current Layer
int GetLayerChoice(); int GetLayerSelection();
// Set Layer # // Set Layer #
int SetLayerSelection(int layer); int SetLayerSelection(int layer);
// Reload the Layers // Reload the Layers
void Resync(); void Resync();
bool SetLayersOrdered(bool value);
bool SetLayersHotkeys(bool value);
}; };
#define DECLARE_LAYERS_HOTKEY(list) int list[LAYER_COUNT] = \ #define DECLARE_LAYERS_HOTKEY(list) int list[LAYER_COUNT] = \
......
...@@ -27,6 +27,8 @@ WinEDALayerChoiceBox::WinEDALayerChoiceBox( WinEDA_Toolbar* parent, wxWindowID i ...@@ -27,6 +27,8 @@ WinEDALayerChoiceBox::WinEDALayerChoiceBox( WinEDA_Toolbar* parent, wxWindowID i
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, wxBitmapComboBox( parent, id, wxEmptyString, pos, size,
n, choices, wxCB_READONLY ) n, choices, wxCB_READONLY )
{ {
m_layerorder = true;
m_layerhotkeys = true;
} }
...@@ -36,6 +38,22 @@ WinEDALayerChoiceBox::WinEDALayerChoiceBox( WinEDA_Toolbar* parent, wxWindowID i ...@@ -36,6 +38,22 @@ WinEDALayerChoiceBox::WinEDALayerChoiceBox( WinEDA_Toolbar* parent, wxWindowID i
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, wxBitmapComboBox( parent, id, wxEmptyString, pos, size,
choices, wxCB_READONLY ) 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() ...@@ -47,7 +65,7 @@ int WinEDALayerChoiceBox::GetChoice()
// Get Current Layer // Get Current Layer
int WinEDALayerChoiceBox::GetLayerChoice() int WinEDALayerChoiceBox::GetLayerSelection()
{ {
return (long) GetClientData( GetSelection() ); return (long) GetClientData( GetSelection() );
} }
...@@ -97,9 +115,12 @@ void WinEDALayerChoiceBox::Resync() ...@@ -97,9 +115,12 @@ void WinEDALayerChoiceBox::Resync()
wxMemoryDC bmpDC; wxMemoryDC bmpDC;
wxBrush brush; wxBrush brush;
wxString layername; wxString layername;
int layerid = i;
if( m_layerorder )
layerid = layertranscode[i];
int layerid = layertranscode[i]; if( !board->IsLayerEnabled( layerid ) )
if( ! board->IsLayerEnabled( layerid ) )
continue; continue;
// Prepare Bitmap // Prepare Bitmap
...@@ -114,7 +135,11 @@ void WinEDALayerChoiceBox::Resync() ...@@ -114,7 +135,11 @@ void WinEDALayerChoiceBox::Resync()
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 = 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 ); Append( layername, layerbmp, (void*) layerid );
} }
} }
...@@ -861,8 +861,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -861,8 +861,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_TOOLBARH_PCB_SELECT_LAYER:
itmp = m_SelLayerBox->GetChoice(); setActiveLayer( (size_t) m_SelLayerBox->GetLayerSelection());
setActiveLayer( (size_t) m_SelLayerBox->wxItemContainer::GetClientData( itmp ) );
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
DrawPanel->Refresh( true ); DrawPanel->Refresh( true );
break; break;
......
...@@ -55,9 +55,12 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -55,9 +55,12 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
} }
#ifdef USE_WX_OVERLAY #ifdef USE_WX_OVERLAY
if(IsShown())
{
DrawPanel->m_overlay.Reset(); DrawPanel->m_overlay.Reset();
wxDCOverlay overlaydc( DrawPanel->m_overlay, DC ); wxDCOverlay overlaydc( DrawPanel->m_overlay, DC );
overlaydc.Clear(); overlaydc.Clear();
}
#endif #endif
screen->ClrRefreshReq(); screen->ClrRefreshReq();
...@@ -91,9 +94,12 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -91,9 +94,12 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DrawGeneralRatsnest( DC ); DrawGeneralRatsnest( DC );
#ifdef USE_WX_OVERLAY #ifdef USE_WX_OVERLAY
if(IsShown())
{
DrawPanel->m_overlay.Reset(); DrawPanel->m_overlay.Reset();
wxDCOverlay overlaydc( DrawPanel->m_overlay, DC ); wxDCOverlay overlaydc( DrawPanel->m_overlay, DC );
overlaydc.Clear(); overlaydc.Clear();
}
#endif #endif
GetScreen()->ClrRefreshReq(); GetScreen()->ClrRefreshReq();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment