Unified {Load,Save]CanvasTypeSetting in EDA_DRAW_FRAME
This commit is contained in:
parent
88cab885af
commit
05a120f09f
|
@ -36,7 +36,6 @@
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <id.h>
|
#include <id.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <class_draw_panel_gal.h>
|
|
||||||
#include <class_base_screen.h>
|
#include <class_base_screen.h>
|
||||||
#include <msgpanel.h>
|
#include <msgpanel.h>
|
||||||
#include <draw_frame.h>
|
#include <draw_frame.h>
|
||||||
|
@ -52,7 +51,6 @@
|
||||||
#include <view/view.h>
|
#include <view/view.h>
|
||||||
#include <view/view_controls.h>
|
#include <view/view_controls.h>
|
||||||
#include <gal/graphics_abstraction_layer.h>
|
#include <gal/graphics_abstraction_layer.h>
|
||||||
#include <gal/gal_display_options.h>
|
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tool/tool_dispatcher.h>
|
#include <tool/tool_dispatcher.h>
|
||||||
#include <tool/actions.h>
|
#include <tool/actions.h>
|
||||||
|
@ -76,6 +74,9 @@ static const wxString LastGridSizeIdKeyword( wxT( "_LastGridSize" ) );
|
||||||
/// GAL Display Options
|
/// GAL Display Options
|
||||||
static const wxString GalDisplayOptionsKeyword( wxT( "GalDisplayOptions" ) );
|
static const wxString GalDisplayOptionsKeyword( wxT( "GalDisplayOptions" ) );
|
||||||
|
|
||||||
|
const wxChar EDA_DRAW_FRAME::CANVAS_TYPE_KEY[] = wxT( "canvas_type" );
|
||||||
|
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1169,6 +1170,44 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||||
m_galCanvasActive = aEnable;
|
m_galCanvasActive = aEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::loadCanvasTypeSetting() const
|
||||||
|
{
|
||||||
|
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
||||||
|
wxConfigBase* cfg = Kiface().KifaceSettings();
|
||||||
|
|
||||||
|
if( cfg )
|
||||||
|
canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE) cfg->ReadLong( CANVAS_TYPE_KEY,
|
||||||
|
EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
|
||||||
|
|
||||||
|
if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
|
||||||
|
|| canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
|
||||||
|
{
|
||||||
|
assert( false );
|
||||||
|
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return canvasType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
|
||||||
|
{
|
||||||
|
if( aCanvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
|
||||||
|
|| aCanvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
|
||||||
|
{
|
||||||
|
assert( false );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxConfigBase* cfg = Kiface().KifaceSettings();
|
||||||
|
|
||||||
|
if( cfg )
|
||||||
|
return cfg->Write( CANVAS_TYPE_KEY, (long) aCanvasType );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//-----< BASE_SCREEN API moved here >--------------------------------------------
|
//-----< BASE_SCREEN API moved here >--------------------------------------------
|
||||||
|
|
||||||
wxPoint EDA_DRAW_FRAME::GetCrossHairPosition( bool aInvertY ) const
|
wxPoint EDA_DRAW_FRAME::GetCrossHairPosition( bool aInvertY ) const
|
||||||
|
|
|
@ -563,7 +563,7 @@ void GERBVIEW_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveCanvasTypeSetting( canvasType );
|
saveCanvasTypeSetting( canvasType );
|
||||||
UseGalCanvas( use_gal );
|
UseGalCanvas( use_gal );
|
||||||
wxUpdateUIEvent e;
|
wxUpdateUIEvent e;
|
||||||
OnUpdateSwitchCanvas( e );
|
OnUpdateSwitchCanvas( e );
|
||||||
|
|
|
@ -64,8 +64,6 @@ static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) );
|
||||||
static const wxString cfgShowNegativeObjects( wxT( "ShowNegativeObjectsOpt" ) );
|
static const wxString cfgShowNegativeObjects( wxT( "ShowNegativeObjectsOpt" ) );
|
||||||
static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) );
|
static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) );
|
||||||
|
|
||||||
const wxChar GERBVIEW_FRAME::CANVAS_TYPE_KEY[] = wxT( "canvas_type" );
|
|
||||||
|
|
||||||
|
|
||||||
// Colors for layers and items
|
// Colors for layers and items
|
||||||
COLORS_DESIGN_SETTINGS g_ColorsSettings( FRAME_GERBER );
|
COLORS_DESIGN_SETTINGS g_ColorsSettings( FRAME_GERBER );
|
||||||
|
@ -211,7 +209,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||||
Zoom_Automatique( false ); // Gives a default zoom value
|
Zoom_Automatique( false ); // Gives a default zoom value
|
||||||
UpdateTitleAndInfo();
|
UpdateTitleAndInfo();
|
||||||
|
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = LoadCanvasTypeSetting();
|
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = loadCanvasTypeSetting();
|
||||||
|
|
||||||
if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
|
if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
|
||||||
{
|
{
|
||||||
|
@ -1095,44 +1093,6 @@ void GERBVIEW_FRAME::UseGalCanvas( bool aEnable )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE GERBVIEW_FRAME::LoadCanvasTypeSetting() const
|
|
||||||
{
|
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
|
||||||
wxConfigBase* cfg = Kiface().KifaceSettings();
|
|
||||||
|
|
||||||
if( cfg )
|
|
||||||
canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE) cfg->ReadLong( CANVAS_TYPE_KEY,
|
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
|
|
||||||
|
|
||||||
if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
|
|
||||||
|| canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
|
|
||||||
{
|
|
||||||
assert( false );
|
|
||||||
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return canvasType;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool GERBVIEW_FRAME::SaveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
|
|
||||||
{
|
|
||||||
if( aCanvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
|
|
||||||
|| aCanvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
|
|
||||||
{
|
|
||||||
assert( false );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxConfigBase* cfg = Kiface().KifaceSettings();
|
|
||||||
|
|
||||||
if( cfg )
|
|
||||||
return cfg->Write( CANVAS_TYPE_KEY, (long) aCanvasType );
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GERBVIEW_FRAME::setupTools()
|
void GERBVIEW_FRAME::setupTools()
|
||||||
{
|
{
|
||||||
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#include <class_gbr_screen.h>
|
#include <class_gbr_screen.h>
|
||||||
#include <class_page_info.h>
|
#include <class_page_info.h>
|
||||||
#include <class_gbr_display_options.h>
|
#include <class_gbr_display_options.h>
|
||||||
#include <class_draw_panel_gal.h>
|
|
||||||
#include <class_colors_design_settings.h>
|
#include <class_colors_design_settings.h>
|
||||||
|
|
||||||
extern COLORS_DESIGN_SETTINGS g_ColorsSettings;
|
extern COLORS_DESIGN_SETTINGS g_ColorsSettings;
|
||||||
|
@ -749,21 +748,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent );
|
void OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent );
|
||||||
|
|
||||||
/**
|
|
||||||
* Function LoadCanvasTypeSetting()
|
|
||||||
* Returns the canvas type stored in the application settings.
|
|
||||||
*/
|
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function SaveCanvasTypeSetting()
|
|
||||||
* Stores the canvas type in the application settings.
|
|
||||||
*/
|
|
||||||
bool SaveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType );
|
|
||||||
|
|
||||||
///> Key in KifaceSettings to store the canvas type.
|
|
||||||
static const wxChar CANVAS_TYPE_KEY[];
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <gal/gal_display_options.h>
|
#include <gal/gal_display_options.h>
|
||||||
#include <gal/color4d.h>
|
#include <gal/color4d.h>
|
||||||
|
#include <class_draw_panel_gal.h>
|
||||||
|
|
||||||
class wxSingleInstanceChecker;
|
class wxSingleInstanceChecker;
|
||||||
class EDA_HOTKEY;
|
class EDA_HOTKEY;
|
||||||
|
@ -170,6 +171,19 @@ protected:
|
||||||
*/
|
*/
|
||||||
bool isBusy() const;
|
bool isBusy() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the canvas type stored in the application settings.
|
||||||
|
*/
|
||||||
|
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the canvas type in the application settings.
|
||||||
|
*/
|
||||||
|
bool saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType );
|
||||||
|
|
||||||
|
///> Key in KifaceSettings to store the canvas type.
|
||||||
|
static const wxChar CANVAS_TYPE_KEY[];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||||
FRAME_T aFrameType,
|
FRAME_T aFrameType,
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#include <richio.h>
|
#include <richio.h>
|
||||||
#include <class_pcb_screen.h>
|
#include <class_pcb_screen.h>
|
||||||
#include <pcbstruct.h>
|
#include <pcbstruct.h>
|
||||||
#include <class_draw_panel_gal.h>
|
|
||||||
|
|
||||||
#include <pcb_general_settings.h>
|
#include <pcb_general_settings.h>
|
||||||
|
|
||||||
|
@ -694,18 +693,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent );
|
void OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent );
|
||||||
|
|
||||||
/**
|
|
||||||
* Function LoadCanvasTypeSetting()
|
|
||||||
* Returns the canvas type stored in the application settings.
|
|
||||||
*/
|
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function SaveCanvasTypeSetting()
|
|
||||||
* Stores the canvas type in the application settings.
|
|
||||||
*/
|
|
||||||
bool SaveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType );
|
|
||||||
|
|
||||||
PCB_GENERAL_SETTINGS& Settings()
|
PCB_GENERAL_SETTINGS& Settings()
|
||||||
{
|
{
|
||||||
return m_configSettings;
|
return m_configSettings;
|
||||||
|
|
|
@ -958,7 +958,7 @@ void PCB_BASE_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveCanvasTypeSetting( canvasType );
|
saveCanvasTypeSetting( canvasType );
|
||||||
UseGalCanvas( use_gal );
|
UseGalCanvas( use_gal );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1001,44 +1001,6 @@ void PCB_BASE_FRAME::UseGalCanvas( bool aEnable )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE PCB_BASE_FRAME::LoadCanvasTypeSetting() const
|
|
||||||
{
|
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
|
||||||
wxConfigBase* cfg = Kiface().KifaceSettings();
|
|
||||||
|
|
||||||
if( cfg )
|
|
||||||
canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE) cfg->ReadLong( CANVAS_TYPE_KEY,
|
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
|
|
||||||
|
|
||||||
if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
|
|
||||||
|| canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
|
|
||||||
{
|
|
||||||
assert( false );
|
|
||||||
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return canvasType;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PCB_BASE_FRAME::SaveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
|
|
||||||
{
|
|
||||||
if( aCanvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
|
|
||||||
|| aCanvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
|
|
||||||
{
|
|
||||||
assert( false );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxConfigBase* cfg = Kiface().KifaceSettings();
|
|
||||||
|
|
||||||
if( cfg )
|
|
||||||
return cfg->Write( CANVAS_TYPE_KEY, (long) aCanvasType );
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PCB_BASE_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
|
void PCB_BASE_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
|
||||||
{
|
{
|
||||||
wxMenuBar* menuBar = GetMenuBar();
|
wxMenuBar* menuBar = GetMenuBar();
|
||||||
|
|
|
@ -468,7 +468,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
Zoom_Automatique( false );
|
Zoom_Automatique( false );
|
||||||
|
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = LoadCanvasTypeSetting();
|
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = loadCanvasTypeSetting();
|
||||||
|
|
||||||
if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
|
if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue