Fixed high contrast mode in OpenGL. Split display settings loading into more appropriate places.
This commit is contained in:
parent
4076f99332
commit
c9199ea80a
|
@ -111,7 +111,7 @@ void GPU_CACHED_MANAGER::BeginDrawing()
|
||||||
{
|
{
|
||||||
wxASSERT( !m_isDrawing );
|
wxASSERT( !m_isDrawing );
|
||||||
|
|
||||||
if( m_container->isDirty() )
|
if( m_container->IsDirty() )
|
||||||
uploadToGpu();
|
uploadToGpu();
|
||||||
|
|
||||||
// Number of vertices to be drawn in the EndDrawing()
|
// Number of vertices to be drawn in the EndDrawing()
|
||||||
|
|
|
@ -101,12 +101,14 @@ void VERTEX_MANAGER::ChangeItemColor( const VERTEX_ITEM& aItem, const COLOR4D& a
|
||||||
VERTEX* vertex = m_container->GetVertices( offset );
|
VERTEX* vertex = m_container->GetVertices( offset );
|
||||||
for( unsigned int i = 0; i < size; ++i )
|
for( unsigned int i = 0; i < size; ++i )
|
||||||
{
|
{
|
||||||
vertex->r = aColor.r;
|
vertex->r = aColor.r * 255.0;
|
||||||
vertex->g = aColor.g;
|
vertex->g = aColor.g * 255.0;
|
||||||
vertex->b = aColor.b;
|
vertex->b = aColor.b * 255.0;
|
||||||
vertex->a = aColor.a;
|
vertex->a = aColor.a * 255.0;
|
||||||
vertex++;
|
vertex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_container->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,6 +123,8 @@ void VERTEX_MANAGER::ChangeItemDepth( const VERTEX_ITEM& aItem, GLfloat aDepth )
|
||||||
vertex->z = aDepth;
|
vertex->z = aDepth;
|
||||||
vertex++;
|
vertex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_container->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ public:
|
||||||
* returns information about container cache state. Clears the flag after calling the function.
|
* returns information about container cache state. Clears the flag after calling the function.
|
||||||
* @return true in case the vertices have to be reuploaded.
|
* @return true in case the vertices have to be reuploaded.
|
||||||
*/
|
*/
|
||||||
inline bool isDirty()
|
inline bool IsDirty()
|
||||||
{
|
{
|
||||||
bool state = m_dirty;
|
bool state = m_dirty;
|
||||||
|
|
||||||
|
@ -120,6 +120,16 @@ public:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SetDirty()
|
||||||
|
* sets the dirty flag, so vertices in the container are going to be reuploaded to the GPU on
|
||||||
|
* the next frame.
|
||||||
|
*/
|
||||||
|
inline void SetDirty()
|
||||||
|
{
|
||||||
|
m_dirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
VERTEX_CONTAINER( unsigned int aSize = defaultInitSize );
|
VERTEX_CONTAINER( unsigned int aSize = defaultInitSize );
|
||||||
|
|
||||||
|
|
|
@ -182,45 +182,6 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
|
||||||
view->Add( zone );
|
view->Add( zone );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply layer coloring scheme & display options
|
|
||||||
if( view->GetPainter() )
|
|
||||||
{
|
|
||||||
KiGfx::PCB_RENDER_SETTINGS* settings = new KiGfx::PCB_RENDER_SETTINGS();
|
|
||||||
|
|
||||||
// Load layers' colors from PCB data
|
|
||||||
settings->ImportLegacyColors( m_Pcb->GetColorsSettings() );
|
|
||||||
view->GetPainter()->ApplySettings( settings );
|
|
||||||
|
|
||||||
// Load display options (such as filled/outline display of items)
|
|
||||||
settings->LoadDisplayOptions( DisplayOpt );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set rendering order of layers
|
|
||||||
for( LAYER_NUM i = 0; i < sizeof(GalLayerOrder) / sizeof(LAYER_NUM); ++i )
|
|
||||||
{
|
|
||||||
wxASSERT( i < KiGfx::VIEW::VIEW_MAX_LAYERS );
|
|
||||||
|
|
||||||
view->SetLayerOrder( GalLayerOrder[i], i );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Netnames are drawn only when scale is sufficient (level of details)
|
|
||||||
// so there is no point in caching them
|
|
||||||
for( LAYER_NUM layer = FIRST_NETNAME_LAYER; layer <= LAST_NETNAME_LAYER; ++layer )
|
|
||||||
{
|
|
||||||
view->SetLayerTarget( layer, KiGfx::TARGET_NONCACHED );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load layer & elements visibility settings
|
|
||||||
for( LAYER_NUM i = 0; i < NB_LAYERS; ++i )
|
|
||||||
{
|
|
||||||
view->SetLayerVisible( i, m_Pcb->IsLayerVisible( i ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
for( LAYER_NUM i = 0; i < END_PCB_VISIBLE_LIST; ++i )
|
|
||||||
{
|
|
||||||
view->SetLayerVisible( ITEM_GAL_LAYER( i ), m_Pcb->IsElementVisible( i ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
view->RecacheAllItems( true );
|
view->RecacheAllItems( true );
|
||||||
if( m_galCanvasActive )
|
if( m_galCanvasActive )
|
||||||
m_galCanvas->Refresh();
|
m_galCanvas->Refresh();
|
||||||
|
@ -827,6 +788,36 @@ void PCB_BASE_FRAME::LoadSettings()
|
||||||
if( m_DisplayModText < LINE || m_DisplayModText > SKETCH )
|
if( m_DisplayModText < LINE || m_DisplayModText > SKETCH )
|
||||||
m_DisplayModText = FILLED;
|
m_DisplayModText = FILLED;
|
||||||
|
|
||||||
|
// Apply display settings for GAL
|
||||||
|
KiGfx::VIEW* view = m_galCanvas->GetView();
|
||||||
|
// Set rendering order of layers
|
||||||
|
for( LAYER_NUM i = 0; i < sizeof(GalLayerOrder) / sizeof(LAYER_NUM); ++i )
|
||||||
|
{
|
||||||
|
wxASSERT( i < KiGfx::VIEW::VIEW_MAX_LAYERS );
|
||||||
|
|
||||||
|
view->SetLayerOrder( GalLayerOrder[i], i );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Netnames are drawn only when scale is sufficient (level of details)
|
||||||
|
// so there is no point in caching them
|
||||||
|
for( LAYER_NUM layer = FIRST_NETNAME_LAYER; layer <= LAST_NETNAME_LAYER; ++layer )
|
||||||
|
{
|
||||||
|
view->SetLayerTarget( layer, KiGfx::TARGET_NONCACHED );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply layer coloring scheme & display options
|
||||||
|
if( view->GetPainter() )
|
||||||
|
{
|
||||||
|
KiGfx::PCB_RENDER_SETTINGS* settings = new KiGfx::PCB_RENDER_SETTINGS();
|
||||||
|
|
||||||
|
// Load layers' colors from PCB data
|
||||||
|
settings->ImportLegacyColors( m_Pcb->GetColorsSettings() );
|
||||||
|
view->GetPainter()->ApplySettings( settings );
|
||||||
|
|
||||||
|
// Load display options (such as filled/outline display of items)
|
||||||
|
settings->LoadDisplayOptions( DisplayOpt );
|
||||||
|
}
|
||||||
|
|
||||||
// WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" )
|
// WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" )
|
||||||
// when reading doubles in config,
|
// when reading doubles in config,
|
||||||
// but forget to back to current locale. So we call SetLocaleTo_Default
|
// but forget to back to current locale. So we call SetLocaleTo_Default
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
|
#include <class_drawpanel_gal.h>
|
||||||
|
#include <view/view.h>
|
||||||
|
#include <pcb_painter.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <wxPcbStruct.h>
|
#include <wxPcbStruct.h>
|
||||||
|
|
||||||
|
@ -67,9 +70,12 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
|
||||||
// Default copper layers count set to 2: double layer board
|
// Default copper layers count set to 2: double layer board
|
||||||
GetBoard()->SetCopperLayerCount( 2 );
|
GetBoard()->SetCopperLayerCount( 2 );
|
||||||
|
|
||||||
// Update display:
|
// Update display
|
||||||
GetBoard()->SetVisibleLayers( ALL_LAYERS );
|
GetBoard()->SetVisibleLayers( ALL_LAYERS );
|
||||||
|
|
||||||
|
// Set currently selected layer to be shown in high contrast mode, when enabled`
|
||||||
|
setHighContrastLayer( GetScreen()->m_Active_Layer );
|
||||||
|
|
||||||
ReFillLayerWidget();
|
ReFillLayerWidget();
|
||||||
|
|
||||||
Zoom_Automatique( false );
|
Zoom_Automatique( false );
|
||||||
|
|
|
@ -472,7 +472,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -813,6 +812,18 @@ void PCB_EDIT_FRAME::syncRenderStates()
|
||||||
void PCB_EDIT_FRAME::syncLayerVisibilities()
|
void PCB_EDIT_FRAME::syncLayerVisibilities()
|
||||||
{
|
{
|
||||||
m_Layers->SyncLayerVisibilities();
|
m_Layers->SyncLayerVisibilities();
|
||||||
|
|
||||||
|
KiGfx::VIEW* view = m_galCanvas->GetView();
|
||||||
|
// Load layer & elements visibility settings
|
||||||
|
for( LAYER_NUM i = 0; i < NB_LAYERS; ++i )
|
||||||
|
{
|
||||||
|
view->SetLayerVisible( i, m_Pcb->IsLayerVisible( i ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( LAYER_NUM i = 0; i < END_PCB_VISIBLE_LIST; ++i )
|
||||||
|
{
|
||||||
|
view->SetLayerVisible( ITEM_GAL_LAYER( i ), m_Pcb->IsElementVisible( i ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue