Add UI control to set up gal opengl antialiasing and load/store the settings
This commit is contained in:
parent
d04b3bdc27
commit
77138e3702
|
@ -28,6 +28,7 @@ set( GAL_SRCS
|
|||
worksheet_viewitem.cpp
|
||||
origin_viewitem.cpp
|
||||
gl_context_mgr.cpp
|
||||
gal/gal_display_options.cpp
|
||||
gal/graphics_abstraction_layer.cpp
|
||||
gal/stroke_font.cpp
|
||||
gal/color4d.cpp
|
||||
|
|
|
@ -72,6 +72,8 @@ static const wxString ShowGridEntryKeyword( wxT( "ShowGrid" ) );
|
|||
static const wxString GridColorEntryKeyword( wxT( "GridColor" ) );
|
||||
/// Most recently used grid size (suffix)
|
||||
static const wxString LastGridSizeIdKeyword( wxT( "_LastGridSize" ) );
|
||||
/// GAL Display Options
|
||||
static const wxString GalDisplayOptionsKeyword( wxT( "GalDisplayOptions" ) );
|
||||
|
||||
///@}
|
||||
|
||||
|
@ -708,6 +710,8 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
|
|||
|
||||
m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry,
|
||||
long( DEFAULT_MAX_UNDO_ITEMS ) );
|
||||
|
||||
m_galDisplayOptions.ReadConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
|
||||
}
|
||||
|
||||
|
||||
|
@ -724,6 +728,8 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
|
|||
|
||||
if( GetScreen() )
|
||||
aCfg->Write( baseCfgName + MaxUndoItemsEntry, long( GetScreen()->GetMaxUndoItems() ) );
|
||||
|
||||
m_galDisplayOptions.WriteConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <tool/tool_dispatcher.h>
|
||||
#include <tool/tool_manager.h>
|
||||
|
||||
#include <pcbstruct.h> // display options definition
|
||||
|
||||
#ifdef PROFILE
|
||||
#include <profile.h>
|
||||
|
@ -334,10 +335,12 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
|
|||
|
||||
try
|
||||
{
|
||||
auto& gal_opts = m_edaFrame->GetGalDisplayOptions();
|
||||
|
||||
switch( aGalType )
|
||||
{
|
||||
case GAL_TYPE_OPENGL:
|
||||
new_gal = new KIGFX::OPENGL_GAL( this, this, this );
|
||||
new_gal = new KIGFX::OPENGL_GAL( gal_opts, this, this, this );
|
||||
break;
|
||||
|
||||
case GAL_TYPE_CAIRO:
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
#include <gal/gal_display_options.h>
|
||||
#include <wx/config.h>
|
||||
|
||||
|
||||
namespace KIGFX {
|
||||
|
||||
static const wxString GalGLAntialiasingKeyword( wxT( "OpenGLAntialiasingMode" ) );
|
||||
|
||||
GAL_DISPLAY_OPTIONS::GAL_DISPLAY_OPTIONS()
|
||||
: gl_antialiasing_mode( OPENGL_ANTIALIASING_MODE::NONE )
|
||||
{}
|
||||
|
||||
void GAL_DISPLAY_OPTIONS::ReadConfig( wxConfigBase* aCfg, wxString aBaseName )
|
||||
{
|
||||
aCfg->Read( aBaseName + GalGLAntialiasingKeyword,
|
||||
reinterpret_cast<long*>(&gl_antialiasing_mode),
|
||||
(long)KIGFX::OPENGL_ANTIALIASING_MODE::NONE );
|
||||
|
||||
NotifyChanged();
|
||||
}
|
||||
|
||||
void GAL_DISPLAY_OPTIONS::WriteConfig( wxConfigBase* aCfg, wxString aBaseName )
|
||||
{
|
||||
aCfg->Write( aBaseName + GalGLAntialiasingKeyword,
|
||||
static_cast<long>(gl_antialiasing_mode) );
|
||||
}
|
||||
|
||||
void GAL_DISPLAY_OPTIONS::NotifyChanged()
|
||||
{
|
||||
Notify( &GAL_DISPLAY_OPTIONS_OBSERVER::OnGalDisplayOptionsChanged, *this );
|
||||
}
|
||||
|
||||
}
|
|
@ -188,8 +188,9 @@ namespace KIGFX {
|
|||
// ANTIALIASING_SMAA
|
||||
// ===============================
|
||||
|
||||
ANTIALIASING_SMAA::ANTIALIASING_SMAA( OPENGL_COMPOSITOR* aCompositor )
|
||||
: compositor( aCompositor ), shadersLoaded( false ), areBuffersInitialized( false )
|
||||
ANTIALIASING_SMAA::ANTIALIASING_SMAA( OPENGL_COMPOSITOR* aCompositor, SMAA_QUALITY aQuality )
|
||||
: compositor( aCompositor ), shadersLoaded( false ), areBuffersInitialized( false ),
|
||||
quality( aQuality )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -222,13 +223,22 @@ namespace KIGFX {
|
|||
glTexImage2D( GL_TEXTURE_2D, 0, GL_R8, SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT, 0, GL_RED, GL_UNSIGNED_BYTE, searchTexBytes );
|
||||
checkGlError( "loading smaa search tex" );
|
||||
|
||||
std::string quality_string;
|
||||
|
||||
if(quality == SMAA_QUALITY::HIGH) {
|
||||
quality_string = "#define SMAA_PRESET_HIGH\n";
|
||||
}
|
||||
else {
|
||||
quality_string = "#define SMAA_PRESET_ULTRA\n";
|
||||
}
|
||||
|
||||
|
||||
// set up shaders
|
||||
std::string vert_preamble( R"SHADER(
|
||||
#version 120
|
||||
#define SMAA_GLSL_2_1
|
||||
#define SMAA_INCLUDE_VS 1
|
||||
#define SMAA_INCLUDE_PS 0
|
||||
#define SMAA_PRESET_ULTRA
|
||||
uniform vec4 SMAA_RT_METRICS;
|
||||
)SHADER" );
|
||||
|
||||
|
@ -237,7 +247,6 @@ uniform vec4 SMAA_RT_METRICS;
|
|||
#define SMAA_GLSL_2_1
|
||||
#define SMAA_INCLUDE_VS 0
|
||||
#define SMAA_INCLUDE_PS 1
|
||||
#define SMAA_PRESET_ULTRA
|
||||
uniform vec4 SMAA_RT_METRICS;
|
||||
)SHADER" );
|
||||
|
||||
|
@ -251,10 +260,10 @@ uniform vec4 SMAA_RT_METRICS;
|
|||
// Set up pass 1 Shader
|
||||
//
|
||||
pass_1_shader.reset( new SHADER() );
|
||||
pass_1_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX,
|
||||
vert_preamble, smaa_source, BUILTIN_SHADERS::smaa_pass_1_vertex_shader );
|
||||
pass_1_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT,
|
||||
frag_preamble, smaa_source, BUILTIN_SHADERS::smaa_pass_1_fragment_shader );
|
||||
pass_1_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, vert_preamble,
|
||||
quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_1_vertex_shader );
|
||||
pass_1_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, frag_preamble,
|
||||
quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_1_fragment_shader );
|
||||
pass_1_shader->Link();
|
||||
checkGlError( "linking pass 1 shader" );
|
||||
|
||||
|
@ -269,10 +278,10 @@ uniform vec4 SMAA_RT_METRICS;
|
|||
// set up pass 2 shader
|
||||
//
|
||||
pass_2_shader.reset( new SHADER() );
|
||||
pass_2_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX,
|
||||
vert_preamble, smaa_source, BUILTIN_SHADERS::smaa_pass_2_vertex_shader );
|
||||
pass_2_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT,
|
||||
frag_preamble, smaa_source, BUILTIN_SHADERS::smaa_pass_2_fragment_shader );
|
||||
pass_2_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, vert_preamble,
|
||||
quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_2_vertex_shader );
|
||||
pass_2_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, frag_preamble,
|
||||
quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_2_fragment_shader );
|
||||
pass_2_shader->Link();
|
||||
checkGlError( "linking pass 2 shader" );
|
||||
|
||||
|
@ -291,10 +300,10 @@ uniform vec4 SMAA_RT_METRICS;
|
|||
// set up pass 3 shader
|
||||
//
|
||||
pass_3_shader.reset( new SHADER() );
|
||||
pass_3_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX,
|
||||
vert_preamble, smaa_source, BUILTIN_SHADERS::smaa_pass_3_vertex_shader );
|
||||
pass_3_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT,
|
||||
frag_preamble, smaa_source, BUILTIN_SHADERS::smaa_pass_3_fragment_shader );
|
||||
pass_3_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, vert_preamble,
|
||||
quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_3_vertex_shader );
|
||||
pass_3_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, frag_preamble,
|
||||
quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_3_fragment_shader );
|
||||
pass_3_shader->Link();
|
||||
|
||||
GLint smaaP3ColorTexParameter = pass_3_shader->AddParameter( "colorTex" ); checkGlError( "pass3: getting colorTex uniform" );
|
||||
|
|
|
@ -71,9 +71,14 @@ namespace KIGFX {
|
|||
std::unique_ptr< SHADER > x4_shader;
|
||||
};
|
||||
|
||||
enum class SMAA_QUALITY {
|
||||
HIGH,
|
||||
ULTRA
|
||||
};
|
||||
|
||||
class ANTIALIASING_SMAA : public OPENGL_PRESENTOR {
|
||||
public:
|
||||
ANTIALIASING_SMAA ( OPENGL_COMPOSITOR* aCompositor );
|
||||
ANTIALIASING_SMAA ( OPENGL_COMPOSITOR* aCompositor, SMAA_QUALITY aQuality );
|
||||
|
||||
bool Init() override;
|
||||
unsigned int CreateBuffer () override;
|
||||
|
@ -111,6 +116,7 @@ namespace KIGFX {
|
|||
std::unique_ptr< SHADER > pass_3_shader;
|
||||
GLint pass_3_metrics;
|
||||
|
||||
SMAA_QUALITY quality;
|
||||
OPENGL_COMPOSITOR* compositor;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013-2016 CERN
|
||||
|
@ -40,8 +40,7 @@ OPENGL_COMPOSITOR::OPENGL_COMPOSITOR() :
|
|||
m_initialized( false ), m_curBuffer( 0 ),
|
||||
m_mainFbo( 0 ), m_depthBuffer( 0 ), m_curFbo( DIRECT_RENDERING )
|
||||
{
|
||||
//m_antialiasing.reset( new ANTIALIASING_SUPERSAMPLING( this, SUPERSAMPLING_MODE::X4 ) );
|
||||
m_antialiasing.reset( new ANTIALIASING_SMAA( this ) );
|
||||
m_antialiasing.reset( new ANTIALIASING_NONE( this ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,12 +50,41 @@ OPENGL_COMPOSITOR::~OPENGL_COMPOSITOR()
|
|||
clean();
|
||||
}
|
||||
|
||||
void OPENGL_COMPOSITOR::SetAntialiasingMode( OPENGL_ANTIALIASING_MODE aMode )
|
||||
{
|
||||
m_currentAntialiasingMode = aMode;
|
||||
if(m_initialized)
|
||||
clean();
|
||||
}
|
||||
|
||||
OPENGL_ANTIALIASING_MODE OPENGL_COMPOSITOR::GetAntialiasingMode() const
|
||||
{
|
||||
return m_currentAntialiasingMode;
|
||||
}
|
||||
|
||||
void OPENGL_COMPOSITOR::Initialize()
|
||||
{
|
||||
if( m_initialized )
|
||||
return;
|
||||
|
||||
switch(m_currentAntialiasingMode) {
|
||||
case OPENGL_ANTIALIASING_MODE::NONE:
|
||||
m_antialiasing.reset( new ANTIALIASING_NONE( this ) );
|
||||
break;
|
||||
case OPENGL_ANTIALIASING_MODE::SUBSAMPLE_HIGH:
|
||||
m_antialiasing.reset( new ANTIALIASING_SMAA( this, SMAA_QUALITY::HIGH ) );
|
||||
break;
|
||||
case OPENGL_ANTIALIASING_MODE::SUBSAMPLE_ULTRA:
|
||||
m_antialiasing.reset( new ANTIALIASING_SMAA( this, SMAA_QUALITY::ULTRA ) );
|
||||
break;
|
||||
case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2:
|
||||
m_antialiasing.reset( new ANTIALIASING_SUPERSAMPLING( this, SUPERSAMPLING_MODE::X2 ) );
|
||||
break;
|
||||
case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4:
|
||||
m_antialiasing.reset( new ANTIALIASING_SUPERSAMPLING( this, SUPERSAMPLING_MODE::X4 ) );
|
||||
break;
|
||||
}
|
||||
|
||||
VECTOR2U dims = m_antialiasing->GetInternalBufferSize();
|
||||
|
||||
// We need framebuffer objects for drawing the screen contents
|
||||
|
|
|
@ -62,12 +62,14 @@ bool OPENGL_GAL::isBitmapFontLoaded = false;
|
|||
SHADER* OPENGL_GAL::shader = NULL;
|
||||
|
||||
|
||||
OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
|
||||
wxEvtHandler* aPaintListener, const wxString& aName ) :
|
||||
OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
|
||||
wxEvtHandler* aMouseListener, wxEvtHandler* aPaintListener,
|
||||
const wxString& aName ) :
|
||||
wxGLCanvas( aParent, wxID_ANY, (int*) glAttributes, wxDefaultPosition, wxDefaultSize,
|
||||
wxEXPAND, aName ),
|
||||
mouseListener( aMouseListener ),
|
||||
paintListener( aPaintListener )
|
||||
paintListener( aPaintListener ),
|
||||
options( aDisplayOptions )
|
||||
{
|
||||
if( glMainContext == NULL )
|
||||
{
|
||||
|
@ -94,6 +96,7 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
|
|||
overlayManager->SetShader( *shader );
|
||||
|
||||
compositor = new OPENGL_COMPOSITOR;
|
||||
compositor->SetAntialiasingMode( options.gl_antialiasing_mode );
|
||||
|
||||
// Initialize the flags
|
||||
isFramebufferInitialized = false;
|
||||
|
@ -105,6 +108,8 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
|
|||
SetViewWantsBestResolution( true );
|
||||
#endif
|
||||
|
||||
observerLink = options.Subscribe( this );
|
||||
|
||||
// Connecting the event handlers
|
||||
Connect( wxEVT_PAINT, wxPaintEventHandler( OPENGL_GAL::onPaint ) );
|
||||
|
||||
|
@ -187,6 +192,15 @@ OPENGL_GAL::~OPENGL_GAL()
|
|||
|
||||
}
|
||||
|
||||
void OPENGL_GAL::OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& aDisplayOptions )
|
||||
{
|
||||
if(options.gl_antialiasing_mode != compositor->GetAntialiasingMode())
|
||||
{
|
||||
compositor->SetAntialiasingMode( options.gl_antialiasing_mode );
|
||||
isFramebufferInitialized = false;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void OPENGL_GAL::BeginDrawing()
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <wxstruct.h>
|
||||
#include <kiway_player.h>
|
||||
#include <climits>
|
||||
#include <gal/gal_display_options.h>
|
||||
|
||||
class wxSingleInstanceChecker;
|
||||
class EDA_HOTKEY;
|
||||
|
@ -56,6 +57,7 @@ class EDA_DRAW_FRAME : public KIWAY_PLAYER
|
|||
bool m_galCanvasActive; ///< whether to use new GAL engine
|
||||
|
||||
EDA_DRAW_PANEL_GAL* m_galCanvas;
|
||||
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -813,6 +815,12 @@ public:
|
|||
*/
|
||||
virtual void* GetDisplayOptions() { return NULL; }
|
||||
|
||||
/**
|
||||
* Function GetGalDisplayOptions
|
||||
* Returns a reference to the gal rendering options used by GAL for rendering.
|
||||
*/
|
||||
KIGFX::GAL_DISPLAY_OPTIONS& GetGalDisplayOptions() { return m_galDisplayOptions; }
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
#ifndef GAL_DISPLAY_OPTIONS_H__
|
||||
#define GAL_DISPLAY_OPTIONS_H__
|
||||
|
||||
#include <observable.h>
|
||||
|
||||
class wxConfigBase;
|
||||
class wxString;
|
||||
|
||||
namespace KIGFX {
|
||||
|
||||
class GAL_DISPLAY_OPTIONS;
|
||||
|
||||
enum class OPENGL_ANTIALIASING_MODE : long {
|
||||
NONE = 0,
|
||||
SUBSAMPLE_HIGH = 1,
|
||||
SUBSAMPLE_ULTRA = 2,
|
||||
SUPERSAMPLING_X2 = 3,
|
||||
SUPERSAMPLING_X4 = 4
|
||||
};
|
||||
|
||||
class GAL_DISPLAY_OPTIONS_OBSERVER
|
||||
{
|
||||
public:
|
||||
virtual void OnGalDisplayOptionsChanged(const GAL_DISPLAY_OPTIONS&) = 0;
|
||||
};
|
||||
|
||||
class GAL_DISPLAY_OPTIONS
|
||||
: public UTIL::OBSERVABLE< GAL_DISPLAY_OPTIONS_OBSERVER >
|
||||
{
|
||||
public:
|
||||
GAL_DISPLAY_OPTIONS();
|
||||
|
||||
OPENGL_ANTIALIASING_MODE gl_antialiasing_mode;
|
||||
|
||||
void ReadConfig ( wxConfigBase* aCfg, wxString aBaseName );
|
||||
void WriteConfig( wxConfigBase* aCfg, wxString aBaseName );
|
||||
|
||||
void NotifyChanged();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include <gal/compositor.h>
|
||||
#include <gal/opengl/antialiasing.h>
|
||||
#include <gal/gal_display_options.h>
|
||||
#include <GL/glew.h>
|
||||
#include <deque>
|
||||
|
||||
|
@ -87,6 +88,9 @@ public:
|
|||
void DrawBuffer( unsigned int aSourceHandle, unsigned int aDestHandle );
|
||||
unsigned int CreateBuffer( VECTOR2U aDimensions );
|
||||
|
||||
void SetAntialiasingMode( OPENGL_ANTIALIASING_MODE aMode ); // clears all buffers
|
||||
OPENGL_ANTIALIASING_MODE GetAntialiasingMode() const;
|
||||
|
||||
protected:
|
||||
// Buffers are simply textures storing a result of certain target rendering.
|
||||
typedef struct
|
||||
|
@ -108,6 +112,7 @@ protected:
|
|||
/// Store the used FBO name in case there was more than one compositor used
|
||||
GLuint m_curFbo;
|
||||
|
||||
OPENGL_ANTIALIASING_MODE m_currentAntialiasingMode;
|
||||
std::unique_ptr< OPENGL_PRESENTOR > m_antialiasing;
|
||||
|
||||
/// Binds a specific Framebuffer Object.
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
// GAL imports
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <gal/gal_display_options.h>
|
||||
#include <gal/opengl/shader.h>
|
||||
#include <gal/opengl/vertex_manager.h>
|
||||
#include <gal/opengl/vertex_item.h>
|
||||
|
@ -61,7 +62,7 @@ class SHADER;
|
|||
* and quads. The purpose is to provide a fast graphics interface, that takes advantage of modern
|
||||
* graphics card GPUs. All methods here benefit thus from the hardware acceleration.
|
||||
*/
|
||||
class OPENGL_GAL : public GAL, public wxGLCanvas
|
||||
class OPENGL_GAL : public GAL, public wxGLCanvas, GAL_DISPLAY_OPTIONS_OBSERVER
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -79,8 +80,9 @@ public:
|
|||
*
|
||||
* @param aName is the name of this window for use by wxWindow::FindWindowByName()
|
||||
*/
|
||||
OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener = NULL,
|
||||
wxEvtHandler* aPaintListener = NULL, const wxString& aName = wxT( "GLCanvas" ) );
|
||||
OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
|
||||
wxEvtHandler* aMouseListener = nullptr, wxEvtHandler* aPaintListener = nullptr,
|
||||
const wxString& aName = wxT( "GLCanvas" ) );
|
||||
|
||||
virtual ~OPENGL_GAL();
|
||||
|
||||
|
@ -92,6 +94,8 @@ public:
|
|||
return IsShownOnScreen();
|
||||
}
|
||||
|
||||
void OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& ) override;
|
||||
|
||||
// ---------------
|
||||
// Drawing methods
|
||||
// ---------------
|
||||
|
@ -271,6 +275,9 @@ private:
|
|||
/// Super class definition
|
||||
typedef GAL super;
|
||||
|
||||
GAL_DISPLAY_OPTIONS& options;
|
||||
UTIL::LINK observerLink;
|
||||
|
||||
static const int CIRCLE_POINTS = 64; ///< The number of points for circle approximation
|
||||
static const int CURVE_POINTS = 32; ///< The number of points for curve approximation
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ void DIALOG_DISPLAY_OPTIONS::init()
|
|||
{
|
||||
SetFocus();
|
||||
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
|
||||
KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = m_Parent->GetGalDisplayOptions();
|
||||
|
||||
m_OptDisplayTracks->SetValue( displ_opts->m_DisplayPcbTrackFill == SKETCH );
|
||||
|
||||
|
@ -107,6 +108,25 @@ void DIALOG_DISPLAY_OPTIONS::init()
|
|||
m_OptDisplayPadNoConn->SetValue( m_Parent->IsElementVisible( PCB_VISIBLE( NO_CONNECTS_VISIBLE ) ) );
|
||||
m_OptDisplayDrawings->SetValue( displ_opts->m_DisplayDrawItemsFill == SKETCH );
|
||||
m_ShowNetNamesOption->SetSelection( displ_opts->m_DisplayNetNamesMode );
|
||||
|
||||
switch(gal_opts.gl_antialiasing_mode) {
|
||||
case KIGFX::OPENGL_ANTIALIASING_MODE::NONE:
|
||||
m_choiceAntialiasing->Select( 0 );
|
||||
break;
|
||||
case KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_HIGH:
|
||||
m_choiceAntialiasing->Select( 1 );
|
||||
break;
|
||||
case KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_ULTRA:
|
||||
m_choiceAntialiasing->Select( 2 );
|
||||
break;
|
||||
case KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2:
|
||||
m_choiceAntialiasing->Select( 3 );
|
||||
break;
|
||||
case KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4:
|
||||
m_choiceAntialiasing->Select( 4 );
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,6 +141,7 @@ void DIALOG_DISPLAY_OPTIONS::OnCancelClick( wxCommandEvent& event )
|
|||
void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
|
||||
{
|
||||
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
|
||||
KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = m_Parent->GetGalDisplayOptions();
|
||||
|
||||
m_Parent->SetShowPageLimits( m_Show_Page_Limits->GetValue() );
|
||||
|
||||
|
@ -165,6 +186,31 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
|
|||
displ_opts->m_DisplayDrawItemsFill = not m_OptDisplayDrawings->GetValue();
|
||||
displ_opts->m_DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
|
||||
|
||||
switch(m_choiceAntialiasing->GetSelection()) {
|
||||
case 0:
|
||||
gal_opts.gl_antialiasing_mode =
|
||||
KIGFX::OPENGL_ANTIALIASING_MODE::NONE;
|
||||
break;
|
||||
case 1:
|
||||
gal_opts.gl_antialiasing_mode =
|
||||
KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_HIGH;
|
||||
break;
|
||||
case 2:
|
||||
gal_opts.gl_antialiasing_mode =
|
||||
KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_ULTRA;
|
||||
break;
|
||||
case 3:
|
||||
gal_opts.gl_antialiasing_mode =
|
||||
KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2;
|
||||
break;
|
||||
case 4:
|
||||
gal_opts.gl_antialiasing_mode =
|
||||
KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4;
|
||||
break;
|
||||
}
|
||||
|
||||
gal_opts.NotifyChanged();
|
||||
|
||||
// Apply changes to the GAL
|
||||
KIGFX::VIEW* view = m_Parent->GetGalCanvas()->GetView();
|
||||
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version May 10 2016)
|
||||
// C++ code generated with wxFormBuilder (version Dec 15 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -37,7 +37,7 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
|
|||
wxStaticBoxSizer* sOpenGLRenderingSizer;
|
||||
sOpenGLRenderingSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("OpenGL Rendering:") ), wxVERTICAL );
|
||||
|
||||
wxString m_choiceAntialiasingChoices[] = { _("No Antialiasing"), _("Subpixel Antialiasing"), _("2x Supersampling"), _("4x Supersampling") };
|
||||
wxString m_choiceAntialiasingChoices[] = { _("No Antialiasing"), _("Subpixel Antialiasing (High Quality)"), _("Subpixel Antialiasing (Ultra Quality)"), _("Supersampling (2x)"), _("Supersampling (4x)") };
|
||||
int m_choiceAntialiasingNChoices = sizeof( m_choiceAntialiasingChoices ) / sizeof( wxString );
|
||||
m_choiceAntialiasing = new wxChoice( sOpenGLRenderingSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceAntialiasingNChoices, m_choiceAntialiasingChoices, 0 );
|
||||
m_choiceAntialiasing->SetSelection( 0 );
|
||||
|
|
|
@ -333,7 +333,7 @@
|
|||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"No Antialiasing" "Subpixel Antialiasing" "2x Supersampling" "4x Supersampling"</property>
|
||||
<property name="choices">"No Antialiasing" "Subpixel Antialiasing (High Quality)" "Subpixel Antialiasing (Ultra Quality)" "Supersampling (2x)" "Supersampling (4x)"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version May 10 2016)
|
||||
// C++ code generated with wxFormBuilder (version Dec 15 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
|
Loading…
Reference in New Issue