Put draw_frame.h GAL_DISPLAY_OPTIONS behind firewall

The GAL_DISPLAY_OPTIONS member of EDA_DRAW_FRAME is a private member and
is used in only a couple of places in the class. The real use of this
member is by a by-ref interface, GetGalDisplayOptions.

Because te GAL options are used by a very select few users of
EDA_DRAW_FRAME, it makes little sense to force all the (many) files
including draw_frame.h to also include gal_display_options.h, when the
vast majority have no need for it.

This massively speeds up compilation of the project when
gal_display_options.h is changed.

More isolation could be acheived by separating the GAL config types (eg
OpenGL antialias modes and grid style) from the options header, as,
although the GAL class uses them, not many includers of the GAL header
need the options struct as well.
This commit is contained in:
John Beard 2017-02-15 13:32:25 +08:00 committed by Maciej Suminski
parent 9d68c970dc
commit cdfcc9a2ab
3 changed files with 15 additions and 6 deletions

View File

@ -51,6 +51,7 @@
#include <view/view.h>
#include <view/view_controls.h>
#include <gal/graphics_abstraction_layer.h>
#include <gal/gal_display_options.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
@ -127,7 +128,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
const wxString& aTitle,
const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxString & aFrameName ) :
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
m_galDisplayOptions( std::make_unique<KIGFX::GAL_DISPLAY_OPTIONS>() )
{
m_file_checker = NULL;
@ -711,7 +713,7 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry,
long( DEFAULT_MAX_UNDO_ITEMS ) );
m_galDisplayOptions.ReadConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
m_galDisplayOptions->ReadConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
}
@ -729,7 +731,7 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
if( GetScreen() )
aCfg->Write( baseCfgName + MaxUndoItemsEntry, long( GetScreen()->GetMaxUndoItems() ) );
m_galDisplayOptions.WriteConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
m_galDisplayOptions->WriteConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
}

View File

@ -29,11 +29,15 @@
#include <wxstruct.h>
#include <kiway_player.h>
#include <climits>
#include <gal/gal_display_options.h>
class wxSingleInstanceChecker;
class EDA_HOTKEY;
namespace KIGFX
{
class GAL_DISPLAY_OPTIONS;
}
#define DEFAULT_MAX_UNDO_ITEMS 0
#define ABS_MAX_UNDO_ITEMS (INT_MAX / 2)
@ -57,7 +61,9 @@ 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;
///< GAL display options - this is the frame's interface to setting GAL display options
std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> m_galDisplayOptions;
protected:
@ -819,7 +825,7 @@ public:
* Function GetGalDisplayOptions
* Returns a reference to the gal rendering options used by GAL for rendering.
*/
KIGFX::GAL_DISPLAY_OPTIONS& GetGalDisplayOptions() { return m_galDisplayOptions; }
KIGFX::GAL_DISPLAY_OPTIONS& GetGalDisplayOptions() { return *m_galDisplayOptions; }
DECLARE_EVENT_TABLE()
};

View File

@ -41,6 +41,7 @@
#include <class_draw_panel_gal.h>
#include <view/view.h>
#include <pcb_painter.h>
#include <gal/gal_display_options.h>
void PCB_EDIT_FRAME::InstallDisplayOptionsDialog( wxCommandEvent& aEvent )