Commit e2f5b277 authored by Maciej Suminski's avatar Maciej Suminski

Changed lifetime of RENDER_SETTINGS (now they are accessible right after...

Changed lifetime of RENDER_SETTINGS (now they are accessible right after PAINTER object is created).
parent afe2e27b
......@@ -64,14 +64,13 @@ void RENDER_SETTINGS::update()
PAINTER::PAINTER( GAL* aGal ) :
m_gal( aGal ), m_settings( NULL ), m_brightenedColor( 0.0, 1.0, 0.0, 0.9 )
m_gal( aGal ), m_brightenedColor( 0.0, 1.0, 0.0, 0.9 )
{
}
PAINTER::~PAINTER()
{
delete m_settings;
}
......@@ -91,7 +90,7 @@ void PAINTER::DrawBrightened( const VIEW_ITEM* aItem )
m_gal->PushDepth();
m_gal->SetLayerDepth( -1.0 );
// Draw semitransparent box that marks items as brightened
// Draw an outline that marks items as brightened
m_gal->SetIsStroke( true );
m_gal->SetLineWidth( 100000.0 );
m_gal->SetStrokeColor( m_brightenedColor );
......
......@@ -32,7 +32,7 @@
#include <gal/color4d.h>
#include <colors.h>
#include <boost/shared_ptr.hpp>
class EDA_ITEM;
class COLORS_DESIGN_SETTINGS;
......@@ -187,10 +187,7 @@ public:
*/
virtual void ApplySettings( RENDER_SETTINGS* aSettings )
{
if( m_settings )
delete m_settings;
m_settings = aSettings;
m_settings.reset( aSettings );
}
/**
......@@ -207,7 +204,7 @@ public:
*/
virtual RENDER_SETTINGS* GetSettings() const
{
return m_settings;
return m_settings.get();
}
/**
......@@ -233,7 +230,7 @@ protected:
GAL* m_gal;
/// Colors and display modes settings that are going to be used when drawing items.
RENDER_SETTINGS* m_settings;
boost::shared_ptr<RENDER_SETTINGS> m_settings;
/// Color of brightened item frame
COLOR4D m_brightenedColor;
......
......@@ -191,6 +191,8 @@ void PCB_RENDER_SETTINGS::update()
PCB_PAINTER::PCB_PAINTER( GAL* aGal ) :
PAINTER( aGal )
{
m_settings.reset( new PCB_RENDER_SETTINGS() );
m_pcbSettings = (PCB_RENDER_SETTINGS*) m_settings.get();
}
......
......@@ -27,6 +27,7 @@
#define __CLASS_PCB_PAINTER_H
#include <layers_id_colors_and_visibility.h>
#include <boost/shared_ptr.hpp>
#include <painter.h>
class EDA_ITEM;
......@@ -130,10 +131,11 @@ public:
PAINTER::ApplySettings( aSettings );
// Store PCB specific render settings
m_pcbSettings = dynamic_cast<PCB_RENDER_SETTINGS*>( aSettings );
m_pcbSettings = (PCB_RENDER_SETTINGS*) m_settings.get(); //dynamic_cast<PCB_RENDER_SETTINGS*>( aSettings );
}
protected:
/// Just a properly casted pointer to settings
PCB_RENDER_SETTINGS* m_pcbSettings;
// Drawing functions for various types of PCB-specific items
......
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