Implement a new settings framework across all of KiCad
CHANGED: Settings are now stored in versioned sub-directories ADDED: First-run dialog for migrating settings from a previous version CHANGED: Settings are now stored as JSON files instead of wxConfig-style INI files CHANGED: Color settings are now all stored in a separate settings file CHANGED: The symbol editor and footprint editor now have their own settings files CHANGED: Color settings are no longer exposed through BOARD object CHANGED: Page layout editor now uses Eeschema's color scheme Settings are now managed through a central SETTINGS_MANAGER held by PGM_BASE. Existing settings will be migrated from the wxConfig format on first run of each application. Per-application settings are now stored in one class for each application.
This commit is contained in:
parent
1449af40ed
commit
e59a3d981e
|
@ -57,6 +57,7 @@
|
|||
#include <filename_resolver.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project.h>
|
||||
#include <settings/settings_manager.h>
|
||||
|
||||
|
||||
#define MASK_3D_CACHE "3D_CACHE"
|
||||
|
@ -793,7 +794,7 @@ S3D_CACHE* PROJECT::Get3DCacheManager( bool aUpdateProjDir )
|
|||
cache = new S3D_CACHE();
|
||||
|
||||
wxFileName cfgpath;
|
||||
cfgpath.AssignDir( GetKicadConfigPath() );
|
||||
cfgpath.AssignDir( SETTINGS_MANAGER::GetUserSettingsPath() );
|
||||
cfgpath.AppendDir( wxT( "3d" ) );
|
||||
|
||||
cache->SetProgramBase( &Pgm() );
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <wx/config.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/dynlib.h>
|
||||
#include <wx/filename.h>
|
||||
|
|
|
@ -26,13 +26,14 @@
|
|||
|
||||
#include "panel_prev_model.h"
|
||||
#include <3d_canvas/eda_3d_canvas.h>
|
||||
#include <common_ogl/cogl_att_list.h>
|
||||
#include <class_board.h>
|
||||
#include <base_units.h>
|
||||
#include <bitmaps.h>
|
||||
#include <class_board.h>
|
||||
#include <common_ogl/cogl_att_list.h>
|
||||
#include <dpi_scaling.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project.h>
|
||||
#include <settings/common_settings.h>
|
||||
|
||||
|
||||
PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE* aModule,
|
||||
|
@ -43,9 +44,6 @@ PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE*
|
|||
|
||||
initPanel();
|
||||
|
||||
// Initialize the color settings to draw the board and the footprint
|
||||
m_dummyBoard->SetGeneralSettings( &aFrame->Settings() );
|
||||
|
||||
m_parentModelList = aParentModelList;
|
||||
|
||||
m_dummyModule = new MODULE( *aModule );
|
||||
|
@ -109,18 +107,12 @@ void PANEL_PREV_3D::loadCommonSettings()
|
|||
{
|
||||
wxCHECK_RET( m_previewPane, "Cannot load settings to null canvas" );
|
||||
|
||||
wxConfigBase& cmnCfg = *Pgm().CommonSettings();
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
|
||||
{
|
||||
const DPI_SCALING dpi{ &cmnCfg, this };
|
||||
const DPI_SCALING dpi{ settings, this };
|
||||
m_previewPane->SetScaleFactor( dpi.GetScaleFactor() );
|
||||
}
|
||||
|
||||
{
|
||||
bool option;
|
||||
cmnCfg.Read( ENBL_MOUSEWHEEL_PAN_KEY, &option, false );
|
||||
m_settings3Dviewer->SetFlag( FL_MOUSEWHEEL_PANNING, option );
|
||||
}
|
||||
m_settings3Dviewer->SetFlag( FL_MOUSEWHEEL_PANNING, settings->m_Input.mousewheel_pan );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#include "3d_fastmath.h"
|
||||
#include <geometry/geometry_utils.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <pgm_base.h>
|
||||
#include <settings/settings_manager.h>
|
||||
|
||||
/**
|
||||
* Trace mask used to enable or disable the trace output of this class.
|
||||
|
@ -59,6 +61,9 @@ CINFO3D_VISU::CINFO3D_VISU() :
|
|||
m_3D_grid_type = GRID3D_TYPE::NONE;
|
||||
m_drawFlags.resize( FL_LAST, false );
|
||||
|
||||
if( PgmOrNull() )
|
||||
m_colors = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
m_render_engine = RENDER_ENGINE::OPENGL_LEGACY;
|
||||
m_material_mode = MATERIAL_MODE::NORMAL;
|
||||
|
||||
|
@ -504,7 +509,7 @@ SFVEC3F CINFO3D_VISU::GetLayerColor( PCB_LAYER_ID aLayerId ) const
|
|||
{
|
||||
wxASSERT( aLayerId < PCB_LAYER_ID_COUNT );
|
||||
|
||||
const COLOR4D color = m_board->Colors().GetLayerColor( aLayerId );
|
||||
const COLOR4D color = m_colors->GetColor( aLayerId );
|
||||
|
||||
return SFVEC3F( color.r, color.g, color.b );
|
||||
}
|
||||
|
@ -512,7 +517,7 @@ SFVEC3F CINFO3D_VISU::GetLayerColor( PCB_LAYER_ID aLayerId ) const
|
|||
|
||||
SFVEC3F CINFO3D_VISU::GetItemColor( int aItemId ) const
|
||||
{
|
||||
return GetColor( m_board->Colors().GetItemColor( aItemId ) );
|
||||
return GetColor( m_colors->GetColor( aItemId ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -51,6 +51,9 @@
|
|||
#include <class_module.h>
|
||||
#include <reporter.h>
|
||||
|
||||
|
||||
class COLOR_SETTINGS;
|
||||
|
||||
/// A type that stores a container of 2d objects for each layer id
|
||||
typedef std::map< PCB_LAYER_ID, CBVHCONTAINER2D *> MAP_CONTAINER_2D;
|
||||
|
||||
|
@ -127,6 +130,8 @@ class CINFO3D_VISU
|
|||
*/
|
||||
const BOARD *GetBoard() const { return m_board; }
|
||||
|
||||
void SetColorSettings( COLOR_SETTINGS* aSettings ) { m_colors = aSettings; }
|
||||
|
||||
/**
|
||||
* @brief InitSettings - Function to be called by the render when it need to
|
||||
* reload the settings for the board.
|
||||
|
@ -519,6 +524,8 @@ private:
|
|||
/// pointer to the 3d model manager
|
||||
S3D_CACHE *m_3d_model_manager;
|
||||
|
||||
/// pointer to current color settings
|
||||
COLOR_SETTINGS* m_colors;
|
||||
|
||||
// Render options
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
#include <bitmaps.h>
|
||||
#include <hotkeys_basic.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <pgm_base.h>
|
||||
#include <settings/settings_manager.h>
|
||||
|
||||
#include <widgets/wx_busy_indicator.h>
|
||||
|
||||
|
@ -153,6 +155,8 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow *aParent,
|
|||
wxASSERT( aBoard != NULL );
|
||||
m_settings.SetBoard( aBoard );
|
||||
|
||||
m_settings.SetColorSettings( Pgm().GetSettingsManager().GetColorSettings() );
|
||||
|
||||
wxASSERT( a3DCachePointer != NULL );
|
||||
m_settings.Set3DCacheManager( a3DCachePointer );
|
||||
}
|
||||
|
@ -285,6 +289,8 @@ void EDA_3D_CANVAS::ReloadRequest( BOARD *aBoard , S3D_CACHE *aCachePointer )
|
|||
if( aBoard != NULL )
|
||||
m_settings.SetBoard( aBoard );
|
||||
|
||||
m_settings.SetColorSettings( Pgm().GetSettingsManager().GetColorSettings() );
|
||||
|
||||
if( m_3d_render )
|
||||
m_3d_render->ReloadRequest();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <3d_enums.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <settings/parameters.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <wx/config.h>
|
||||
|
||||
#include "3d_viewer_settings.h"
|
||||
|
||||
///! Update the schema version whenever a migration is required
|
||||
const int viewer3dSchemaVersion = 0;
|
||||
|
||||
|
||||
EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
APP_SETTINGS_BASE( "3d_viewer", viewer3dSchemaVersion ), m_Render()
|
||||
{
|
||||
m_params.emplace_back( new PARAM<int>( "render.engine", &m_Render.engine,
|
||||
static_cast<int>( RENDER_ENGINE::OPENGL_LEGACY ),
|
||||
static_cast<int>( RENDER_ENGINE::OPENGL_LEGACY ),
|
||||
static_cast<int>( RENDER_ENGINE::RAYTRACING ) ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "render.grid_type", &m_Render.grid_type,
|
||||
static_cast<int>( GRID3D_TYPE::NONE ),
|
||||
static_cast<int>( GRID3D_TYPE::NONE ),
|
||||
static_cast<int>( GRID3D_TYPE::GRID_10MM ) ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "render.material_mode", &m_Render.material_mode,
|
||||
static_cast<int>( MATERIAL_MODE::NORMAL ),
|
||||
static_cast<int>( MATERIAL_MODE::NORMAL ),
|
||||
static_cast<int>( MATERIAL_MODE::CAD_MODE ) ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>(
|
||||
"render.opengl_copper_thickness", &m_Render.opengl_copper_thickness, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>(
|
||||
"render.opengl_show_model_bbox", &m_Render.opengl_show_model_bbox, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.raytrace_anti_aliasing",
|
||||
&m_Render.raytrace_anti_aliasing, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.raytrace_backfloor",
|
||||
&m_Render.raytrace_backfloor, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.raytrace_post_processing",
|
||||
&m_Render.raytrace_post_processing, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.raytrace_procedural_textures",
|
||||
&m_Render.raytrace_procedural_textures, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.raytrace_reflections",
|
||||
&m_Render.raytrace_reflections, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.raytrace_refractions",
|
||||
&m_Render.raytrace_refractions, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.raytrace_shadows",
|
||||
&m_Render.raytrace_shadows, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.realistic", &m_Render.realistic, true ) );
|
||||
m_params.emplace_back(
|
||||
new PARAM<bool>( "render.show_adhesive", &m_Render.show_adhesive, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_axis", &m_Render.show_axis, true ) );
|
||||
m_params.emplace_back(
|
||||
new PARAM<bool>( "render.show_board_body", &m_Render.show_board_body, true ) );
|
||||
m_params.emplace_back(
|
||||
new PARAM<bool>( "render.show_comments", &m_Render.show_comments, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_eco", &m_Render.show_eco, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_insert",
|
||||
&m_Render.show_footprints_insert, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_normal",
|
||||
&m_Render.show_footprints_normal, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_virtual",
|
||||
&m_Render.show_footprints_virtual, true ) );
|
||||
m_params.emplace_back(
|
||||
new PARAM<bool>( "render.show_silkscreen", &m_Render.show_silkscreen, true ) );
|
||||
m_params.emplace_back(
|
||||
new PARAM<bool>( "render.show_soldermask", &m_Render.show_soldermask, true ) );
|
||||
m_params.emplace_back(
|
||||
new PARAM<bool>( "render.show_solderpaste", &m_Render.show_solderpaste, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_zones", &m_Render.show_zones, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.subtract_mask_from_silk",
|
||||
&m_Render.subtract_mask_from_silk, false ) );
|
||||
}
|
||||
|
||||
|
||||
bool EDA_3D_VIEWER_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
||||
{
|
||||
bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg );
|
||||
|
||||
ret &= fromLegacy<int>( aCfg, "RenderEngine", "render.engine" );
|
||||
ret &= fromLegacy<int>( aCfg, "ShowGrid3D", "render.grid_type" );
|
||||
ret &= fromLegacy<int>( aCfg, "Render_Material", "render.material_mode" );
|
||||
ret &= fromLegacy<bool>(
|
||||
aCfg, "Render_OGL_ShowCopperThickness", "render.opengl_copper_thickness" );
|
||||
ret &= fromLegacy<bool>(
|
||||
aCfg, "Render_OGL_ShowModelBoudingBoxes", "render.opengl_show_model_bbox" );
|
||||
ret &= fromLegacy<bool>( aCfg, "Render_RAY_AntiAliasing", "render.raytrace_anti_aliasing" );
|
||||
ret &= fromLegacy<bool>( aCfg, "Render_RAY_Backfloor", "render.raytrace_backfloor" );
|
||||
ret &= fromLegacy<bool>( aCfg, "Render_RAY_PostProcess", "render.raytrace_post_processing" );
|
||||
ret &= fromLegacy<bool>(
|
||||
aCfg, "Render_RAY_ProceduralTextures", "render.raytrace_procedural_textures" );
|
||||
ret &= fromLegacy<bool>( aCfg, "Render_RAY_Reflections", "render.raytrace_reflections" );
|
||||
ret &= fromLegacy<bool>( aCfg, "Render_RAY_Refractions", "render.raytrace_refractions" );
|
||||
ret &= fromLegacy<bool>( aCfg, "Render_RAY_Shadows", "render.raytrace_shadows" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowRealisticMode", "render.realistic" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowAdhesiveLayers", "render.show_adhesive" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowAxis", "render.show_axis" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowBoardBody", "render.show_board_body" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowCommentsLayers", "render.show_comments" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowEcoLayers", "render.show_eco" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowFootprints_Insert", "render.show_footprints_insert" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowFootprints_Normal", "render.show_footprints_normal" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowFootprints_Virtual", "render.show_footprints_virtual" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowSilkScreenLayers", "render.show_silkscreen" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowSolderMasLayers", "render.show_soldermask" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowSolderPasteLayers", "render.show_solderpaste" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowZones", "render.show_zones" );
|
||||
ret &= fromLegacy<bool>( aCfg, "SubtractMaskFromSilk", "render.subtract_mask_from_silk" );
|
||||
|
||||
auto migrate_color =
|
||||
[&] ( const std::string& k_r, const std::string& k_g,
|
||||
const std::string &k_b, std::string dest )
|
||||
{
|
||||
COLOR4D color( 1, 1, 1, 1 );
|
||||
|
||||
if( aCfg->Read( k_r, &color.r ) &&
|
||||
aCfg->Read( k_g, &color.g ) && aCfg->Read( k_b, &color.b ) )
|
||||
{
|
||||
( *this )[PointerFromString( dest )] = color;
|
||||
}
|
||||
};
|
||||
|
||||
migrate_color( "BgColor_Red", "BgColor_Green", "BgColor_Blue", "colors.background_bottom" );
|
||||
migrate_color(
|
||||
"BgColor_Red_Top", "BgColor_Green_Top", "BgColor_Blue_Top", "colors.background_top" );
|
||||
migrate_color(
|
||||
"BoardBodyColor_Red", "BoardBodyColor_Green", "BoardBodyColor_Blue", "colors.board" );
|
||||
migrate_color( "CopperColor_Red", "CopperColor_Green", "CopperColor_Blue", "colors.copper" );
|
||||
migrate_color(
|
||||
"SilkColor_Red", "SilkColor_Green", "SilkColor_Blue", "colors.silkscreen_bottom" );
|
||||
migrate_color( "SilkColor_Red", "SilkColor_Green", "SilkColor_Blue", "colors.silkscreen_top" );
|
||||
migrate_color( "SMaskColor_Red", "SMaskColor_Green", "SMaskColor_Blue", "colors.soldermask" );
|
||||
migrate_color(
|
||||
"SPasteColor_Red", "SPasteColor_Green", "SPasteColor_Blue", "colors.solderpaste" );
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef EDA_3D_VIEWER_SETTINGS_H_
|
||||
#define EDA_3D_VIEWER_SETTINGS_H_
|
||||
|
||||
#include <settings/app_settings.h>
|
||||
#include <settings/parameters.h>
|
||||
|
||||
|
||||
class EDA_3D_VIEWER_SETTINGS : public APP_SETTINGS_BASE
|
||||
{
|
||||
public:
|
||||
struct RENDER_SETTINGS
|
||||
{
|
||||
int engine;
|
||||
int grid_type;
|
||||
int material_mode;
|
||||
bool opengl_copper_thickness;
|
||||
bool opengl_show_model_bbox;
|
||||
bool raytrace_anti_aliasing;
|
||||
bool raytrace_backfloor;
|
||||
bool raytrace_post_processing;
|
||||
bool raytrace_procedural_textures;
|
||||
bool raytrace_reflections;
|
||||
bool raytrace_refractions;
|
||||
bool raytrace_shadows;
|
||||
bool realistic;
|
||||
bool show_adhesive;
|
||||
bool show_axis;
|
||||
bool show_board_body;
|
||||
bool show_comments;
|
||||
bool show_eco;
|
||||
bool show_footprints_insert;
|
||||
bool show_footprints_normal;
|
||||
bool show_footprints_virtual;
|
||||
bool show_silkscreen;
|
||||
bool show_soldermask;
|
||||
bool show_solderpaste;
|
||||
bool show_zones;
|
||||
bool subtract_mask_from_silk;
|
||||
};
|
||||
|
||||
EDA_3D_VIEWER_SETTINGS();
|
||||
|
||||
virtual ~EDA_3D_VIEWER_SETTINGS() {}
|
||||
|
||||
virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
|
||||
|
||||
RENDER_SETTINGS m_Render;
|
||||
|
||||
protected:
|
||||
|
||||
virtual std::string getLegacyFrameName() const override { return "Viewer3DFrameName"; }
|
||||
};
|
||||
|
||||
|
||||
// Individual color param: not necessary once 3D viewer is migrated to color theme system
|
||||
// TODO(JE) remove once irrelevant
|
||||
class PARAM_COLOR : public PARAM_BASE
|
||||
{
|
||||
public:
|
||||
PARAM_COLOR( const std::string& aJsonPath, COLOR4D* aPtr, COLOR4D aDefault,
|
||||
bool aReadOnly = false ) :
|
||||
PARAM_BASE( aJsonPath, aReadOnly ), m_ptr( aPtr ), m_default( aDefault )
|
||||
{}
|
||||
|
||||
void Load( JSON_SETTINGS* aSettings ) const override
|
||||
{
|
||||
if( m_readOnly )
|
||||
return;
|
||||
|
||||
COLOR4D val = m_default;
|
||||
|
||||
try
|
||||
{
|
||||
val = aSettings->Get<COLOR4D>( m_path );
|
||||
}
|
||||
catch( ... )
|
||||
{}
|
||||
|
||||
*m_ptr = val;
|
||||
}
|
||||
|
||||
void Store( JSON_SETTINGS* aSettings) const override
|
||||
{
|
||||
aSettings->Set<COLOR4D>( m_path, *m_ptr );
|
||||
}
|
||||
|
||||
COLOR4D GetDefault() const
|
||||
{
|
||||
return m_default;
|
||||
}
|
||||
|
||||
virtual void SetDefault() override
|
||||
{
|
||||
*m_ptr = m_default;
|
||||
}
|
||||
|
||||
private:
|
||||
COLOR4D* m_ptr;
|
||||
COLOR4D m_default;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
|
||||
#include "eda_3d_viewer.h"
|
||||
|
||||
#include "3d_viewer_settings.h"
|
||||
|
||||
#include "../3d_viewer_id.h"
|
||||
#include "../common_ogl/cogl_att_list.h"
|
||||
|
@ -35,8 +35,11 @@
|
|||
#include <dpi_scaling.h>
|
||||
#include <gestfich.h>
|
||||
#include <hotkeys_basic.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <tool/common_control.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
@ -56,67 +59,6 @@
|
|||
const wxChar * EDA_3D_VIEWER::m_logTrace = wxT( "KI_TRACE_EDA_3D_VIEWER" );
|
||||
|
||||
|
||||
// Key to store 3D Viewer config
|
||||
|
||||
static const wxChar keyBgColor_Red[] = wxT( "BgColor_Red" );
|
||||
static const wxChar keyBgColor_Green[] = wxT( "BgColor_Green" );
|
||||
static const wxChar keyBgColor_Blue[] = wxT( "BgColor_Blue" );
|
||||
|
||||
static const wxChar keyBgColor_Red_Top[] = wxT( "BgColor_Red_Top" );
|
||||
static const wxChar keyBgColor_Green_Top[] = wxT( "BgColor_Green_Top" );
|
||||
static const wxChar keyBgColor_Blue_Top[] = wxT( "BgColor_Blue_Top" );
|
||||
|
||||
static const wxChar keySMaskColor_Red[] = wxT( "SMaskColor_Red" );
|
||||
static const wxChar keySMaskColor_Green[] = wxT( "SMaskColor_Green" );
|
||||
static const wxChar keySMaskColor_Blue[] = wxT( "SMaskColor_Blue" );
|
||||
|
||||
static const wxChar keySPasteColor_Red[] = wxT( "SPasteColor_Red" );
|
||||
static const wxChar keySPasteColor_Green[] = wxT( "SPasteColor_Green" );
|
||||
static const wxChar keySPasteColor_Blue[] = wxT( "SPasteColor_Blue" );
|
||||
|
||||
static const wxChar keySilkColor_Red[] = wxT( "SilkColor_Red" );
|
||||
static const wxChar keySilkColor_Green[] = wxT( "SilkColor_Green" );
|
||||
static const wxChar keySilkColor_Blue[] = wxT( "SilkColor_Blue" );
|
||||
|
||||
static const wxChar keyCopperColor_Red[] = wxT( "CopperColor_Red" );
|
||||
static const wxChar keyCopperColor_Green[] = wxT( "CopperColor_Green" );
|
||||
static const wxChar keyCopperColor_Blue[] = wxT( "CopperColor_Blue" );
|
||||
|
||||
static const wxChar keyBoardBodyColor_Red[] = wxT( "BoardBodyColor_Red" );
|
||||
static const wxChar keyBoardBodyColor_Green[] = wxT( "BoardBodyColor_Green" );
|
||||
static const wxChar keyBoardBodyColor_Blue[] = wxT( "BoardBodyColor_Blue" );
|
||||
|
||||
static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
|
||||
static const wxChar keySubtractMaskFromSilk[] = wxT( "SubtractMaskFromSilk" );
|
||||
static const wxChar keyRenderEngine[] = wxT( "RenderEngine" );
|
||||
static const wxChar keyRenderMaterial[] = wxT( "Render_Material" );
|
||||
|
||||
static const wxChar keyRenderOGL_ShowCopperTck[]= wxT( "Render_OGL_ShowCopperThickness" );
|
||||
static const wxChar keyRenderOGL_ShowModelBBox[]= wxT( "Render_OGL_ShowModelBoudingBoxes" );
|
||||
|
||||
static const wxChar keyRenderRAY_Shadows[] = wxT( "Render_RAY_Shadows" );
|
||||
static const wxChar keyRenderRAY_Backfloor[] = wxT( "Render_RAY_Backfloor" );
|
||||
static const wxChar keyRenderRAY_Refractions[] = wxT( "Render_RAY_Refractions" );
|
||||
static const wxChar keyRenderRAY_Reflections[] = wxT( "Render_RAY_Reflections" );
|
||||
static const wxChar keyRenderRAY_PostProcess[] = wxT( "Render_RAY_PostProcess" );
|
||||
static const wxChar keyRenderRAY_AAliasing[] = wxT( "Render_RAY_AntiAliasing" );
|
||||
static const wxChar keyRenderRAY_ProceduralT[] = wxT( "Render_RAY_ProceduralTextures" );
|
||||
|
||||
static const wxChar keyShowAxis[] = wxT( "ShowAxis" );
|
||||
static const wxChar keyShowGrid[] = wxT( "ShowGrid3D" );
|
||||
static const wxChar keyShowZones[] = wxT( "ShowZones" );
|
||||
static const wxChar keyShowFootprints_Normal[] = wxT( "ShowFootprints_Normal" );
|
||||
static const wxChar keyShowFootprints_Insert[] = wxT( "ShowFootprints_Insert" );
|
||||
static const wxChar keyShowFootprints_Virtual[] = wxT( "ShowFootprints_Virtual" );
|
||||
static const wxChar keyShowAdhesiveLayers[] = wxT( "ShowAdhesiveLayers" );
|
||||
static const wxChar keyShowSilkScreenLayers[] = wxT( "ShowSilkScreenLayers" );
|
||||
static const wxChar keyShowSolderMaskLayers[] = wxT( "ShowSolderMasLayers" );
|
||||
static const wxChar keyShowSolderPasteLayers[] = wxT( "ShowSolderPasteLayers" );
|
||||
static const wxChar keyShowCommentsLayer[] = wxT( "ShowCommentsLayers" );
|
||||
static const wxChar keyShowBoardBody[] = wxT( "ShowBoardBody" );
|
||||
static const wxChar keyShowEcoLayers[] = wxT( "ShowEcoLayers" );
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME )
|
||||
|
||||
EVT_ACTIVATE( EDA_3D_VIEWER::OnActivate )
|
||||
|
@ -163,7 +105,8 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent,
|
|||
icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
|
||||
SetIcon( icon );
|
||||
|
||||
LoadSettings( config() );
|
||||
auto config = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
|
||||
LoadSettings( config );
|
||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
|
||||
// Create the status line
|
||||
|
@ -265,6 +208,9 @@ void EDA_3D_VIEWER::OnCloseWindow( wxCloseEvent &event )
|
|||
//delete m_canvas;
|
||||
//m_canvas = nullptr;
|
||||
|
||||
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
|
||||
Pgm().GetSettingsManager().SaveColorSettings( colors, "3d_viewer" );
|
||||
|
||||
Destroy();
|
||||
event.Skip( true );
|
||||
}
|
||||
|
@ -553,10 +499,9 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
|||
|
||||
case ID_MENU3D_RESET_DEFAULTS:
|
||||
{
|
||||
// Reload settings with a dummy config, so it will load the defaults
|
||||
wxConfig *fooconfig = new wxConfig( "FooBarApp" );
|
||||
LoadSettings( fooconfig );
|
||||
delete fooconfig;
|
||||
auto cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
|
||||
cfg->ResetToDefaults();
|
||||
LoadSettings( cfg );
|
||||
|
||||
// Tell canvas that we (may have) changed the render engine
|
||||
RenderEngineChanged();
|
||||
|
@ -703,228 +648,152 @@ void EDA_3D_VIEWER::OnSetFocus(wxFocusEvent &event)
|
|||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
|
||||
void EDA_3D_VIEWER::LoadSettings( APP_SETTINGS_BASE *aCfg )
|
||||
{
|
||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||
|
||||
auto cfg = dynamic_cast<EDA_3D_VIEWER_SETTINGS*>( aCfg );
|
||||
wxASSERT( cfg );
|
||||
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::LoadSettings" );
|
||||
|
||||
aCfg->Read( keyBgColor_Red, &m_settings.m_BgColorBot.r, 0.4 );
|
||||
aCfg->Read( keyBgColor_Green, &m_settings.m_BgColorBot.g, 0.4 );
|
||||
aCfg->Read( keyBgColor_Blue, &m_settings.m_BgColorBot.b, 0.5 );
|
||||
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
aCfg->Read( keyBgColor_Red_Top, &m_settings.m_BgColorTop.r, 0.8 );
|
||||
aCfg->Read( keyBgColor_Green_Top, &m_settings.m_BgColorTop.g, 0.8 );
|
||||
aCfg->Read( keyBgColor_Blue_Top, &m_settings.m_BgColorTop.b, 0.9 );
|
||||
auto set_color = [] ( const COLOR4D& aColor, SFVEC3D& aTarget )
|
||||
{
|
||||
aTarget.r = aColor.r;
|
||||
aTarget.g = aColor.g;
|
||||
aTarget.b = aColor.b;
|
||||
};
|
||||
|
||||
// m_SolderMaskColorTop default value = dark grey-green
|
||||
aCfg->Read( keySMaskColor_Red, &m_settings.m_SolderMaskColorTop.r, 100.0 * 0.2 / 255.0 );
|
||||
aCfg->Read( keySMaskColor_Green, &m_settings.m_SolderMaskColorTop.g, 255.0 * 0.2 / 255.0 );
|
||||
aCfg->Read( keySMaskColor_Blue, &m_settings.m_SolderMaskColorTop.b, 180.0 * 0.2 / 255.0 );
|
||||
set_color( colors->GetColor( LAYER_3D_BACKGROUND_BOTTOM ), m_settings.m_BgColorBot );
|
||||
set_color( colors->GetColor( LAYER_3D_BACKGROUND_TOP ), m_settings.m_BgColorTop );
|
||||
set_color( colors->GetColor( LAYER_3D_BOARD ), m_settings.m_BoardBodyColor );
|
||||
set_color( colors->GetColor( LAYER_3D_COPPER ), m_settings.m_CopperColor );
|
||||
set_color( colors->GetColor( LAYER_3D_SILKSCREEN_BOTTOM ), m_settings.m_SilkScreenColorBot );
|
||||
set_color( colors->GetColor( LAYER_3D_SILKSCREEN_TOP ), m_settings.m_SilkScreenColorTop );
|
||||
set_color( colors->GetColor( LAYER_3D_SOLDERMASK ), m_settings.m_SolderMaskColorBot );
|
||||
set_color( colors->GetColor( LAYER_3D_SOLDERMASK ), m_settings.m_SolderMaskColorTop );
|
||||
set_color( colors->GetColor( LAYER_3D_SOLDERPASTE ), m_settings.m_SolderPasteColor );
|
||||
|
||||
// m_SolderMaskColorBot default value = dark grey-green
|
||||
aCfg->Read( keySMaskColor_Red, &m_settings.m_SolderMaskColorBot.r, 100.0 * 0.2 / 255.0 );
|
||||
aCfg->Read( keySMaskColor_Green, &m_settings.m_SolderMaskColorBot.g, 255.0 * 0.2 / 255.0 );
|
||||
aCfg->Read( keySMaskColor_Blue, &m_settings.m_SolderMaskColorBot.b, 180.0 * 0.2 / 255.0 );
|
||||
m_settings.SetFlag( FL_USE_REALISTIC_MODE, cfg->m_Render.realistic );
|
||||
|
||||
// m_SolderPasteColor default value = light grey
|
||||
aCfg->Read( keySPasteColor_Red, &m_settings.m_SolderPasteColor.r, 128.0 / 255.0 );
|
||||
aCfg->Read( keySPasteColor_Green, &m_settings.m_SolderPasteColor.g, 128.0 / 255.0 );
|
||||
aCfg->Read( keySPasteColor_Blue, &m_settings.m_SolderPasteColor.b, 128.0 / 255.0 );
|
||||
|
||||
// m_SilkScreenColorTop default value = white
|
||||
aCfg->Read( keySilkColor_Red, &m_settings.m_SilkScreenColorTop.r, 0.9 );
|
||||
aCfg->Read( keySilkColor_Green, &m_settings.m_SilkScreenColorTop.g, 0.9 );
|
||||
aCfg->Read( keySilkColor_Blue, &m_settings.m_SilkScreenColorTop.b, 0.9 );
|
||||
|
||||
// m_SilkScreenColorBot default value = white
|
||||
aCfg->Read( keySilkColor_Red, &m_settings.m_SilkScreenColorBot.r, 0.9 );
|
||||
aCfg->Read( keySilkColor_Green, &m_settings.m_SilkScreenColorBot.g, 0.9 );
|
||||
aCfg->Read( keySilkColor_Blue, &m_settings.m_SilkScreenColorBot.b, 0.9 );
|
||||
|
||||
// m_CopperColor default value = gold
|
||||
aCfg->Read( keyCopperColor_Red, &m_settings.m_CopperColor.r, 255.0 * 0.7 / 255.0 );
|
||||
aCfg->Read( keyCopperColor_Green, &m_settings.m_CopperColor.g, 223.0 * 0.7 / 255.0 );
|
||||
aCfg->Read( keyCopperColor_Blue, &m_settings.m_CopperColor.b, 0.0 );
|
||||
|
||||
// m_BoardBodyColor default value = FR4, in realistic mode
|
||||
aCfg->Read( keyBoardBodyColor_Red, &m_settings.m_BoardBodyColor.r, 51.0 / 255.0 );
|
||||
aCfg->Read( keyBoardBodyColor_Green, &m_settings.m_BoardBodyColor.g, 43.0 / 255.0 );
|
||||
aCfg->Read( keyBoardBodyColor_Blue, &m_settings.m_BoardBodyColor.b, 22.0 / 255.0 );
|
||||
|
||||
|
||||
bool tmp;
|
||||
aCfg->Read( keyShowRealisticMode, &tmp, true );
|
||||
m_settings.SetFlag( FL_USE_REALISTIC_MODE, tmp );
|
||||
|
||||
aCfg->Read( keySubtractMaskFromSilk, &tmp, false );
|
||||
m_settings.SetFlag( FL_SUBTRACT_MASK_FROM_SILK, tmp );
|
||||
m_settings.SetFlag( FL_SUBTRACT_MASK_FROM_SILK, cfg->m_Render.subtract_mask_from_silk );
|
||||
|
||||
// OpenGL options
|
||||
aCfg->Read( keyRenderOGL_ShowCopperTck, &tmp, true );
|
||||
m_settings.SetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS, tmp );
|
||||
m_settings.SetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS, cfg->m_Render.opengl_copper_thickness );
|
||||
|
||||
aCfg->Read( keyRenderOGL_ShowModelBBox, &tmp, false );
|
||||
m_settings.SetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX, tmp );
|
||||
m_settings.SetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX, cfg->m_Render.opengl_show_model_bbox );
|
||||
|
||||
// Raytracing options
|
||||
aCfg->Read( keyRenderRAY_Shadows, &tmp, true );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_SHADOWS, tmp );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_SHADOWS, cfg->m_Render.raytrace_shadows );
|
||||
|
||||
aCfg->Read( keyRenderRAY_Backfloor, &tmp, false );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_BACKFLOOR, tmp );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_BACKFLOOR, cfg->m_Render.raytrace_backfloor );
|
||||
|
||||
aCfg->Read( keyRenderRAY_Refractions, &tmp, true );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_REFRACTIONS, tmp );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_REFRACTIONS, cfg->m_Render.raytrace_refractions );
|
||||
|
||||
aCfg->Read( keyRenderRAY_Reflections, &tmp, true );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_REFLECTIONS, tmp );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_REFLECTIONS, cfg->m_Render.raytrace_reflections );
|
||||
|
||||
aCfg->Read( keyRenderRAY_PostProcess, &tmp, true );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING, tmp );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING,
|
||||
cfg->m_Render.raytrace_post_processing );
|
||||
|
||||
aCfg->Read( keyRenderRAY_AAliasing, &tmp, true );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING, tmp );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING, cfg->m_Render.raytrace_anti_aliasing );
|
||||
|
||||
aCfg->Read( keyRenderRAY_ProceduralT, &tmp, true );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES, tmp );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES,
|
||||
cfg->m_Render.raytrace_procedural_textures );
|
||||
|
||||
aCfg->Read( keyShowAxis, &tmp, true );
|
||||
m_settings.SetFlag( FL_AXIS, tmp );
|
||||
m_settings.SetFlag( FL_AXIS, cfg->m_Render.show_axis );
|
||||
|
||||
aCfg->Read( keyShowFootprints_Normal, &tmp, true );
|
||||
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL, tmp );
|
||||
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL, cfg->m_Render.show_footprints_normal );
|
||||
|
||||
aCfg->Read( keyShowFootprints_Insert, &tmp, true );
|
||||
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT, tmp );
|
||||
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT, cfg->m_Render.show_footprints_insert );
|
||||
|
||||
aCfg->Read( keyShowFootprints_Virtual, &tmp, true );
|
||||
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL, tmp );
|
||||
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL, cfg->m_Render.show_footprints_virtual );
|
||||
|
||||
aCfg->Read( keyShowZones, &tmp, true );
|
||||
m_settings.SetFlag( FL_ZONE, tmp );
|
||||
m_settings.SetFlag( FL_ZONE, cfg->m_Render.show_zones );
|
||||
|
||||
aCfg->Read( keyShowAdhesiveLayers, &tmp, true );
|
||||
m_settings.SetFlag( FL_ADHESIVE, tmp );
|
||||
m_settings.SetFlag( FL_ADHESIVE, cfg->m_Render.show_adhesive );
|
||||
|
||||
aCfg->Read( keyShowSilkScreenLayers, &tmp, true );
|
||||
m_settings.SetFlag( FL_SILKSCREEN, tmp );
|
||||
m_settings.SetFlag( FL_SILKSCREEN, cfg->m_Render.show_silkscreen );
|
||||
|
||||
aCfg->Read( keyShowSolderMaskLayers, &tmp, true );
|
||||
m_settings.SetFlag( FL_SOLDERMASK, tmp );
|
||||
m_settings.SetFlag( FL_SOLDERMASK, cfg->m_Render.show_soldermask );
|
||||
|
||||
aCfg->Read( keyShowSolderPasteLayers, &tmp, true );
|
||||
m_settings.SetFlag( FL_SOLDERPASTE, tmp );
|
||||
m_settings.SetFlag( FL_SOLDERPASTE, cfg->m_Render.show_solderpaste );
|
||||
|
||||
aCfg->Read( keyShowCommentsLayer, &tmp, true );
|
||||
m_settings.SetFlag( FL_COMMENTS, tmp );
|
||||
m_settings.SetFlag( FL_COMMENTS, cfg->m_Render.show_comments );
|
||||
|
||||
aCfg->Read( keyShowEcoLayers, &tmp, true );
|
||||
m_settings.SetFlag( FL_ECO, tmp );
|
||||
m_settings.SetFlag( FL_ECO, cfg->m_Render.show_eco );
|
||||
|
||||
aCfg->Read( keyShowBoardBody, &tmp, true );
|
||||
m_settings.SetFlag( FL_SHOW_BOARD_BODY, tmp );
|
||||
m_settings.SetFlag( FL_SHOW_BOARD_BODY, cfg->m_Render.show_board_body );
|
||||
|
||||
int tmpi;
|
||||
aCfg->Read( keyShowGrid, &tmpi, static_cast<int>( GRID3D_TYPE::NONE ) );
|
||||
m_settings.GridSet( static_cast<GRID3D_TYPE>( tmpi ) );
|
||||
m_settings.GridSet( static_cast<GRID3D_TYPE>( cfg->m_Render.grid_type ) );
|
||||
|
||||
aCfg->Read( keyRenderEngine, &tmpi, static_cast<int>( RENDER_ENGINE::OPENGL_LEGACY ) );
|
||||
RENDER_ENGINE engine = static_cast<RENDER_ENGINE>( cfg->m_Render.engine );
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::LoadSettings render setting %s",
|
||||
( static_cast<RENDER_ENGINE>( tmpi ) == RENDER_ENGINE::RAYTRACING ) ? "Ray Trace" :
|
||||
"OpenGL" );
|
||||
m_settings.RenderEngineSet( static_cast<RENDER_ENGINE>( tmpi ) );
|
||||
( engine == RENDER_ENGINE::RAYTRACING ) ? "Ray Trace" : "OpenGL" );
|
||||
m_settings.RenderEngineSet( engine );
|
||||
|
||||
aCfg->Read( keyRenderMaterial, &tmpi, static_cast<int>( MATERIAL_MODE::NORMAL ) );
|
||||
m_settings.MaterialModeSet( static_cast<MATERIAL_MODE>( tmpi ) );
|
||||
m_settings.MaterialModeSet( static_cast<MATERIAL_MODE>( cfg->m_Render.material_mode ) );
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::SaveSettings( wxConfigBase *aCfg )
|
||||
void EDA_3D_VIEWER::SaveSettings( APP_SETTINGS_BASE *aCfg )
|
||||
{
|
||||
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||
auto cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
|
||||
|
||||
EDA_BASE_FRAME::SaveSettings( cfg );
|
||||
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::SaveSettings" );
|
||||
|
||||
aCfg->Write( keyBgColor_Red, m_settings.m_BgColorBot.r );
|
||||
aCfg->Write( keyBgColor_Green, m_settings.m_BgColorBot.g );
|
||||
aCfg->Write( keyBgColor_Blue, m_settings.m_BgColorBot.b );
|
||||
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
aCfg->Write( keyBgColor_Red_Top, m_settings.m_BgColorTop.r );
|
||||
aCfg->Write( keyBgColor_Green_Top, m_settings.m_BgColorTop.g );
|
||||
aCfg->Write( keyBgColor_Blue_Top, m_settings.m_BgColorTop.b );
|
||||
auto save_color = [colors] ( SFVEC3D& aSource, LAYER_3D_ID aTarget )
|
||||
{
|
||||
colors->SetColor( aTarget, COLOR4D( aSource.r, aSource.g, aSource.b, 1.0 ) );
|
||||
};
|
||||
|
||||
aCfg->Write( keySMaskColor_Red, m_settings.m_SolderMaskColorTop.r );
|
||||
aCfg->Write( keySMaskColor_Green, m_settings.m_SolderMaskColorTop.g );
|
||||
aCfg->Write( keySMaskColor_Blue, m_settings.m_SolderMaskColorTop.b );
|
||||
save_color( m_settings.m_BgColorBot, LAYER_3D_BACKGROUND_BOTTOM );
|
||||
save_color( m_settings.m_BgColorTop, LAYER_3D_BACKGROUND_TOP );
|
||||
save_color( m_settings.m_BoardBodyColor, LAYER_3D_BOARD );
|
||||
save_color( m_settings.m_CopperColor, LAYER_3D_COPPER );
|
||||
save_color( m_settings.m_SilkScreenColorBot, LAYER_3D_SILKSCREEN_BOTTOM );
|
||||
save_color( m_settings.m_SilkScreenColorTop, LAYER_3D_SILKSCREEN_TOP );
|
||||
save_color( m_settings.m_SolderMaskColorTop, LAYER_3D_SOLDERMASK );
|
||||
save_color( m_settings.m_SolderPasteColor, LAYER_3D_SOLDERPASTE );
|
||||
|
||||
aCfg->Write( keySMaskColor_Red, m_settings.m_SolderMaskColorBot.r );
|
||||
aCfg->Write( keySMaskColor_Green, m_settings.m_SolderMaskColorBot.g );
|
||||
aCfg->Write( keySMaskColor_Blue, m_settings.m_SolderMaskColorBot.b );
|
||||
|
||||
aCfg->Write( keySPasteColor_Red, m_settings.m_SolderPasteColor.r );
|
||||
aCfg->Write( keySPasteColor_Green, m_settings.m_SolderPasteColor.g );
|
||||
aCfg->Write( keySPasteColor_Blue, m_settings.m_SolderPasteColor.b );
|
||||
|
||||
aCfg->Write( keySilkColor_Red, m_settings.m_SilkScreenColorTop.r );
|
||||
aCfg->Write( keySilkColor_Green, m_settings.m_SilkScreenColorTop.g );
|
||||
aCfg->Write( keySilkColor_Blue, m_settings.m_SilkScreenColorTop.b );
|
||||
|
||||
aCfg->Write( keySilkColor_Red, m_settings.m_SilkScreenColorBot.r );
|
||||
aCfg->Write( keySilkColor_Green, m_settings.m_SilkScreenColorBot.g );
|
||||
aCfg->Write( keySilkColor_Blue, m_settings.m_SilkScreenColorBot.b );
|
||||
|
||||
aCfg->Write( keyCopperColor_Red, m_settings.m_CopperColor.r );
|
||||
aCfg->Write( keyCopperColor_Green, m_settings.m_CopperColor.g );
|
||||
aCfg->Write( keyCopperColor_Blue, m_settings.m_CopperColor.b );
|
||||
|
||||
aCfg->Write( keyBoardBodyColor_Red, m_settings.m_BoardBodyColor.r );
|
||||
aCfg->Write( keyBoardBodyColor_Green, m_settings.m_BoardBodyColor.g );
|
||||
aCfg->Write( keyBoardBodyColor_Blue, m_settings.m_BoardBodyColor.b );
|
||||
|
||||
aCfg->Write( keyShowRealisticMode, m_settings.GetFlag( FL_USE_REALISTIC_MODE ) );
|
||||
aCfg->Write( keySubtractMaskFromSilk, m_settings.GetFlag( FL_SUBTRACT_MASK_FROM_SILK ) );
|
||||
|
||||
aCfg->Write( keyRenderEngine, static_cast<int>( m_settings.RenderEngineGet() ) );
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::SaveSettings render setting %s",
|
||||
( m_settings.RenderEngineGet() == RENDER_ENGINE::RAYTRACING ) ? "Ray Trace" :
|
||||
"OpenGL" );
|
||||
|
||||
aCfg->Write( keyRenderMaterial, (int) m_settings.MaterialModeGet() );
|
||||
cfg->m_Render.engine = static_cast<int>( m_settings.RenderEngineGet() );
|
||||
cfg->m_Render.grid_type = static_cast<int>( m_settings.GridGet() );
|
||||
cfg->m_Render.material_mode = static_cast<int>( m_settings.MaterialModeGet() );
|
||||
|
||||
// OpenGL options
|
||||
aCfg->Write( keyRenderOGL_ShowCopperTck,
|
||||
m_settings.GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) );
|
||||
aCfg->Write( keyRenderOGL_ShowModelBBox,
|
||||
m_settings.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX ) );
|
||||
|
||||
// Raytracing options
|
||||
aCfg->Write( keyRenderRAY_Shadows, m_settings.GetFlag( FL_RENDER_RAYTRACING_SHADOWS ) );
|
||||
aCfg->Write( keyRenderRAY_Backfloor, m_settings.GetFlag( FL_RENDER_RAYTRACING_BACKFLOOR ) );
|
||||
aCfg->Write( keyRenderRAY_Refractions, m_settings.GetFlag( FL_RENDER_RAYTRACING_REFRACTIONS ) );
|
||||
aCfg->Write( keyRenderRAY_Reflections, m_settings.GetFlag( FL_RENDER_RAYTRACING_REFLECTIONS ) );
|
||||
aCfg->Write(
|
||||
keyRenderRAY_PostProcess, m_settings.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING ) );
|
||||
aCfg->Write( keyRenderRAY_AAliasing, m_settings.GetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING ) );
|
||||
aCfg->Write( keyRenderRAY_ProceduralT,
|
||||
m_settings.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ) );
|
||||
|
||||
aCfg->Write( keyShowAxis, m_settings.GetFlag( FL_AXIS ) );
|
||||
aCfg->Write( keyShowGrid, (int) m_settings.GridGet() );
|
||||
|
||||
aCfg->Write( keyShowFootprints_Normal, m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL ) );
|
||||
aCfg->Write(
|
||||
keyShowFootprints_Insert, m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT ) );
|
||||
aCfg->Write( keyShowFootprints_Virtual, m_settings.GetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL ) );
|
||||
|
||||
aCfg->Write( keyShowZones, m_settings.GetFlag( FL_ZONE ) );
|
||||
aCfg->Write( keyShowAdhesiveLayers, m_settings.GetFlag( FL_ADHESIVE ) );
|
||||
aCfg->Write( keyShowSilkScreenLayers, m_settings.GetFlag( FL_SILKSCREEN ) );
|
||||
aCfg->Write( keyShowSolderMaskLayers, m_settings.GetFlag( FL_SOLDERMASK ) );
|
||||
aCfg->Write( keyShowSolderPasteLayers, m_settings.GetFlag( FL_SOLDERPASTE ) );
|
||||
aCfg->Write( keyShowCommentsLayer, m_settings.GetFlag( FL_COMMENTS ) );
|
||||
aCfg->Write( keyShowEcoLayers, m_settings.GetFlag( FL_ECO ) );
|
||||
aCfg->Write( keyShowBoardBody, m_settings.GetFlag( FL_SHOW_BOARD_BODY ) );
|
||||
cfg->m_Render.opengl_copper_thickness = m_settings.GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS );
|
||||
cfg->m_Render.opengl_show_model_bbox = m_settings.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX );
|
||||
cfg->m_Render.raytrace_anti_aliasing = m_settings.GetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING );
|
||||
cfg->m_Render.raytrace_backfloor = m_settings.GetFlag( FL_RENDER_RAYTRACING_BACKFLOOR );
|
||||
cfg->m_Render.raytrace_post_processing =
|
||||
m_settings.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING );
|
||||
cfg->m_Render.raytrace_procedural_textures =
|
||||
m_settings.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES );
|
||||
cfg->m_Render.raytrace_reflections = m_settings.GetFlag( FL_RENDER_RAYTRACING_REFLECTIONS );
|
||||
cfg->m_Render.raytrace_refractions = m_settings.GetFlag( FL_RENDER_RAYTRACING_REFRACTIONS );
|
||||
cfg->m_Render.raytrace_shadows = m_settings.GetFlag( FL_RENDER_RAYTRACING_SHADOWS );
|
||||
cfg->m_Render.realistic = m_settings.GetFlag( FL_USE_REALISTIC_MODE );
|
||||
cfg->m_Render.show_adhesive = m_settings.GetFlag( FL_ADHESIVE );
|
||||
cfg->m_Render.show_axis = m_settings.GetFlag( FL_AXIS );
|
||||
cfg->m_Render.show_board_body = m_settings.GetFlag( FL_SHOW_BOARD_BODY );
|
||||
cfg->m_Render.show_comments = m_settings.GetFlag( FL_COMMENTS );
|
||||
cfg->m_Render.show_eco = m_settings.GetFlag( FL_ECO );
|
||||
cfg->m_Render.show_footprints_insert = m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT );
|
||||
cfg->m_Render.show_footprints_normal = m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL );
|
||||
cfg->m_Render.show_footprints_virtual = m_settings.GetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL );
|
||||
cfg->m_Render.show_silkscreen = m_settings.GetFlag( FL_SILKSCREEN );
|
||||
cfg->m_Render.show_soldermask = m_settings.GetFlag( FL_SOLDERMASK );
|
||||
cfg->m_Render.show_solderpaste = m_settings.GetFlag( FL_SOLDERPASTE );
|
||||
cfg->m_Render.show_zones = m_settings.GetFlag( FL_ZONE );
|
||||
cfg->m_Render.subtract_mask_from_silk = m_settings.GetFlag( FL_SUBTRACT_MASK_FROM_SILK );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1269,16 +1138,9 @@ void EDA_3D_VIEWER::loadCommonSettings()
|
|||
{
|
||||
wxCHECK_RET( m_canvas, "Cannot load settings to null canvas" );
|
||||
|
||||
wxConfigBase& cmnCfg = *Pgm().CommonSettings();
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
|
||||
{
|
||||
const DPI_SCALING dpi{ &cmnCfg, this };
|
||||
const DPI_SCALING dpi{ settings, this };
|
||||
m_canvas->SetScaleFactor( dpi.GetScaleFactor() );
|
||||
}
|
||||
|
||||
{
|
||||
bool option;
|
||||
cmnCfg.Read( ENBL_MOUSEWHEEL_PAN_KEY, &option, false );
|
||||
m_settings.SetFlag( FL_MOUSEWHEEL_PANNING, option );
|
||||
}
|
||||
m_settings.SetFlag( FL_MOUSEWHEEL_PANNING, settings->m_Input.mousewheel_pan );
|
||||
}
|
||||
|
|
|
@ -194,9 +194,9 @@ private:
|
|||
*/
|
||||
void ReCreateMainToolbar();
|
||||
|
||||
void SaveSettings( wxConfigBase *aCfg ) override;
|
||||
void SaveSettings( APP_SETTINGS_BASE *aCfg ) override;
|
||||
|
||||
void LoadSettings( wxConfigBase *aCfg ) override;
|
||||
void LoadSettings( APP_SETTINGS_BASE *aCfg ) override;
|
||||
|
||||
void OnKeyEvent( wxKeyEvent& event );
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ set(3D-VIEWER_SRCS
|
|||
3d_viewer/dialogs/dialog_3D_view_option.cpp
|
||||
3d_viewer/dialogs/dialog_3D_view_option_base.cpp
|
||||
3d_viewer/eda_3d_viewer.cpp
|
||||
3d_viewer/3d_viewer_settings.cpp
|
||||
common_ogl/cogl_att_list.cpp
|
||||
common_ogl/ogl_utils.cpp
|
||||
3d_fastmath.cpp
|
||||
|
@ -111,4 +112,8 @@ target_link_libraries( 3d-viewer
|
|||
${OPENGL_LIBRARIES}
|
||||
kicad_3dsg )
|
||||
|
||||
target_include_directories( 3d-viewer PRIVATE
|
||||
$<TARGET_PROPERTY:nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
|
||||
add_subdirectory( 3d_cache )
|
||||
|
|
|
@ -12,6 +12,7 @@ set( BITMAP2COMPONENT_SRCS
|
|||
${CMAKE_SOURCE_DIR}/common/single_top.cpp
|
||||
|
||||
bitmap2cmp_main.cpp
|
||||
bitmap2cmp_settings.cpp
|
||||
bitmap2component.cpp
|
||||
bitmap2cmp_gui_base.cpp
|
||||
bitmap2cmp_gui.cpp
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "bitmap2cmp_gui.h"
|
||||
#include "bitmap2component.h"
|
||||
#include <bitmap2cmp_settings.h>
|
||||
#include <bitmap_io.h>
|
||||
#include <bitmaps.h>
|
||||
#include <kiface_i.h>
|
||||
|
@ -38,18 +39,6 @@
|
|||
#include "bitmap2cmp_gui_base.h"
|
||||
|
||||
|
||||
#define KEYWORD_FRAME_POSX wxT( "Bmconverter_Pos_x" )
|
||||
#define KEYWORD_FRAME_POSY wxT( "Bmconverter_Pos_y" )
|
||||
#define KEYWORD_FRAME_SIZEX wxT( "Bmconverter_Size_x" )
|
||||
#define KEYWORD_FRAME_SIZEY wxT( "Bmconverter_Size_y" )
|
||||
#define KEYWORD_LAST_INPUT_FILE wxT( "Last_input" )
|
||||
#define KEYWORD_LAST_OUTPUT_FILE wxT( "Last_output" )
|
||||
#define KEYWORD_LAST_FORMAT wxT( "Last_format" )
|
||||
#define KEYWORD_LAST_MODLAYER wxT( "Last_modlayer" )
|
||||
#define KEYWORD_BINARY_THRESHOLD wxT( "Threshold" )
|
||||
#define KEYWORD_BW_NEGATIVE wxT( "Negative_choice" )
|
||||
#define KEYWORD_UNIT_SELECTION wxT( "Unit_selection" )
|
||||
|
||||
#define DEFAULT_DPI 300 // the image DPI used in formats that do not define a DPI
|
||||
|
||||
IMAGE_SIZE::IMAGE_SIZE()
|
||||
|
@ -161,7 +150,6 @@ BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
BM2CMP_FRAME_BASE( aParent )
|
||||
{
|
||||
SetKiway( this, aKiway );
|
||||
m_config = GetNewConfig( Pgm().App().GetAppName() );
|
||||
|
||||
wxString unitList[] =
|
||||
{
|
||||
|
@ -171,7 +159,7 @@ BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
for( int ii = 0; ii < 3; ii++ )
|
||||
m_PixelUnit->Append( unitList[ii] );
|
||||
|
||||
LoadSettings( m_config.get() );
|
||||
LoadSettings( config() );
|
||||
|
||||
m_outputSizeX.SetUnit( getUnitFromSelection() );
|
||||
m_outputSizeY.SetUnit( getUnitFromSelection() );
|
||||
|
@ -193,20 +181,19 @@ BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
|
||||
|
||||
m_buttonExportFile->Enable( false );
|
||||
m_buttonExportClipboard->Enable( false );
|
||||
|
||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
|
||||
if ( m_framePos == wxDefaultPosition )
|
||||
if ( m_FramePos == wxDefaultPosition )
|
||||
Centre();
|
||||
}
|
||||
|
||||
|
||||
BM2CMP_FRAME::~BM2CMP_FRAME()
|
||||
{
|
||||
SaveSettings( m_config.get() );
|
||||
SaveSettings( config() );
|
||||
/*
|
||||
* This needed for OSX: avoids further OnDraw processing after this
|
||||
* destructor and before the native window is destroyed
|
||||
|
@ -215,79 +202,63 @@ BM2CMP_FRAME::~BM2CMP_FRAME()
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||
void BM2CMP_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
int tmp;
|
||||
aCfg->Read( KEYWORD_FRAME_POSX, & m_framePos.x, -1 );
|
||||
aCfg->Read( KEYWORD_FRAME_POSY, & m_framePos.y, -1 );
|
||||
aCfg->Read( KEYWORD_FRAME_SIZEX, & m_frameSize.x, -1 );
|
||||
aCfg->Read( KEYWORD_FRAME_SIZEY, & m_frameSize.y, -1 );
|
||||
aCfg->Read( KEYWORD_LAST_INPUT_FILE, &m_BitmapFileName );
|
||||
aCfg->Read( KEYWORD_LAST_OUTPUT_FILE, &m_ConvertedFileName );
|
||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||
|
||||
int u_select = 0;
|
||||
aCfg->Read( KEYWORD_UNIT_SELECTION, &u_select, 0 );
|
||||
auto cfg = static_cast<BITMAP2CMP_SETTINGS*>( aCfg );
|
||||
|
||||
m_BitmapFileName = cfg->m_BitmapFileName;
|
||||
m_ConvertedFileName = cfg->m_ConvertedFileName;
|
||||
|
||||
int u_select = cfg->m_Units;
|
||||
|
||||
if( u_select < 0 || u_select > 2 ) // Validity control
|
||||
u_select = 0;
|
||||
|
||||
m_PixelUnit->SetSelection( u_select );
|
||||
|
||||
if( aCfg->Read( KEYWORD_BINARY_THRESHOLD, &tmp ) )
|
||||
m_sliderThreshold->SetValue( tmp );
|
||||
m_sliderThreshold->SetValue( cfg->m_Threshold );
|
||||
|
||||
aCfg->Read( KEYWORD_BW_NEGATIVE, &tmp, 0 );
|
||||
m_Negative = tmp != 0;
|
||||
m_checkNegative->SetValue( m_Negative );
|
||||
m_Negative = cfg->m_Negative;
|
||||
m_checkNegative->SetValue( cfg->m_Negative );
|
||||
m_exportToClipboard = false;
|
||||
m_AspectRatioLocked = false;
|
||||
|
||||
if( aCfg->Read( KEYWORD_LAST_FORMAT, &tmp ) )
|
||||
{
|
||||
if( tmp < 0 || tmp > FINAL_FMT )
|
||||
tmp = PCBNEW_KICAD_MOD;
|
||||
int format = cfg->m_LastFormat;
|
||||
|
||||
m_rbOutputFormat->SetSelection( tmp );
|
||||
}
|
||||
if( format < 0 || format > FINAL_FMT )
|
||||
format = PCBNEW_KICAD_MOD;
|
||||
|
||||
if( tmp == PCBNEW_KICAD_MOD )
|
||||
m_rbOutputFormat->SetSelection( format );
|
||||
|
||||
if( format == PCBNEW_KICAD_MOD )
|
||||
m_rbPCBLayer->Enable( true );
|
||||
else
|
||||
m_rbPCBLayer->Enable( false );
|
||||
|
||||
if( aCfg->Read( KEYWORD_LAST_MODLAYER, &tmp ) )
|
||||
{
|
||||
if( (unsigned) tmp > MOD_LYR_FINAL ) // Out of range
|
||||
int last_layer = cfg->m_LastModLayer;
|
||||
|
||||
if( last_layer > static_cast<int>( MOD_LYR_FINAL ) ) // Out of range
|
||||
m_rbPCBLayer->SetSelection( MOD_LYR_FSILKS );
|
||||
else
|
||||
m_rbPCBLayer->SetSelection( tmp );
|
||||
}
|
||||
m_rbPCBLayer->SetSelection( last_layer );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::SaveSettings( wxConfigBase* aCfg )
|
||||
void BM2CMP_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
if( !aCfg )
|
||||
return;
|
||||
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||
|
||||
m_frameSize = GetSize();
|
||||
m_framePos = GetPosition();
|
||||
auto cfg = static_cast<BITMAP2CMP_SETTINGS*>( aCfg );
|
||||
|
||||
if( !IsIconized() )
|
||||
{
|
||||
aCfg->Write( KEYWORD_FRAME_POSX, (long) m_framePos.x );
|
||||
aCfg->Write( KEYWORD_FRAME_POSY, (long) m_framePos.y );
|
||||
aCfg->Write( KEYWORD_FRAME_SIZEX, (long) m_frameSize.x );
|
||||
aCfg->Write( KEYWORD_FRAME_SIZEY, (long) m_frameSize.y );
|
||||
}
|
||||
|
||||
aCfg->Write( KEYWORD_LAST_INPUT_FILE, m_BitmapFileName );
|
||||
aCfg->Write( KEYWORD_LAST_OUTPUT_FILE, m_ConvertedFileName );
|
||||
aCfg->Write( KEYWORD_BINARY_THRESHOLD, m_sliderThreshold->GetValue() );
|
||||
aCfg->Write( KEYWORD_BW_NEGATIVE, m_checkNegative->IsChecked() ? 1 : 0 );
|
||||
aCfg->Write( KEYWORD_LAST_FORMAT, m_rbOutputFormat->GetSelection() );
|
||||
aCfg->Write( KEYWORD_LAST_MODLAYER, m_rbPCBLayer->GetSelection() );
|
||||
aCfg->Write( KEYWORD_UNIT_SELECTION, m_PixelUnit->GetSelection() );
|
||||
cfg->m_BitmapFileName = m_BitmapFileName;
|
||||
cfg->m_ConvertedFileName = m_ConvertedFileName;
|
||||
cfg->m_Threshold = m_sliderThreshold->GetValue();
|
||||
cfg->m_Negative = m_checkNegative->IsChecked();
|
||||
cfg->m_LastFormat = m_rbOutputFormat->GetSelection();
|
||||
cfg->m_LastModLayer = m_rbPCBLayer->GetSelection();
|
||||
cfg->m_Units = m_PixelUnit->GetSelection();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -152,8 +152,8 @@ private:
|
|||
void OnFormatChange( wxCommandEvent& event ) override;
|
||||
void exportBitmap( OUTPUT_FMT_ID aFormat );
|
||||
|
||||
void LoadSettings( wxConfigBase* aCfg ) override;
|
||||
void SaveSettings( wxConfigBase* aCfg ) override;
|
||||
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
|
||||
private:
|
||||
wxImage m_Pict_Image;
|
||||
|
@ -167,9 +167,6 @@ private:
|
|||
bool m_Negative;
|
||||
wxString m_BitmapFileName;
|
||||
wxString m_ConvertedFileName;
|
||||
wxSize m_frameSize;
|
||||
wxPoint m_framePos;
|
||||
std::unique_ptr<wxConfigBase> m_config;
|
||||
bool m_exportToClipboard;
|
||||
bool m_AspectRatioLocked;
|
||||
double m_AspectRatio;
|
||||
|
|
|
@ -22,10 +22,12 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "bitmap2cmp_gui.h"
|
||||
#include <bitmap2cmp_gui.h>
|
||||
#include <bitmap2cmp_settings.h>
|
||||
#include <kiface_i.h>
|
||||
#include <kiway.h>
|
||||
#include <pgm_base.h>
|
||||
#include <settings/settings_manager.h>
|
||||
|
||||
|
||||
//-----<KIFACE>-----------------------------------------------------------------
|
||||
|
@ -38,6 +40,8 @@ static struct IFACE : public KIFACE_I
|
|||
|
||||
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) override
|
||||
{
|
||||
InitSettings( new BITMAP2CMP_SETTINGS );
|
||||
Pgm().GetSettingsManager().RegisterSettings( KifaceSettings() );
|
||||
return new BM2CMP_FRAME( aKiway, aParent );
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||