Fix layer widget in HiDPI situations
(cherry picked from commit 89ef6b36f4
)
This commit is contained in:
parent
154f64dae3
commit
64bc850d8f
|
@ -27,6 +27,7 @@
|
||||||
#include <wx/odcombo.h>
|
#include <wx/odcombo.h>
|
||||||
#include <wx/menuitem.h>
|
#include <wx/menuitem.h>
|
||||||
|
|
||||||
|
#include <gal/dpi_scaling.h>
|
||||||
#include <layer_ids.h>
|
#include <layer_ids.h>
|
||||||
#include <widgets/layer_box_selector.h>
|
#include <widgets/layer_box_selector.h>
|
||||||
|
|
||||||
|
@ -140,9 +141,12 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( int layer )
|
||||||
|
|
||||||
void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
|
void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
|
||||||
{
|
{
|
||||||
|
DPI_SCALING dpi( nullptr, this );
|
||||||
|
int size = static_cast<int>( dpi.GetScaleFactor() * 14 );
|
||||||
|
|
||||||
for( int i = 0; i < (int) GetCount(); ++i )
|
for( int i = 0; i < (int) GetCount(); ++i )
|
||||||
{
|
{
|
||||||
wxBitmap layerbmp( 14, 14 );
|
wxBitmap layerbmp( size, size );
|
||||||
DrawColorSwatch( layerbmp, getLayerColor( LAYER_PCB_BACKGROUND ), getLayerColor( i ) );
|
DrawColorSwatch( layerbmp, getLayerColor( LAYER_PCB_BACKGROUND ), getLayerColor( i ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,8 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
|
||||||
Freeze();
|
Freeze();
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
const int BM_SIZE = 14;
|
DPI_SCALING dpi( nullptr, this );
|
||||||
|
int size = static_cast<int>( 14 / dpi.GetScaleFactor() );
|
||||||
|
|
||||||
LSET show = LSET::AllLayersMask() & ~m_layerMaskDisable;
|
LSET show = LSET::AllLayersMask() & ~m_layerMaskDisable;
|
||||||
LSET activated = getEnabledLayers() & ~m_layerMaskDisable;
|
LSET activated = getEnabledLayers() & ~m_layerMaskDisable;
|
||||||
|
@ -99,7 +100,7 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
|
||||||
else
|
else
|
||||||
layerstatus.Empty();
|
layerstatus.Empty();
|
||||||
|
|
||||||
wxBitmap bmp( BM_SIZE, BM_SIZE );
|
wxBitmap bmp( size, size );
|
||||||
DrawColorSwatch( bmp, getLayerColor( LAYER_PCB_BACKGROUND ), getLayerColor( layerid ) );
|
DrawColorSwatch( bmp, getLayerColor( LAYER_PCB_BACKGROUND ), getLayerColor( layerid ) );
|
||||||
|
|
||||||
wxString layername = getLayerName( layerid ) + layerstatus;
|
wxString layername = getLayerName( layerid ) + layerstatus;
|
||||||
|
@ -129,7 +130,7 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
|
||||||
SetMinSize( wxSize( -1, -1 ) );
|
SetMinSize( wxSize( -1, -1 ) );
|
||||||
wxSize bestSize = GetBestSize();
|
wxSize bestSize = GetBestSize();
|
||||||
|
|
||||||
bestSize.x = GetBestSize().x + BM_SIZE + 10;
|
bestSize.x = GetBestSize().x + size + 10;
|
||||||
SetMinSize( bestSize );
|
SetMinSize( bestSize );
|
||||||
|
|
||||||
SetSelection( wxNOT_FOUND );
|
SetSelection( wxNOT_FOUND );
|
||||||
|
|
Loading…
Reference in New Issue