All the preferences, all the time.

Fixes https://gitlab.com/kicad/code/kicad/issues/7877

Fixes https://gitlab.com/kicad/code/kicad/issues/5153
This commit is contained in:
Jeff Young 2021-08-30 00:33:08 +01:00
parent f1410f0240
commit d28714167c
138 changed files with 2155 additions and 2488 deletions

View File

@ -28,7 +28,6 @@
#include <wx/wupdlock.h>
#include <wx/clipbrd.h>
#include <wx/filedlg.h>
#include <wx/treebook.h>
#include "eda_3d_viewer_frame.h"
#include <eda_3d_viewer_settings.h>
#include <3d_viewer_id.h>
@ -49,12 +48,6 @@
#include <tool/tool_dispatcher.h>
#include <tool/action_toolbar.h>
#include <widgets/infobar.h>
#include <widgets/paged_dialog.h>
#include <dialogs/panel_3D_display_options.h>
#include <dialogs/panel_3D_opengl_options.h>
#include <dialogs/panel_3D_raytracing_options.h>
#include <dialogs/panel_3D_colors.h>
#include <panel_hotkeys_editor.h>
#include <wildcards_and_files_ext.h>
/**
@ -228,21 +221,6 @@ void EDA_3D_VIEWER_FRAME::setupUIConditions()
}
void EDA_3D_VIEWER_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
{
wxTreebook* book = aParent->GetTreebook();
book->AddPage( new wxPanel( book ), _( "3D Viewer" ) );
book->AddSubPage( new PANEL_3D_DISPLAY_OPTIONS( this, book ), _( "General" ) );
book->AddSubPage( new PANEL_3D_OPENGL_OPTIONS( this, book ), _( "Realtime Renderer" ) );
book->AddSubPage( new PANEL_3D_RAYTRACING_OPTIONS( this, book ), _( "Raytracing Renderer" ) );
book->AddSubPage( new PANEL_3D_COLORS( this, book ), _( "Colors" ) );
aHotkeysPanel->AddHotKeys( GetToolManager() );
}
void EDA_3D_VIEWER_FRAME::ReloadRequest()
{
// This will schedule a request to load later
@ -632,6 +610,7 @@ void EDA_3D_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTex
ReCreateMainToolbar();
loadCommonSettings();
LoadSettings( Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>() );
NewDisplay( true );
}

View File

@ -73,8 +73,6 @@ public:
wxWindow* GetToolCanvas() const override { return m_canvas; }
void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
/**
* Request reloading the 3D view.
*

View File

@ -27,31 +27,30 @@
#include <pgm_base.h>
PANEL_3D_COLORS::PANEL_3D_COLORS( EDA_3D_VIEWER_FRAME* aFrame, wxWindow* aParent ) :
PANEL_3D_COLORS_BASE( aParent ),
m_boardAdapter( aFrame->GetAdapter() )
PANEL_3D_COLORS::PANEL_3D_COLORS( wxWindow* aParent ) :
PANEL_3D_COLORS_BASE( aParent )
{
m_backgroundTop->SetDefaultColor( m_boardAdapter.g_DefaultBackgroundTop );
m_backgroundBottom->SetDefaultColor( m_boardAdapter.g_DefaultBackgroundBot );
m_backgroundTop->SetDefaultColor( BOARD_ADAPTER::g_DefaultBackgroundTop );
m_backgroundBottom->SetDefaultColor( BOARD_ADAPTER::g_DefaultBackgroundBot );
m_silkscreenTop->SetUserColors( &m_boardAdapter.g_SilkscreenColors );
m_silkscreenTop->SetDefaultColor( m_boardAdapter.g_DefaultSilkscreen );
m_silkscreenBottom->SetUserColors( &m_boardAdapter.g_SilkscreenColors );
m_silkscreenBottom->SetDefaultColor( m_boardAdapter.g_DefaultSilkscreen );
m_silkscreenTop->SetUserColors( &BOARD_ADAPTER::g_SilkscreenColors );
m_silkscreenTop->SetDefaultColor( BOARD_ADAPTER::g_DefaultSilkscreen );
m_silkscreenBottom->SetUserColors( &BOARD_ADAPTER::g_SilkscreenColors );
m_silkscreenBottom->SetDefaultColor( BOARD_ADAPTER::g_DefaultSilkscreen );
m_solderMaskTop->SetUserColors( &m_boardAdapter.g_MaskColors );
m_solderMaskTop->SetDefaultColor( m_boardAdapter.g_DefaultSolderMask );
m_solderMaskBottom->SetUserColors( &m_boardAdapter.g_MaskColors );
m_solderMaskBottom->SetDefaultColor( m_boardAdapter.g_DefaultSolderMask );
m_solderMaskTop->SetUserColors( &BOARD_ADAPTER::g_MaskColors );
m_solderMaskTop->SetDefaultColor( BOARD_ADAPTER::g_DefaultSolderMask );
m_solderMaskBottom->SetUserColors( &BOARD_ADAPTER::g_MaskColors );
m_solderMaskBottom->SetDefaultColor( BOARD_ADAPTER::g_DefaultSolderMask );
m_solderPaste->SetUserColors( &m_boardAdapter.g_PasteColors );
m_solderPaste->SetDefaultColor( m_boardAdapter.g_DefaultSolderPaste );
m_solderPaste->SetUserColors( &BOARD_ADAPTER::g_PasteColors );
m_solderPaste->SetDefaultColor( BOARD_ADAPTER::g_DefaultSolderPaste );
m_surfaceFinish->SetUserColors( &m_boardAdapter.g_FinishColors );
m_surfaceFinish->SetDefaultColor( m_boardAdapter.g_DefaultSurfaceFinish );
m_surfaceFinish->SetUserColors( &BOARD_ADAPTER::g_FinishColors );
m_surfaceFinish->SetDefaultColor( BOARD_ADAPTER::g_DefaultSurfaceFinish );
m_boardBody->SetUserColors( &m_boardAdapter.g_BoardColors );
m_boardBody->SetDefaultColor( m_boardAdapter.g_DefaultBoardBody );
m_boardBody->SetUserColors( &BOARD_ADAPTER::g_BoardColors );
m_boardBody->SetDefaultColor( BOARD_ADAPTER::g_DefaultBoardBody );
}

View File

@ -30,16 +30,13 @@
class PANEL_3D_COLORS : public PANEL_3D_COLORS_BASE
{
public:
explicit PANEL_3D_COLORS( EDA_3D_VIEWER_FRAME* aFrame, wxWindow* aParent );
explicit PANEL_3D_COLORS( wxWindow* aParent );
/// Automatically called when clicking on the OK button
bool TransferDataFromWindow() override;
/// Automatically called after creating the dialog
bool TransferDataToWindow() override;
private:
BOARD_ADAPTER& m_boardAdapter;
};

View File

@ -22,18 +22,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <eda_3d_viewer_settings.h>
#include "panel_3D_display_options.h"
#include <3d_canvas/board_adapter.h>
#include <3d_viewer/eda_3d_viewer_frame.h>
#include <3d_viewer/tools/eda_3d_controller.h>
#include <tool/tool_manager.h>
PANEL_3D_DISPLAY_OPTIONS::PANEL_3D_DISPLAY_OPTIONS( EDA_3D_VIEWER_FRAME* aFrame, wxWindow* aParent ) :
PANEL_3D_DISPLAY_OPTIONS_BASE( aParent ),
m_frame( aFrame ),
m_settings( aFrame->GetAdapter() ),
m_canvas( aFrame->GetCanvas() )
PANEL_3D_DISPLAY_OPTIONS::PANEL_3D_DISPLAY_OPTIONS( wxWindow* aParent ) :
PANEL_3D_DISPLAY_OPTIONS_BASE( aParent )
{
}
@ -47,38 +43,30 @@ void PANEL_3D_DISPLAY_OPTIONS::OnCheckEnableAnimation( wxCommandEvent& event )
bool PANEL_3D_DISPLAY_OPTIONS::TransferDataToWindow()
{
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
// Check/uncheck checkboxes
m_checkBoxRealisticMode->SetValue( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) );
m_checkBoxBoardBody->SetValue( m_settings.GetFlag( FL_SHOW_BOARD_BODY ) );
m_checkBoxAreas->SetValue( m_settings.GetFlag( FL_ZONE ) );
m_checkBoxRealisticMode->SetValue( cfg->m_Render.realistic );
m_checkBoxBoardBody->SetValue( cfg->m_Render.show_board_body );
m_checkBoxAreas->SetValue( cfg->m_Render.show_zones );
m_checkBoxSilkscreen->SetValue( cfg->m_Render.show_silkscreen );
m_checkBoxSolderMask->SetValue( cfg->m_Render.show_soldermask );
m_checkBoxSolderpaste->SetValue( cfg->m_Render.show_solderpaste );
m_checkBoxAdhesive->SetValue( cfg->m_Render.show_adhesive );
m_checkBoxComments->SetValue( cfg->m_Render.show_comments );
m_checkBoxECO->SetValue( cfg->m_Render.show_eco );
m_checkBoxSubtractMaskFromSilk->SetValue( cfg->m_Render.subtract_mask_from_silk );
m_checkBoxClipSilkOnViaAnnulus->SetValue( cfg->m_Render.clip_silk_on_via_annulus );
m_checkBoxRenderPlatedPadsAsPlated->SetValue( cfg->m_Render.renderPlatedPadsAsPlated );
m_checkBoxSilkscreen->SetValue( m_settings.GetFlag( FL_SILKSCREEN ) );
m_checkBoxSolderMask->SetValue( m_settings.GetFlag( FL_SOLDERMASK ) );
m_checkBoxSolderpaste->SetValue( m_settings.GetFlag( FL_SOLDERPASTE ) );
m_checkBoxAdhesive->SetValue( m_settings.GetFlag( FL_ADHESIVE ) );
m_checkBoxComments->SetValue( m_settings.GetFlag( FL_COMMENTS ) );
m_checkBoxECO->SetValue( m_settings.GetFlag( FL_ECO ) );
m_checkBoxSubtractMaskFromSilk->SetValue( m_settings.GetFlag( FL_SUBTRACT_MASK_FROM_SILK ) );
m_checkBoxClipSilkOnViaAnnulus->SetValue( m_settings.GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) );
m_checkBoxRenderPlatedPadsAsPlated->SetValue(
m_settings.GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) );
switch( m_settings.GetMaterialMode() )
{
default:
case MATERIAL_MODE::NORMAL: m_materialProperties->SetSelection( 0 ); break;
case MATERIAL_MODE::DIFFUSE_ONLY: m_materialProperties->SetSelection( 1 ); break;
case MATERIAL_MODE::CAD_MODE: m_materialProperties->SetSelection( 2 ); break;
}
m_materialProperties->SetSelection( cfg->m_Render.material_mode );
// Camera Options
m_checkBoxEnableAnimation->SetValue( m_canvas->GetAnimationEnabled() );
m_sliderAnimationSpeed->SetValue( m_canvas->GetMovingSpeedMultiplier() );
m_staticAnimationSpeed->Enable( m_canvas->GetAnimationEnabled() );
m_sliderAnimationSpeed->Enable( m_canvas->GetAnimationEnabled() );
EDA_3D_CONTROLLER* ctrlTool = m_frame->GetToolManager()->GetTool<EDA_3D_CONTROLLER>();
m_spinCtrlRotationAngle->SetValue( ctrlTool->GetRotationIncrement() );
m_checkBoxEnableAnimation->SetValue( cfg->m_Camera.animation_enabled );
m_sliderAnimationSpeed->SetValue( cfg->m_Camera.moving_speed_multiplier );
m_staticAnimationSpeed->Enable( cfg->m_Camera.animation_enabled );
m_sliderAnimationSpeed->Enable( cfg->m_Camera.animation_enabled );
m_spinCtrlRotationAngle->SetValue( cfg->m_Camera.rotation_increment );
return true;
}
@ -86,41 +74,32 @@ bool PANEL_3D_DISPLAY_OPTIONS::TransferDataToWindow()
bool PANEL_3D_DISPLAY_OPTIONS::TransferDataFromWindow()
{
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
// Set render mode
m_settings.SetFlag( FL_USE_REALISTIC_MODE, m_checkBoxRealisticMode->GetValue() );
cfg->m_Render.realistic = m_checkBoxRealisticMode->GetValue();
// Set visibility of items
m_settings.SetFlag( FL_SHOW_BOARD_BODY, m_checkBoxBoardBody->GetValue() );
m_settings.SetFlag( FL_ZONE, m_checkBoxAreas->GetValue() );
m_settings.SetFlag( FL_SUBTRACT_MASK_FROM_SILK, m_checkBoxSubtractMaskFromSilk->GetValue() );
m_settings.SetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS, m_checkBoxClipSilkOnViaAnnulus->GetValue() );
m_settings.SetFlag( FL_RENDER_PLATED_PADS_AS_PLATED,
m_checkBoxRenderPlatedPadsAsPlated->GetValue() );
cfg->m_Render.show_board_body = m_checkBoxBoardBody->GetValue();
cfg->m_Render.show_zones = m_checkBoxAreas->GetValue();
cfg->m_Render.subtract_mask_from_silk = m_checkBoxSubtractMaskFromSilk->GetValue();
cfg->m_Render.clip_silk_on_via_annulus = m_checkBoxClipSilkOnViaAnnulus->GetValue();
cfg->m_Render.renderPlatedPadsAsPlated = m_checkBoxRenderPlatedPadsAsPlated->GetValue();
switch( m_materialProperties->GetSelection() )
{
default:
case 0: m_settings.SetMaterialMode( MATERIAL_MODE::NORMAL ); break;
case 1: m_settings.SetMaterialMode( MATERIAL_MODE::DIFFUSE_ONLY ); break;
case 2: m_settings.SetMaterialMode( MATERIAL_MODE::CAD_MODE ); break;
}
cfg->m_Render.material_mode = m_materialProperties->GetSelection();
// Set Layer visibility
m_settings.SetFlag( FL_SILKSCREEN, m_checkBoxSilkscreen->GetValue() );
m_settings.SetFlag( FL_SOLDERMASK, m_checkBoxSolderMask->GetValue() );
m_settings.SetFlag( FL_SOLDERPASTE, m_checkBoxSolderpaste->GetValue() );
m_settings.SetFlag( FL_ADHESIVE, m_checkBoxAdhesive->GetValue() );
m_settings.SetFlag( FL_COMMENTS, m_checkBoxComments->GetValue() );
m_settings.SetFlag( FL_ECO, m_checkBoxECO->GetValue( ) );
cfg->m_Render.show_silkscreen = m_checkBoxSilkscreen->GetValue();
cfg->m_Render.show_soldermask = m_checkBoxSolderMask->GetValue();
cfg->m_Render.show_solderpaste = m_checkBoxSolderpaste->GetValue();
cfg->m_Render.show_adhesive = m_checkBoxAdhesive->GetValue();
cfg->m_Render.show_comments = m_checkBoxComments->GetValue();
cfg->m_Render.show_eco = m_checkBoxECO->GetValue( );
// Camera Options
m_canvas->SetAnimationEnabled( m_checkBoxEnableAnimation->GetValue());
m_canvas->SetMovingSpeedMultiplier( m_sliderAnimationSpeed->GetValue());
EDA_3D_CONTROLLER* ctrlTool = m_frame->GetToolManager()->GetTool<EDA_3D_CONTROLLER>();
ctrlTool->SetRotationIncrement( m_spinCtrlRotationAngle->GetValue() );
// The 3D scene will be rebuilt by the caller
cfg->m_Camera.animation_enabled = m_checkBoxEnableAnimation->GetValue();
cfg->m_Camera.moving_speed_multiplier = m_sliderAnimationSpeed->GetValue();
cfg->m_Camera.rotation_increment = m_spinCtrlRotationAngle->GetValue();
return true;
}

View File

@ -32,7 +32,7 @@
class PANEL_3D_DISPLAY_OPTIONS : public PANEL_3D_DISPLAY_OPTIONS_BASE
{
public:
explicit PANEL_3D_DISPLAY_OPTIONS( EDA_3D_VIEWER_FRAME* aFrame, wxWindow* aParent );
explicit PANEL_3D_DISPLAY_OPTIONS( wxWindow* aParent );
void OnCheckEnableAnimation( wxCommandEvent& WXUNUSED( event ) ) override;
@ -41,13 +41,6 @@ public:
/// Automatically called after creating the dialog
bool TransferDataToWindow() override;
void TransferColorDataToWindow();
private:
EDA_3D_VIEWER_FRAME* m_frame;
BOARD_ADAPTER& m_settings;
EDA_3D_CANVAS* m_canvas;
};

View File

@ -22,16 +22,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "panel_3D_opengl_options.h"
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <eda_3d_viewer_settings.h>
#include <widgets/color_swatch.h>
#include <3d_canvas/board_adapter.h>
#include <3d_viewer/eda_3d_viewer_frame.h>
#include <3d_viewer/tools/eda_3d_controller.h>
#include "panel_3D_opengl_options.h"
PANEL_3D_OPENGL_OPTIONS::PANEL_3D_OPENGL_OPTIONS( EDA_3D_VIEWER_FRAME* aFrame, wxWindow* aParent ) :
PANEL_3D_OPENGL_OPTIONS_BASE( aParent ),
m_settings( aFrame->GetAdapter() ),
m_canvas( aFrame->GetCanvas() )
PANEL_3D_OPENGL_OPTIONS::PANEL_3D_OPENGL_OPTIONS( wxWindow* aParent ) :
PANEL_3D_OPENGL_OPTIONS_BASE( aParent )
{
m_selectionColorSwatch->SetDefaultColor( COLOR4D( 0.0, 1.0, 0.0, 1.0 ) );
m_selectionColorSwatch->SetSupportsOpacity( false );
@ -40,25 +39,19 @@ PANEL_3D_OPENGL_OPTIONS::PANEL_3D_OPENGL_OPTIONS( EDA_3D_VIEWER_FRAME* aFrame, w
bool PANEL_3D_OPENGL_OPTIONS::TransferDataToWindow()
{
m_checkBoxCuThickness->SetValue( m_settings.GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) );
m_checkBoxBoundingBoxes->SetValue( m_settings.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX ) );
m_checkBoxHighlightOnRollOver->SetValue( m_settings.GetFlag( FL_HIGHLIGHT_ROLLOVER_ITEM ) );
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
m_choiceAntiAliasing->SetSelection( static_cast<int>( m_settings.GetAntiAliasingMode() ) );
m_selectionColorSwatch->SetSwatchColor( COLOR4D( m_settings.m_OpenGlSelectionColor.r,
m_settings.m_OpenGlSelectionColor.g,
m_settings.m_OpenGlSelectionColor.b,
1.0 ),
false );
m_checkBoxCuThickness->SetValue( cfg->m_Render.opengl_copper_thickness );
m_checkBoxBoundingBoxes->SetValue( cfg->m_Render.opengl_show_model_bbox );
m_checkBoxHighlightOnRollOver->SetValue( cfg->m_Render.opengl_highlight_on_rollover );
m_checkBoxDisableAAMove->SetValue(
m_settings.GetFlag( FL_RENDER_OPENGL_AA_DISABLE_ON_MOVE ) );
m_checkBoxDisableMoveThickness->SetValue(
m_settings.GetFlag( FL_RENDER_OPENGL_THICKNESS_DISABLE_ON_MOVE ) );
m_checkBoxDisableMoveVias->SetValue(
m_settings.GetFlag( FL_RENDER_OPENGL_VIAS_DISABLE_ON_MOVE ) );
m_checkBoxDisableMoveHoles->SetValue(
m_settings.GetFlag( FL_RENDER_OPENGL_HOLES_DISABLE_ON_MOVE ) );
m_choiceAntiAliasing->SetSelection( cfg->m_Render.opengl_AA_mode );
m_selectionColorSwatch->SetSwatchColor( cfg->m_Render.opengl_selection_color, false );
m_checkBoxDisableAAMove->SetValue( cfg->m_Render.opengl_AA_disableOnMove );
m_checkBoxDisableMoveThickness->SetValue( cfg->m_Render.opengl_thickness_disableOnMove );
m_checkBoxDisableMoveVias->SetValue( cfg->m_Render.opengl_vias_disableOnMove );
m_checkBoxDisableMoveHoles->SetValue( cfg->m_Render.opengl_holes_disableOnMove );
return true;
}
@ -66,24 +59,19 @@ bool PANEL_3D_OPENGL_OPTIONS::TransferDataToWindow()
bool PANEL_3D_OPENGL_OPTIONS::TransferDataFromWindow()
{
m_settings.SetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS, m_checkBoxCuThickness->GetValue() );
m_settings.SetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX, m_checkBoxBoundingBoxes->GetValue() );
m_settings.SetFlag( FL_HIGHLIGHT_ROLLOVER_ITEM, m_checkBoxHighlightOnRollOver->GetValue() );
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
m_settings.SetAntiAliasingMode(
static_cast<ANTIALIASING_MODE>( m_choiceAntiAliasing->GetSelection() ) );
m_settings.m_OpenGlSelectionColor = SFVEC3F( m_selectionColorSwatch->GetSwatchColor().r,
m_selectionColorSwatch->GetSwatchColor().g,
m_selectionColorSwatch->GetSwatchColor().b );
cfg->m_Render.opengl_copper_thickness = m_checkBoxCuThickness->GetValue();
cfg->m_Render.opengl_show_model_bbox = m_checkBoxBoundingBoxes->GetValue();
cfg->m_Render.opengl_highlight_on_rollover = m_checkBoxHighlightOnRollOver->GetValue();
m_settings.SetFlag( FL_RENDER_OPENGL_AA_DISABLE_ON_MOVE,
m_checkBoxDisableAAMove->GetValue() );
m_settings.SetFlag( FL_RENDER_OPENGL_THICKNESS_DISABLE_ON_MOVE,
m_checkBoxDisableMoveThickness->GetValue() );
m_settings.SetFlag( FL_RENDER_OPENGL_VIAS_DISABLE_ON_MOVE,
m_checkBoxDisableMoveVias->GetValue() );
m_settings.SetFlag( FL_RENDER_OPENGL_HOLES_DISABLE_ON_MOVE,
m_checkBoxDisableMoveHoles->GetValue() );
cfg->m_Render.opengl_AA_mode = m_choiceAntiAliasing->GetSelection();
cfg->m_Render.opengl_selection_color = m_selectionColorSwatch->GetSwatchColor();
cfg->m_Render.opengl_AA_disableOnMove = m_checkBoxDisableAAMove->GetValue();
cfg->m_Render.opengl_thickness_disableOnMove = m_checkBoxDisableMoveThickness->GetValue();
cfg->m_Render.opengl_vias_disableOnMove = m_checkBoxDisableMoveVias->GetValue();
cfg->m_Render.opengl_holes_disableOnMove = m_checkBoxDisableMoveHoles->GetValue();
return true;
}

View File

@ -31,17 +31,13 @@
class PANEL_3D_OPENGL_OPTIONS : public PANEL_3D_OPENGL_OPTIONS_BASE
{
public:
explicit PANEL_3D_OPENGL_OPTIONS( EDA_3D_VIEWER_FRAME* aFrame, wxWindow* aParent );
explicit PANEL_3D_OPENGL_OPTIONS( wxWindow* aParent );
/// Automatically called when clicking on the OK button
bool TransferDataFromWindow() override;
/// Automatically called after creating the dialog
bool TransferDataToWindow() override;
private:
BOARD_ADAPTER& m_settings;
EDA_3D_CANVAS* m_canvas;
};

View File

@ -22,28 +22,26 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <eda_3d_viewer_settings.h>
#include "panel_3D_raytracing_options.h"
#include <3d_canvas/board_adapter.h>
#include <3d_viewer/eda_3d_viewer_frame.h>
#include <3d_viewer/tools/eda_3d_controller.h>
#include <bitmaps.h>
#include <tool/tool_manager.h>
PANEL_3D_RAYTRACING_OPTIONS::PANEL_3D_RAYTRACING_OPTIONS( EDA_3D_VIEWER_FRAME* aFrame,
wxWindow* aParent ) :
PANEL_3D_RAYTRACING_OPTIONS_BASE( aParent ),
m_settings( aFrame->GetAdapter() ),
m_canvas( aFrame->GetCanvas() )
PANEL_3D_RAYTRACING_OPTIONS::PANEL_3D_RAYTRACING_OPTIONS( wxWindow* aParent ) :
PANEL_3D_RAYTRACING_OPTIONS_BASE( aParent )
{
}
void PANEL_3D_RAYTRACING_OPTIONS::ResetPanel()
{
m_settings.m_RtCameraLightColor = SFVEC3F( 0.2f );
m_settings.m_RtLightColorTop = SFVEC3F( 0.247f );
m_settings.m_RtLightColorBottom = SFVEC3F( 0.247f );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
cfg->m_Render.raytrace_lightColorCamera = COLOR4D( 0.2, 0.2, 0.2, 1.0 );
cfg->m_Render.raytrace_lightColorTop = COLOR4D( 0.247, 0.247, 0.247, 1.0 );
cfg->m_Render.raytrace_lightColorBottom = COLOR4D( 0.247, 0.247, 0.247, 1.0 );
const std::vector<int> default_elevation =
{
@ -55,14 +53,10 @@ void PANEL_3D_RAYTRACING_OPTIONS::ResetPanel()
45, 135, 225, 315, 45, 135, 225, 315,
};
for( size_t i = 0; i < m_settings.m_RtLightSphericalCoords.size(); ++i )
for( size_t i = 0; i < 8; ++i )
{
m_settings.m_RtLightColor[i] = SFVEC3F( 0.168f );
m_settings.m_RtLightSphericalCoords[i].x =
( (float) default_elevation[i] + 90.0f ) / 180.0f;
m_settings.m_RtLightSphericalCoords[i].y = (float) default_azimuth[i] / 180.0f;
cfg->m_Render.raytrace_lightElevation[i] = default_elevation[i];
cfg->m_Render.raytrace_lightAzimuth[i] = default_azimuth[i];
}
TransferColorDataToWindow();
@ -71,91 +65,83 @@ void PANEL_3D_RAYTRACING_OPTIONS::ResetPanel()
void PANEL_3D_RAYTRACING_OPTIONS::TransferColorDataToWindow()
{
auto transfer_color = [] ( const SFVEC3F& aSource, COLOR_SWATCH *aTarget )
{
aTarget->SetSupportsOpacity( false );
aTarget->SetDefaultColor( KIGFX::COLOR4D( 0.5, 0.5, 0.5, 1.0 ) );
aTarget->SetSwatchColor( COLOR4D( aSource.r, aSource.g, aSource.b, 1.0 ), false );
};
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
transfer_color( m_settings.m_RtCameraLightColor, m_colourPickerCameraLight );
transfer_color( m_settings.m_RtLightColorTop, m_colourPickerTopLight );
transfer_color( m_settings.m_RtLightColorBottom, m_colourPickerBottomLight );
auto transfer_color =
[]( COLOR4D aColor, COLOR_SWATCH *aTarget )
{
aTarget->SetSupportsOpacity( false );
aTarget->SetDefaultColor( KIGFX::COLOR4D( 0.5, 0.5, 0.5, 1.0 ) );
aTarget->SetSwatchColor( aColor, false );
};
transfer_color( m_settings.m_RtLightColor[0], m_colourPickerLight1 );
transfer_color( m_settings.m_RtLightColor[1], m_colourPickerLight2 );
transfer_color( m_settings.m_RtLightColor[2], m_colourPickerLight3 );
transfer_color( m_settings.m_RtLightColor[3], m_colourPickerLight4 );
auto transfer_value =
[]( wxTextCtrl* aCtrl, int aValue )
{
aCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, aValue ) );
};
transfer_color( m_settings.m_RtLightColor[4], m_colourPickerLight5 );
transfer_color( m_settings.m_RtLightColor[5], m_colourPickerLight6 );
transfer_color( m_settings.m_RtLightColor[6], m_colourPickerLight7 );
transfer_color( m_settings.m_RtLightColor[7], m_colourPickerLight8 );
transfer_color( cfg->m_Render.raytrace_lightColorCamera, m_colourPickerCameraLight );
transfer_color( cfg->m_Render.raytrace_lightColorTop, m_colourPickerTopLight );
transfer_color( cfg->m_Render.raytrace_lightColorBottom, m_colourPickerBottomLight );
m_spinCtrlLightElevation1->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[0].x * 180.0f - 90.0f ) );
m_spinCtrlLightElevation2->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[1].x * 180.0f - 90.0f ) );
m_spinCtrlLightElevation3->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[2].x * 180.0f - 90.0f ) );
m_spinCtrlLightElevation4->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[3].x * 180.0f - 90.0f ) );
m_spinCtrlLightElevation5->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[4].x * 180.0f - 90.0f ) );
m_spinCtrlLightElevation6->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[5].x * 180.0f - 90.0f ) );
m_spinCtrlLightElevation7->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[6].x * 180.0f - 90.0f ) );
m_spinCtrlLightElevation8->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[7].x * 180.0f - 90.0f ) );
transfer_color( cfg->m_Render.raytrace_lightColor[0], m_colourPickerLight1 );
transfer_color( cfg->m_Render.raytrace_lightColor[1], m_colourPickerLight2 );
transfer_color( cfg->m_Render.raytrace_lightColor[2], m_colourPickerLight3 );
transfer_color( cfg->m_Render.raytrace_lightColor[3], m_colourPickerLight4 );
m_spinCtrlLightAzimuth1->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[0].y * 180.0f ) );
m_spinCtrlLightAzimuth2->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[1].y * 180.0f ) );
m_spinCtrlLightAzimuth3->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[2].y * 180.0f ) );
m_spinCtrlLightAzimuth4->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[3].y * 180.0f ) );
m_spinCtrlLightAzimuth5->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[4].y * 180.0f ) );
m_spinCtrlLightAzimuth6->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[5].y * 180.0f ) );
m_spinCtrlLightAzimuth7->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[6].y * 180.0f ) );
m_spinCtrlLightAzimuth8->SetValue(
(int)( m_settings.m_RtLightSphericalCoords[7].y * 180.0f ) );
transfer_color( cfg->m_Render.raytrace_lightColor[4], m_colourPickerLight5 );
transfer_color( cfg->m_Render.raytrace_lightColor[5], m_colourPickerLight6 );
transfer_color( cfg->m_Render.raytrace_lightColor[6], m_colourPickerLight7 );
transfer_color( cfg->m_Render.raytrace_lightColor[7], m_colourPickerLight8 );
transfer_value( m_lightElevation1, cfg->m_Render.raytrace_lightElevation[0] );
transfer_value( m_lightElevation2, cfg->m_Render.raytrace_lightElevation[1] );
transfer_value( m_lightElevation3, cfg->m_Render.raytrace_lightElevation[2] );
transfer_value( m_lightElevation4, cfg->m_Render.raytrace_lightElevation[3] );
transfer_value( m_lightElevation5, cfg->m_Render.raytrace_lightElevation[4] );
transfer_value( m_lightElevation6, cfg->m_Render.raytrace_lightElevation[5] );
transfer_value( m_lightElevation7, cfg->m_Render.raytrace_lightElevation[6] );
transfer_value( m_lightElevation8, cfg->m_Render.raytrace_lightElevation[7] );
transfer_value( m_lightAzimuth1, cfg->m_Render.raytrace_lightAzimuth[0] );
transfer_value( m_lightAzimuth2, cfg->m_Render.raytrace_lightAzimuth[1] );
transfer_value( m_lightAzimuth3, cfg->m_Render.raytrace_lightAzimuth[2] );
transfer_value( m_lightAzimuth4, cfg->m_Render.raytrace_lightAzimuth[3] );
transfer_value( m_lightAzimuth5, cfg->m_Render.raytrace_lightAzimuth[4] );
transfer_value( m_lightAzimuth6, cfg->m_Render.raytrace_lightAzimuth[5] );
transfer_value( m_lightAzimuth7, cfg->m_Render.raytrace_lightAzimuth[6] );
transfer_value( m_lightAzimuth8, cfg->m_Render.raytrace_lightAzimuth[7] );
}
bool PANEL_3D_RAYTRACING_OPTIONS::TransferDataToWindow()
{
m_checkBoxRaytracing_renderShadows->SetValue(
m_settings.GetFlag( FL_RENDER_RAYTRACING_SHADOWS ) );
m_checkBoxRaytracing_addFloor->SetValue( m_settings.GetFlag( FL_RENDER_RAYTRACING_BACKFLOOR ) );
m_checkBoxRaytracing_showRefractions->SetValue(
m_settings.GetFlag( FL_RENDER_RAYTRACING_REFRACTIONS ) );
m_checkBoxRaytracing_showReflections->SetValue(
m_settings.GetFlag( FL_RENDER_RAYTRACING_REFLECTIONS ) );
m_checkBoxRaytracing_postProcessing->SetValue(
m_settings.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING ) );
m_checkBoxRaytracing_antiAliasing->SetValue(
m_settings.GetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING ) );
m_checkBoxRaytracing_proceduralTextures->SetValue(
m_settings.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ) );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
m_spinCtrl_NrSamples_Shadows->SetValue( m_settings.m_RtShadowSampleCount );
m_spinCtrl_NrSamples_Reflections->SetValue( m_settings.m_RtReflectionSampleCount );
m_spinCtrl_NrSamples_Refractions->SetValue( m_settings.m_RtRefractionSampleCount );
m_cbRaytracing_renderShadows->SetValue( cfg->m_Render.raytrace_shadows );
m_cbRaytracing_addFloor->SetValue( cfg->m_Render.raytrace_backfloor );
m_cbRaytracing_showRefractions->SetValue( cfg->m_Render.raytrace_refractions );
m_cbRaytracing_showReflections->SetValue( cfg->m_Render.raytrace_reflections );
m_cbRaytracing_postProcessing->SetValue( cfg->m_Render.raytrace_post_processing );
m_cbRaytracing_antiAliasing->SetValue( cfg->m_Render.raytrace_anti_aliasing );
m_cbRaytracing_proceduralTextures->SetValue( cfg->m_Render.raytrace_procedural_textures );
m_spinCtrlDouble_SpreadFactor_Shadows->SetValue( m_settings.m_RtSpreadShadows * 100.0f );
m_spinCtrlDouble_SpreadFactor_Reflections->SetValue(
m_settings.m_RtSpreadReflections * 100.0f );
m_spinCtrlDouble_SpreadFactor_Refractions->SetValue(
m_settings.m_RtSpreadRefractions * 100.0f );
m_numSamples_Shadows->SetValue( cfg->m_Render.raytrace_nrsamples_shadows );
m_numSamples_Reflections->SetValue( cfg->m_Render.raytrace_nrsamples_reflections );
m_numSamples_Refractions->SetValue( cfg->m_Render.raytrace_nrsamples_refractions );
m_spinCtrlRecursiveLevel_Reflections->SetValue( m_settings.m_RtRecursiveReflectionCount );
m_spinCtrlRecursiveLevel_Refractions->SetValue( m_settings.m_RtRecursiveRefractionCount );
m_spreadFactor_Shadows->SetValue( StringFromValue( EDA_UNITS::PERCENT,
cfg->m_Render.raytrace_spread_shadows * 100.0f ) );
m_spreadFactor_Reflections->SetValue( StringFromValue( EDA_UNITS::PERCENT,
cfg->m_Render.raytrace_spread_reflections * 100.0f ) );
m_spreadFactor_Refractions->SetValue( StringFromValue( EDA_UNITS::PERCENT,
cfg->m_Render.raytrace_spread_refractions * 100.0f ) );
m_recursiveLevel_Reflections->SetValue( cfg->m_Render.raytrace_recursivelevel_reflections );
m_recursiveLevel_Refractions->SetValue( cfg->m_Render.raytrace_recursivelevel_refractions );
TransferColorDataToWindow();
@ -165,89 +151,67 @@ bool PANEL_3D_RAYTRACING_OPTIONS::TransferDataToWindow()
bool PANEL_3D_RAYTRACING_OPTIONS::TransferDataFromWindow()
{
m_settings.SetFlag( FL_RENDER_RAYTRACING_SHADOWS,
m_checkBoxRaytracing_renderShadows->GetValue() );
m_settings.SetFlag( FL_RENDER_RAYTRACING_BACKFLOOR,
m_checkBoxRaytracing_addFloor->GetValue() );
m_settings.SetFlag( FL_RENDER_RAYTRACING_REFRACTIONS,
m_checkBoxRaytracing_showRefractions->GetValue() );
m_settings.SetFlag( FL_RENDER_RAYTRACING_REFLECTIONS,
m_checkBoxRaytracing_showReflections->GetValue() );
m_settings.SetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING,
m_checkBoxRaytracing_postProcessing->GetValue() );
m_settings.SetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING,
m_checkBoxRaytracing_antiAliasing->GetValue() );
m_settings.SetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES,
m_checkBoxRaytracing_proceduralTextures->GetValue() );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
m_settings.m_RtShadowSampleCount = m_spinCtrl_NrSamples_Shadows->GetValue();
m_settings.m_RtReflectionSampleCount = m_spinCtrl_NrSamples_Reflections->GetValue();
m_settings.m_RtRefractionSampleCount= m_spinCtrl_NrSamples_Refractions->GetValue();
cfg->m_Render.raytrace_shadows = m_cbRaytracing_renderShadows->GetValue();
cfg->m_Render.raytrace_backfloor = m_cbRaytracing_addFloor->GetValue();
cfg->m_Render.raytrace_refractions = m_cbRaytracing_showRefractions->GetValue();
cfg->m_Render.raytrace_reflections = m_cbRaytracing_showReflections->GetValue();
cfg->m_Render.raytrace_post_processing = m_cbRaytracing_postProcessing->GetValue();
cfg->m_Render.raytrace_anti_aliasing = m_cbRaytracing_antiAliasing->GetValue();
cfg->m_Render.raytrace_procedural_textures = m_cbRaytracing_proceduralTextures->GetValue();
m_settings.m_RtSpreadShadows =
static_cast<float>( m_spinCtrlDouble_SpreadFactor_Shadows->GetValue() ) / 100.0f;
m_settings.m_RtSpreadReflections =
static_cast<float>( m_spinCtrlDouble_SpreadFactor_Reflections->GetValue() ) / 100.0f;
m_settings.m_RtSpreadRefractions =
static_cast<float>( m_spinCtrlDouble_SpreadFactor_Refractions->GetValue() ) / 100.0f;
cfg->m_Render.raytrace_nrsamples_shadows = m_numSamples_Shadows->GetValue();
cfg->m_Render.raytrace_nrsamples_reflections = m_numSamples_Reflections->GetValue();
cfg->m_Render.raytrace_nrsamples_refractions = m_numSamples_Refractions->GetValue();
m_settings.m_RtRecursiveReflectionCount = m_spinCtrlRecursiveLevel_Reflections->GetValue();
m_settings.m_RtRecursiveRefractionCount = m_spinCtrlRecursiveLevel_Refractions->GetValue();
cfg->m_Render.raytrace_spread_shadows =
DoubleValueFromString( EDA_UNITS::PERCENT, m_spreadFactor_Shadows->GetValue() ) / 100.0f;
cfg->m_Render.raytrace_spread_reflections =
DoubleValueFromString( EDA_UNITS::PERCENT, m_spreadFactor_Reflections->GetValue() ) / 100.0f;
cfg->m_Render.raytrace_spread_refractions =
DoubleValueFromString( EDA_UNITS::PERCENT, m_spreadFactor_Refractions->GetValue() ) / 100.0f;
auto transfer_color = [] ( SFVEC3F& aTarget, COLOR_SWATCH *aSource )
{
const COLOR4D color = aSource->GetSwatchColor();
cfg->m_Render.raytrace_recursivelevel_reflections = m_recursiveLevel_Reflections->GetValue();
cfg->m_Render.raytrace_recursivelevel_refractions = m_recursiveLevel_Refractions->GetValue();
aTarget = SFVEC3F( color.r, color.g, color.b );
};
cfg->m_Render.raytrace_lightColorCamera = m_colourPickerCameraLight->GetSwatchColor();
cfg->m_Render.raytrace_lightColorTop = m_colourPickerTopLight->GetSwatchColor();
cfg->m_Render.raytrace_lightColorBottom = m_colourPickerBottomLight->GetSwatchColor();
transfer_color( m_settings.m_RtCameraLightColor, m_colourPickerCameraLight );
transfer_color( m_settings.m_RtLightColorTop, m_colourPickerTopLight );
transfer_color( m_settings.m_RtLightColorBottom, m_colourPickerBottomLight );
cfg->m_Render.raytrace_lightColor[0] = m_colourPickerLight1->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[1] = m_colourPickerLight2->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[2] = m_colourPickerLight3->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[3] = m_colourPickerLight4->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[4] = m_colourPickerLight5->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[5] = m_colourPickerLight6->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[6] = m_colourPickerLight7->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[7] = m_colourPickerLight8->GetSwatchColor();
transfer_color( m_settings.m_RtLightColor[0], m_colourPickerLight1 );
transfer_color( m_settings.m_RtLightColor[1], m_colourPickerLight2 );
transfer_color( m_settings.m_RtLightColor[2], m_colourPickerLight3 );
transfer_color( m_settings.m_RtLightColor[3], m_colourPickerLight4 );
transfer_color( m_settings.m_RtLightColor[4], m_colourPickerLight5 );
transfer_color( m_settings.m_RtLightColor[5], m_colourPickerLight6 );
transfer_color( m_settings.m_RtLightColor[6], m_colourPickerLight7 );
transfer_color( m_settings.m_RtLightColor[7], m_colourPickerLight8 );
auto get_value =
[]( wxTextCtrl* aCtrl )
{
return DoubleValueFromString( EDA_UNITS::UNSCALED, aCtrl->GetValue() );
};
m_settings.m_RtLightSphericalCoords[0].x =
( m_spinCtrlLightElevation1->GetValue() + 90.0f ) / 180.0f;
m_settings.m_RtLightSphericalCoords[1].x =
( m_spinCtrlLightElevation2->GetValue() + 90.0f ) / 180.0f;
m_settings.m_RtLightSphericalCoords[2].x =
( m_spinCtrlLightElevation3->GetValue() + 90.0f ) / 180.0f;
m_settings.m_RtLightSphericalCoords[3].x =
( m_spinCtrlLightElevation4->GetValue() + 90.0f ) / 180.0f;
m_settings.m_RtLightSphericalCoords[4].x =
( m_spinCtrlLightElevation5->GetValue() + 90.0f ) / 180.0f;
m_settings.m_RtLightSphericalCoords[5].x =
( m_spinCtrlLightElevation6->GetValue() + 90.0f ) / 180.0f;
m_settings.m_RtLightSphericalCoords[6].x =
( m_spinCtrlLightElevation7->GetValue() + 90.0f ) / 180.0f;
m_settings.m_RtLightSphericalCoords[7].x =
( m_spinCtrlLightElevation8->GetValue() + 90.0f ) / 180.0f;
cfg->m_Render.raytrace_lightElevation[0] = get_value( m_lightElevation1 );
cfg->m_Render.raytrace_lightElevation[1] = get_value( m_lightElevation2 );
cfg->m_Render.raytrace_lightElevation[2] = get_value( m_lightElevation3 );
cfg->m_Render.raytrace_lightElevation[3] = get_value( m_lightElevation4 );
cfg->m_Render.raytrace_lightElevation[4] = get_value( m_lightElevation5 );
cfg->m_Render.raytrace_lightElevation[5] = get_value( m_lightElevation6 );
cfg->m_Render.raytrace_lightElevation[6] = get_value( m_lightElevation7 );
cfg->m_Render.raytrace_lightElevation[7] = get_value( m_lightElevation8 );
m_settings.m_RtLightSphericalCoords[0].y = m_spinCtrlLightAzimuth1->GetValue() / 180.0f;
m_settings.m_RtLightSphericalCoords[1].y = m_spinCtrlLightAzimuth2->GetValue() / 180.0f;
m_settings.m_RtLightSphericalCoords[2].y = m_spinCtrlLightAzimuth3->GetValue() / 180.0f;
m_settings.m_RtLightSphericalCoords[3].y = m_spinCtrlLightAzimuth4->GetValue() / 180.0f;
m_settings.m_RtLightSphericalCoords[4].y = m_spinCtrlLightAzimuth5->GetValue() / 180.0f;
m_settings.m_RtLightSphericalCoords[5].y = m_spinCtrlLightAzimuth6->GetValue() / 180.0f;
m_settings.m_RtLightSphericalCoords[6].y = m_spinCtrlLightAzimuth7->GetValue() / 180.0f;
m_settings.m_RtLightSphericalCoords[7].y = m_spinCtrlLightAzimuth8->GetValue() / 180.0f;
for( size_t i = 0; i < m_settings.m_RtLightSphericalCoords.size(); ++i )
{
m_settings.m_RtLightSphericalCoords[i].x =
glm::clamp( m_settings.m_RtLightSphericalCoords[i].x, 0.0f, 1.0f );
m_settings.m_RtLightSphericalCoords[i].y =
glm::clamp( m_settings.m_RtLightSphericalCoords[i].y, 0.0f, 2.0f );
}
cfg->m_Render.raytrace_lightAzimuth[0] = get_value( m_lightAzimuth1 );
cfg->m_Render.raytrace_lightAzimuth[1] = get_value( m_lightAzimuth2 );
cfg->m_Render.raytrace_lightAzimuth[2] = get_value( m_lightAzimuth3 );
cfg->m_Render.raytrace_lightAzimuth[3] = get_value( m_lightAzimuth4 );
cfg->m_Render.raytrace_lightAzimuth[4] = get_value( m_lightAzimuth5 );
cfg->m_Render.raytrace_lightAzimuth[5] = get_value( m_lightAzimuth6 );
cfg->m_Render.raytrace_lightAzimuth[6] = get_value( m_lightAzimuth7 );
cfg->m_Render.raytrace_lightAzimuth[7] = get_value( m_lightAzimuth8 );
return true;
}

View File

@ -31,7 +31,7 @@
class PANEL_3D_RAYTRACING_OPTIONS : public PANEL_3D_RAYTRACING_OPTIONS_BASE
{
public:
explicit PANEL_3D_RAYTRACING_OPTIONS( EDA_3D_VIEWER_FRAME* aFrame, wxWindow* aParent );
explicit PANEL_3D_RAYTRACING_OPTIONS( wxWindow* aParent );
void ResetPanel() override;
@ -42,10 +42,6 @@ public:
bool TransferDataToWindow() override;
void TransferColorDataToWindow();
private:
BOARD_ADAPTER& m_settings;
EDA_3D_CANVAS* m_canvas;
};

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.9.0 Aug 10 2021)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -24,21 +24,21 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
wxGridSizer* gSizer1;
gSizer1 = new wxGridSizer( 0, 1, 0, 20 );
m_checkBoxRaytracing_proceduralTextures = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Procedural textures (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRaytracing_proceduralTextures->SetValue(true);
gSizer1->Add( m_checkBoxRaytracing_proceduralTextures, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbRaytracing_proceduralTextures = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Procedural textures (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbRaytracing_proceduralTextures->SetValue(true);
gSizer1->Add( m_cbRaytracing_proceduralTextures, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkBoxRaytracing_addFloor = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Add floor (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRaytracing_addFloor->SetValue(true);
gSizer1->Add( m_checkBoxRaytracing_addFloor, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbRaytracing_addFloor = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Add floor (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbRaytracing_addFloor->SetValue(true);
gSizer1->Add( m_cbRaytracing_addFloor, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkBoxRaytracing_antiAliasing = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Anti-aliasing (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRaytracing_antiAliasing->SetValue(true);
gSizer1->Add( m_checkBoxRaytracing_antiAliasing, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbRaytracing_antiAliasing = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Anti-aliasing (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbRaytracing_antiAliasing->SetValue(true);
gSizer1->Add( m_cbRaytracing_antiAliasing, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkBoxRaytracing_postProcessing = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Screen space ambient occlusions and global illumination reflections (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRaytracing_postProcessing->SetValue(true);
gSizer1->Add( m_checkBoxRaytracing_postProcessing, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbRaytracing_postProcessing = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Screen space ambient occlusions and global illumination reflections (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbRaytracing_postProcessing->SetValue(true);
gSizer1->Add( m_cbRaytracing_postProcessing, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbSizerRaytracingRenderOptions->Add( gSizer1, 1, wxEXPAND|wxBOTTOM, 5 );
@ -63,63 +63,54 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
m_staticText211->Wrap( -1 );
fgSizer111->Add( m_staticText211, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxRaytracing_renderShadows = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Shadows:"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRaytracing_renderShadows->SetValue(true);
fgSizer111->Add( m_checkBoxRaytracing_renderShadows, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_cbRaytracing_renderShadows = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Shadows:"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbRaytracing_renderShadows->SetValue(true);
fgSizer111->Add( m_cbRaytracing_renderShadows, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_spinCtrl_NrSamples_Shadows = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 64, 0 );
m_spinCtrl_NrSamples_Shadows->SetToolTip( _("Number of rays that will be cast, into light direction, to evaluate a shadow point") );
m_numSamples_Shadows = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 64, 0 );
m_numSamples_Shadows->SetToolTip( _("Number of rays that will be cast, into light direction, to evaluate a shadow point") );
fgSizer111->Add( m_spinCtrl_NrSamples_Shadows, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
fgSizer111->Add( m_numSamples_Shadows, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_spinCtrlDouble_SpreadFactor_Shadows = new wxSpinCtrlDouble( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 0.1, 25, 0, 1 );
m_spinCtrlDouble_SpreadFactor_Shadows->SetDigits( 1 );
m_spinCtrlDouble_SpreadFactor_Shadows->SetToolTip( _("Random direction factor of the cast rays") );
fgSizer111->Add( m_spinCtrlDouble_SpreadFactor_Shadows, 0, wxRIGHT|wxLEFT, 5 );
m_spreadFactor_Shadows = new wxTextCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer111->Add( m_spreadFactor_Shadows, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
fgSizer111->Add( 0, 0, 1, wxEXPAND, 5 );
m_checkBoxRaytracing_showReflections = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Reflections:"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRaytracing_showReflections->SetValue(true);
fgSizer111->Add( m_checkBoxRaytracing_showReflections, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_cbRaytracing_showReflections = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Reflections:"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbRaytracing_showReflections->SetValue(true);
fgSizer111->Add( m_cbRaytracing_showReflections, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_spinCtrl_NrSamples_Reflections = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 32, 0 );
m_spinCtrl_NrSamples_Reflections->SetToolTip( _("Number of rays that will be cast to evaluate a reflection point") );
m_numSamples_Reflections = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 32, 0 );
m_numSamples_Reflections->SetToolTip( _("Number of rays that will be cast to evaluate a reflection point") );
fgSizer111->Add( m_spinCtrl_NrSamples_Reflections, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
fgSizer111->Add( m_numSamples_Reflections, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_spinCtrlDouble_SpreadFactor_Reflections = new wxSpinCtrlDouble( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 0.1, 25, 0, 1 );
m_spinCtrlDouble_SpreadFactor_Reflections->SetDigits( 1 );
m_spinCtrlDouble_SpreadFactor_Reflections->SetToolTip( _("Random direction factor of the cast rays") );
m_spreadFactor_Reflections = new wxTextCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer111->Add( m_spreadFactor_Reflections, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fgSizer111->Add( m_spinCtrlDouble_SpreadFactor_Reflections, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_recursiveLevel_Reflections = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 5, 0 );
m_recursiveLevel_Reflections->SetToolTip( _("Interactions number that a ray can travel through objects. (higher number of levels improve results, specially on very transparent boards)") );
m_spinCtrlRecursiveLevel_Reflections = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 5, 0 );
m_spinCtrlRecursiveLevel_Reflections->SetToolTip( _("Interactions number that a ray can travel through objects. (higher number of levels improve results, specially on very transparent boards)") );
fgSizer111->Add( m_recursiveLevel_Reflections, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
fgSizer111->Add( m_spinCtrlRecursiveLevel_Reflections, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_cbRaytracing_showRefractions = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Refractions:"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbRaytracing_showRefractions->SetValue(true);
fgSizer111->Add( m_cbRaytracing_showRefractions, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_checkBoxRaytracing_showRefractions = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Refractions:"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRaytracing_showRefractions->SetValue(true);
fgSizer111->Add( m_checkBoxRaytracing_showRefractions, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_numSamples_Refractions = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 5, 0 );
m_numSamples_Refractions->SetToolTip( _("Number of rays that will be cast to evaluate a refraction point") );
m_spinCtrl_NrSamples_Refractions = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 5, 0 );
m_spinCtrl_NrSamples_Refractions->SetToolTip( _("Number of rays that will be cast to evaluate a refraction point") );
fgSizer111->Add( m_numSamples_Refractions, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
fgSizer111->Add( m_spinCtrl_NrSamples_Refractions, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_spreadFactor_Refractions = new wxTextCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer111->Add( m_spreadFactor_Refractions, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_spinCtrlDouble_SpreadFactor_Refractions = new wxSpinCtrlDouble( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 0.1, 25, 0, 1 );
m_spinCtrlDouble_SpreadFactor_Refractions->SetDigits( 1 );
m_spinCtrlDouble_SpreadFactor_Refractions->SetToolTip( _("Random direction factor of the cast rays") );
m_recursiveLevel_Refractions = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 7, 0 );
m_recursiveLevel_Refractions->SetToolTip( _("Number of bounces that a ray can hit reflective objects") );
fgSizer111->Add( m_spinCtrlDouble_SpreadFactor_Refractions, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_spinCtrlRecursiveLevel_Refractions = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 7, 0 );
m_spinCtrlRecursiveLevel_Refractions->SetToolTip( _("Number of bounces that a ray can hit reflective objects") );
fgSizer111->Add( m_spinCtrlRecursiveLevel_Refractions, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
fgSizer111->Add( m_recursiveLevel_Refractions, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
sbSizerRaytracingRenderOptions->Add( fgSizer111, 0, wxTOP|wxBOTTOM|wxRIGHT|wxEXPAND, 5 );
@ -218,11 +209,11 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
fgSizer11->Add( m_colourPickerLight1, 0, wxALL, 5 );
m_spinCtrlLightElevation1 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 90, 0 );
fgSizer11->Add( m_spinCtrlLightElevation1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightElevation1 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightElevation1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_spinCtrlLightAzimuth1 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightAzimuth1 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightAzimuth1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fgSizer11->Add( 10, 0, 0, 0, 5 );
@ -236,11 +227,11 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
fgSizer11->Add( m_colourPickerLight5, 0, wxALL, 5 );
m_spinCtrlLightElevation5 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 90, 0 );
fgSizer11->Add( m_spinCtrlLightElevation5, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightElevation5 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightElevation5, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_spinCtrlLightAzimuth5 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth5, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightAzimuth5 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightAzimuth5, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_staticText23 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("Light 2:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText23->Wrap( -1 );
@ -251,11 +242,11 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
fgSizer11->Add( m_colourPickerLight2, 0, wxALL, 5 );
m_spinCtrlLightElevation2 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 90, 0 );
fgSizer11->Add( m_spinCtrlLightElevation2, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightElevation2 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightElevation2, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_spinCtrlLightAzimuth2 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth2, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightAzimuth2 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightAzimuth2, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
fgSizer11->Add( 0, 0, 0, 0, 5 );
@ -269,11 +260,11 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
fgSizer11->Add( m_colourPickerLight6, 0, wxALL, 5 );
m_spinCtrlLightElevation6 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 90, 0 );
fgSizer11->Add( m_spinCtrlLightElevation6, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightElevation6 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightElevation6, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_spinCtrlLightAzimuth6 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth6, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightAzimuth6 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightAzimuth6, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_staticText25 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("Light 3:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText25->Wrap( -1 );
@ -284,11 +275,11 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
fgSizer11->Add( m_colourPickerLight3, 0, wxALL, 5 );
m_spinCtrlLightElevation3 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 90, 0 );
fgSizer11->Add( m_spinCtrlLightElevation3, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightElevation3 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightElevation3, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_spinCtrlLightAzimuth3 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth3, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightAzimuth3 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightAzimuth3, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
fgSizer11->Add( 0, 0, 0, 0, 5 );
@ -302,11 +293,11 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
fgSizer11->Add( m_colourPickerLight7, 0, wxALL, 5 );
m_spinCtrlLightElevation7 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 90, 0 );
fgSizer11->Add( m_spinCtrlLightElevation7, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightElevation7 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightElevation7, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_spinCtrlLightAzimuth7 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth7, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightAzimuth7 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightAzimuth7, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_staticText171 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("Light 4:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText171->Wrap( -1 );
@ -317,11 +308,11 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
fgSizer11->Add( m_colourPickerLight4, 0, wxALL, 5 );
m_spinCtrlLightElevation4 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 90, 0 );
fgSizer11->Add( m_spinCtrlLightElevation4, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightElevation4 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightElevation4, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_spinCtrlLightAzimuth4 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth4, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightAzimuth4 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightAzimuth4, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
fgSizer11->Add( 0, 0, 0, 0, 5 );
@ -335,14 +326,14 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
fgSizer11->Add( m_colourPickerLight8, 0, wxALL, 5 );
m_spinCtrlLightElevation8 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 90, 0 );
fgSizer11->Add( m_spinCtrlLightElevation8, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightElevation8 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightElevation8, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_spinCtrlLightAzimuth8 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth8, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 1 );
m_lightAzimuth8 = new wxTextCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_lightAzimuth8, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
sbSizerRaytracingLightConfiguration->Add( fgSizer11, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbSizerRaytracingLightConfiguration->Add( fgSizer11, 0, wxEXPAND|wxALL, 5 );
bSizerMargins->Add( sbSizerRaytracingLightConfiguration, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.9.0 Aug 10 2021)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -21,6 +21,7 @@
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/spinctrl.h>
#include <wx/textctrl.h>
#include <wx/statbox.h>
#include <wx/panel.h>
@ -35,24 +36,24 @@ class PANEL_3D_RAYTRACING_OPTIONS_BASE : public RESETTABLE_PANEL
private:
protected:
wxCheckBox* m_checkBoxRaytracing_proceduralTextures;
wxCheckBox* m_checkBoxRaytracing_addFloor;
wxCheckBox* m_checkBoxRaytracing_antiAliasing;
wxCheckBox* m_checkBoxRaytracing_postProcessing;
wxCheckBox* m_cbRaytracing_proceduralTextures;
wxCheckBox* m_cbRaytracing_addFloor;
wxCheckBox* m_cbRaytracing_antiAliasing;
wxCheckBox* m_cbRaytracing_postProcessing;
wxStaticText* m_staticText19;
wxStaticText* m_staticText201;
wxStaticText* m_staticText211;
wxCheckBox* m_checkBoxRaytracing_renderShadows;
wxSpinCtrl* m_spinCtrl_NrSamples_Shadows;
wxSpinCtrlDouble* m_spinCtrlDouble_SpreadFactor_Shadows;
wxCheckBox* m_checkBoxRaytracing_showReflections;
wxSpinCtrl* m_spinCtrl_NrSamples_Reflections;
wxSpinCtrlDouble* m_spinCtrlDouble_SpreadFactor_Reflections;
wxSpinCtrl* m_spinCtrlRecursiveLevel_Reflections;
wxCheckBox* m_checkBoxRaytracing_showRefractions;
wxSpinCtrl* m_spinCtrl_NrSamples_Refractions;
wxSpinCtrlDouble* m_spinCtrlDouble_SpreadFactor_Refractions;
wxSpinCtrl* m_spinCtrlRecursiveLevel_Refractions;
wxCheckBox* m_cbRaytracing_renderShadows;
wxSpinCtrl* m_numSamples_Shadows;
wxTextCtrl* m_spreadFactor_Shadows;
wxCheckBox* m_cbRaytracing_showReflections;
wxSpinCtrl* m_numSamples_Reflections;
wxTextCtrl* m_spreadFactor_Reflections;
wxSpinCtrl* m_recursiveLevel_Reflections;
wxCheckBox* m_cbRaytracing_showRefractions;
wxSpinCtrl* m_numSamples_Refractions;
wxTextCtrl* m_spreadFactor_Refractions;
wxSpinCtrl* m_recursiveLevel_Refractions;
wxStaticText* m_staticText17;
COLOR_SWATCH* m_colourPickerCameraLight;
wxStaticText* m_staticText5;
@ -65,41 +66,40 @@ class PANEL_3D_RAYTRACING_OPTIONS_BASE : public RESETTABLE_PANEL
wxStaticText* m_staticText28;
wxStaticText* m_staticText21;
COLOR_SWATCH* m_colourPickerLight1;
wxSpinCtrl* m_spinCtrlLightElevation1;
wxSpinCtrl* m_spinCtrlLightAzimuth1;
wxTextCtrl* m_lightElevation1;
wxTextCtrl* m_lightAzimuth1;
wxStaticText* m_staticText22;
COLOR_SWATCH* m_colourPickerLight5;
wxSpinCtrl* m_spinCtrlLightElevation5;
wxSpinCtrl* m_spinCtrlLightAzimuth5;
wxTextCtrl* m_lightElevation5;
wxTextCtrl* m_lightAzimuth5;
wxStaticText* m_staticText23;
COLOR_SWATCH* m_colourPickerLight2;
wxSpinCtrl* m_spinCtrlLightElevation2;
wxSpinCtrl* m_spinCtrlLightAzimuth2;
wxTextCtrl* m_lightElevation2;
wxTextCtrl* m_lightAzimuth2;
wxStaticText* m_staticText24;
COLOR_SWATCH* m_colourPickerLight6;
wxSpinCtrl* m_spinCtrlLightElevation6;
wxSpinCtrl* m_spinCtrlLightAzimuth6;
wxTextCtrl* m_lightElevation6;
wxTextCtrl* m_lightAzimuth6;
wxStaticText* m_staticText25;
COLOR_SWATCH* m_colourPickerLight3;
wxSpinCtrl* m_spinCtrlLightElevation3;
wxSpinCtrl* m_spinCtrlLightAzimuth3;
wxTextCtrl* m_lightElevation3;
wxTextCtrl* m_lightAzimuth3;
wxStaticText* m_staticText26;
COLOR_SWATCH* m_colourPickerLight7;
wxSpinCtrl* m_spinCtrlLightElevation7;
wxSpinCtrl* m_spinCtrlLightAzimuth7;
wxTextCtrl* m_lightElevation7;
wxTextCtrl* m_lightAzimuth7;
wxStaticText* m_staticText171;
COLOR_SWATCH* m_colourPickerLight4;
wxSpinCtrl* m_spinCtrlLightElevation4;
wxSpinCtrl* m_spinCtrlLightAzimuth4;
wxTextCtrl* m_lightElevation4;
wxTextCtrl* m_lightAzimuth4;
wxStaticText* m_staticText181;
COLOR_SWATCH* m_colourPickerLight8;
wxSpinCtrl* m_spinCtrlLightElevation8;
wxSpinCtrl* m_spinCtrlLightAzimuth8;
wxTextCtrl* m_lightElevation8;
wxTextCtrl* m_lightAzimuth8;
public:
PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_3D_RAYTRACING_OPTIONS_BASE();
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2018-2020 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2021 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
@ -22,22 +22,22 @@
*/
#include <dialogs/dialog_hotkey_list.h>
#include <kiface_base.h>
#include <panel_hotkeys_editor.h>
#include <widgets/ui_common.h>
#include <wx/sizer.h>
#include <wx/button.h>
DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS( EDA_BASE_FRAME* aParent, TOOL_MANAGER* aToolMgr ):
DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS( EDA_BASE_FRAME* aParent ):
DIALOG_SHIM( aParent, wxID_ANY, _( "Hotkey List" ) )
{
const int margin = KIUI::GetStdMargin();
wxBoxSizer* main_sizer = new wxBoxSizer( wxVERTICAL );
m_hk_list = new PANEL_HOTKEYS_EDITOR( aParent, this, true );
m_hk_list->AddHotKeys( aToolMgr );
Kiface().GetActions( m_hk_list->ActionsList() );
main_sizer->Add( m_hk_list, 1, wxTOP | wxLEFT | wxRIGHT | wxEXPAND, margin );

View File

@ -22,13 +22,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <eda_draw_frame.h>
#include <dialogs/dialog_unit_entry.h>
WX_UNIT_ENTRY_DIALOG::WX_UNIT_ENTRY_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aLabel,
const wxString& aCaption, const long long& aDefaultValue )
: WX_UNIT_ENTRY_DIALOG_BASE( ( wxWindow* ) aParent, wxID_ANY, aCaption ),
m_unit_binder( aParent, m_label, m_textCtrl, m_unit_label, true )
const wxString& aCaption,
const long long& aDefaultValue ) :
WX_UNIT_ENTRY_DIALOG_BASE( ( wxWindow* ) aParent, wxID_ANY, aCaption ),
m_unit_binder( aParent, m_label, m_textCtrl, m_unit_label, true )
{
m_label->SetLabel( aLabel );
m_unit_binder.SetValue( aDefaultValue );

View File

@ -184,14 +184,21 @@ void PANEL_COLOR_SETTINGS::OnThemeChanged( wxCommandEvent& event )
void PANEL_COLOR_SETTINGS::updateSwatches()
{
bool isReadOnly = m_currentSettings->IsReadOnly();
COLOR4D background = m_currentSettings->GetColor( m_backgroundLayer );
for( std::pair<int, COLOR_SWATCH*> pair : m_swatches )
if( m_swatches.empty() )
{
pair.second->SetSwatchBackground( background );
pair.second->SetSwatchColor( m_currentSettings->GetColor( pair.first ), false );
pair.second->SetReadOnly( isReadOnly );
createSwatches();
}
else
{
bool isReadOnly = m_currentSettings->IsReadOnly();
COLOR4D background = m_currentSettings->GetColor( m_backgroundLayer );
for( std::pair<int, COLOR_SWATCH*> pair : m_swatches )
{
pair.second->SetSwatchBackground( background );
pair.second->SetSwatchColor( m_currentSettings->GetColor( pair.first ), false );
pair.second->SetReadOnly( isReadOnly );
}
}
}

View File

@ -17,26 +17,21 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <eda_draw_frame.h>
#include <view/view.h>
#include <widgets/gal_options_panel.h>
#include <widgets/paged_dialog.h>
#include <dialogs/panel_gal_display_options.h>
#include <wx/treebook.h>
PANEL_GAL_DISPLAY_OPTIONS::PANEL_GAL_DISPLAY_OPTIONS( EDA_DRAW_FRAME* aFrame,
PAGED_DIALOG* aParent ) :
wxPanel( aParent->GetTreebook(), wxID_ANY ),
m_frame( aFrame )
PANEL_GAL_DISPLAY_OPTIONS::PANEL_GAL_DISPLAY_OPTIONS( wxWindow* aParent,
APP_SETTINGS_BASE* aAppSettings ) :
wxPanel( aParent, wxID_ANY )
{
auto mainSizer = new wxBoxSizer( wxHORIZONTAL );
SetSizer( mainSizer );
// install GAL options pane
m_galOptsPanel = new GAL_OPTIONS_PANEL( this, m_frame );
m_galOptsPanel = new GAL_OPTIONS_PANEL( this, aAppSettings );
mainSizer->Add( m_galOptsPanel, 1, wxEXPAND | wxLEFT, 5 );
// a spacer to take up the other half of the width
@ -55,12 +50,5 @@ bool PANEL_GAL_DISPLAY_OPTIONS::TransferDataToWindow()
bool PANEL_GAL_DISPLAY_OPTIONS::TransferDataFromWindow()
{
m_galOptsPanel->TransferDataFromWindow();
// refresh view
KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
view->RecacheAllItems();
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
m_frame->GetCanvas()->Refresh();
return true;
}

View File

@ -106,9 +106,15 @@ PANEL_HOTKEYS_EDITOR::PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aW
}
void PANEL_HOTKEYS_EDITOR::AddHotKeys( TOOL_MANAGER* aToolMgr )
bool PANEL_HOTKEYS_EDITOR::Show( bool show )
{
m_toolManagers.push_back( aToolMgr );
if( show && m_hotkeyStore.GetSections().empty() )
{
m_hotkeyStore.Init( m_actions, m_readOnly );
return m_hotkeyListCtrl->TransferDataToControl();
}
return RESETTABLE_PANEL::Show( show );
}
@ -165,8 +171,9 @@ void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer )
bool PANEL_HOTKEYS_EDITOR::TransferDataToWindow()
{
m_hotkeyStore.Init( m_toolManagers, m_readOnly );
return m_hotkeyListCtrl->TransferDataToControl();
// Deferred to Show() for performance when opening preferences
return true;
}
@ -178,9 +185,7 @@ bool PANEL_HOTKEYS_EDITOR::TransferDataFromWindow()
if( m_readOnly )
return true;
// save the hotkeys
for( TOOL_MANAGER* toolMgr : m_toolManagers )
WriteHotKeyConfig( toolMgr->GetActions() );
WriteHotKeyConfig( m_actions );
return true;
}

View File

@ -62,6 +62,7 @@
#include <kiplatform/ui.h>
#include <functional>
#include <kiface_ids.h>
wxDEFINE_EVENT( UNITS_CHANGED, wxCommandEvent );
@ -1003,42 +1004,103 @@ void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event )
PAGED_DIALOG dlg( this, _( "Preferences" ), true );
wxTreebook* book = dlg.GetTreebook();
PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false );
KIFACE* kiface = nullptr;
std::vector<int> expand;
Kiway().GetActions( hotkeysPanel->ActionsList() );
book->AddPage( new PANEL_COMMON_SETTINGS( &dlg, book ), _( "Common" ) );
book->AddPage( new PANEL_MOUSE_SETTINGS( &dlg, book ), _( "Mouse and Touchpad" ) );
PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false );
book->AddPage( hotkeysPanel, _( "Hotkeys" ) );
wxWindow* viewer3D = nullptr;
#define CREATE_PANEL( key ) kiface->CreateWindow( book, key, &Kiway() )
for( unsigned i = 0; i < KIWAY_PLAYER_COUNT; ++i )
{
KIWAY_PLAYER* frame = dlg.Kiway().Player( (FRAME_T) i, false );
kiface = Kiway().KiFACE( KIWAY::FACE_SCH );
if( frame )
{
frame->InstallPreferences( &dlg, hotkeysPanel );
kiface->GetActions( hotkeysPanel->ActionsList() );
if( !viewer3D )
viewer3D = wxFindWindowByName( QUALIFIED_VIEWER3D_FRAMENAME( frame ) );
}
}
if( GetFrameType() == FRAME_SCH_SYMBOL_EDITOR )
expand.push_back( book->GetPageCount() );
if( viewer3D )
static_cast<EDA_BASE_FRAME*>( viewer3D )->InstallPreferences( &dlg, hotkeysPanel );
book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SYM_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SYM_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SYM_COLORS ), _( "Colors" ) );
// The Kicad manager frame is not a player so we have to add it by hand
wxWindow* manager = wxFindWindowByName( KICAD_MANAGER_FRAME_NAME );
if( GetFrameType() == FRAME_SCH )
expand.push_back( book->GetPageCount() );
if( manager )
static_cast<EDA_BASE_FRAME*>( manager )->InstallPreferences( &dlg, hotkeysPanel );
book->AddPage( new wxPanel( book ), _( "Schematic Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_FIELD_NAME_TEMPLATES ), _( "Field Name Templates" ) );
kiface = Kiway().KiFACE( KIWAY::FACE_PCB );
kiface->GetActions( hotkeysPanel->ActionsList() );
if( GetFrameType() == FRAME_FOOTPRINT_EDITOR )
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Footprint Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_DEFAULT_VALUES ), _( "Default Values" ) );
if( GetFrameType() == FRAME_PCB_EDITOR )
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "PCB Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_ACTION_PLUGINS ), _( "Action Plugins" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_ORIGINS_AXES ), _( "Origins & Axes" ) );
if( Kiway().Player( FRAME_PCB_DISPLAY3D, false ) )
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "3D Viewer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_DISPLAY_OPTIONS ), _( "General" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_OPENGL ), _( "Realtime Renderer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_RAYTRACING ), _( "Raytracing Renderer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_COLORS ), _( "Colors" ) );
kiface = Kiway().KiFACE( KIWAY::FACE_GERBVIEW );
kiface->GetActions( hotkeysPanel->ActionsList() );
if( GetFrameType() == FRAME_GERBER )
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "GerbView" ) );
book->AddSubPage( CREATE_PANEL( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_GBR_EXCELLON_OPTIONS ), _( "Excellon Options" ) );
kiface = Kiway().KiFACE( KIWAY::FACE_PL_EDITOR );
kiface->GetActions( hotkeysPanel->ActionsList() );
if( GetFrameType() == FRAME_PL_EDITOR )
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Drawing Sheet Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_DS_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_DS_COLORS ), _( "Colors" ) );
for( size_t i = 0; i < book->GetPageCount(); ++i )
book->GetPage( i )->Layout();
for( int page : expand )
book->ExpandNode( page );
if( dlg.ShowModal() == wxID_OK )
dlg.Kiway().CommonSettingsChanged( false, false );
#undef CREATE_PANEL
}

View File

@ -297,6 +297,17 @@ void EDA_DRAW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
m_galDisplayOptions.ReadCommonConfig( *settings, this );
#ifndef __WXMAC__
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
APP_SETTINGS_BASE* cfg = Kiface().KifaceSettings();
if( cfg )
canvasType = static_cast<EDA_DRAW_PANEL_GAL::GAL_TYPE>( cfg->m_Graphics.canvas_type );
if( canvasType != GetCanvas()->GetBackend() )
GetCanvas()->SwitchBackend( canvasType );
#endif
// Notify all tools the preferences have changed
if( m_toolManager )
m_toolManager->RunAction( ACTIONS::updatePreferences, true );

View File

@ -90,35 +90,28 @@ HOTKEY_STORE::HOTKEY_STORE()
}
void HOTKEY_STORE::Init( std::vector<TOOL_MANAGER*> aToolManagerList, bool aIncludeReadOnlyCmds )
void HOTKEY_STORE::Init( std::vector<TOOL_ACTION*> aActionsList, bool aIncludeReadOnlyCmds )
{
m_toolManagers = std::move( aToolManagerList );
// Collect all action maps into a single master map. This will re-group everything
// and collect duplicates together
std::map<std::string, HOTKEY> masterMap;
for( TOOL_MANAGER* toolMgr : m_toolManagers )
for( TOOL_ACTION* action : aActionsList )
{
for( const std::pair<const std::string, TOOL_ACTION*>& entry : toolMgr->GetActions() )
// Internal actions probably shouldn't be allowed hotkeys
if( action->GetLabel().IsEmpty() )
continue;
if( !ADVANCED_CFG::GetCfg().m_ExtraZoneDisplayModes )
{
// Internal actions probably shouldn't be allowed hotkeys
if( entry.second->GetLabel().IsEmpty() )
continue;
if( !ADVANCED_CFG::GetCfg().m_ExtraZoneDisplayModes )
if( action->GetName() == "pcbnew.Control.zoneDisplayOutlines"
|| action->GetName() == "pcbnew.Control.zoneDisplayTesselation" )
{
if( entry.second->GetName() == "pcbnew.Control.zoneDisplayOutlines"
|| entry.second->GetName() == "pcbnew.Control.zoneDisplayTesselation" )
{
continue;
}
continue;
}
HOTKEY& hotkey = masterMap[ entry.first ];
hotkey.m_Actions.push_back( entry.second );
hotkey.m_EditKeycode = entry.second->GetHotKey();
}
HOTKEY& hotkey = masterMap[ action->GetName() ];
hotkey.m_Actions.push_back( action );
hotkey.m_EditKeycode = action->GetHotKey();
}
wxString currentApp;

View File

@ -316,9 +316,9 @@ int KeyCodeFromKeyName( const wxString& keyname )
/*
* Displays the hotkeys registered with the given tool manager.
*/
void DisplayHotkeyList( EDA_BASE_FRAME* aParent, TOOL_MANAGER* aToolManager )
void DisplayHotkeyList( EDA_BASE_FRAME* aParent )
{
DIALOG_LIST_HOTKEYS dlg( aParent, aToolManager );
DIALOG_LIST_HOTKEYS dlg( aParent );
dlg.ShowModal();
}
@ -361,7 +361,7 @@ void ReadHotKeyConfig( const wxString& aFileName, std::map<std::string, int>& aH
}
int WriteHotKeyConfig( const std::map<std::string, TOOL_ACTION*>& aActionMap )
int WriteHotKeyConfig( const std::vector<TOOL_ACTION*>& aActions )
{
std::map<std::string, int> hotkeys;
wxFileName fn( "user" );
@ -373,16 +373,15 @@ int WriteHotKeyConfig( const std::map<std::string, TOOL_ACTION*>& aActionMap )
ReadHotKeyConfig( fn.GetFullPath(), hotkeys );
// Overlay the current app's hotkey definitions onto the map
for( const auto& ii : aActionMap )
hotkeys[ ii.first ] = ii.second->GetHotKey();
for( const TOOL_ACTION* action : aActions )
hotkeys[ action->GetName() ] = action->GetHotKey();
// Write entire hotkey set
wxFFileOutputStream outStream( fn.GetFullPath() );
wxTextOutputStream txtStream( outStream, wxEOL_UNIX );
for( const auto& ii : hotkeys )
txtStream << wxString::Format( "%s\t%s", ii.first,
KeyNameFromKeyCode( ii.second ) ) << endl;
for( const std::pair<const std::string, int>& entry : hotkeys )
txtStream << entry.first << "\t" << KeyNameFromKeyCode( entry.second ) << endl;
txtStream.Flush();
outStream.Close();

View File

@ -35,6 +35,7 @@
#include <id.h>
#include <kiplatform/app.h>
#include <settings/settings_manager.h>
#include <tool/action_manager.h>
#include <logging.h>
#include <wx/dynlib.h>
@ -483,6 +484,13 @@ void KIWAY::ExpressMail( FRAME_T aDestination, MAIL_T aCommand, std::string& aPa
}
void KIWAY::GetActions( std::vector<TOOL_ACTION*>& aActions ) const
{
for( TOOL_ACTION* action : ACTION_MANAGER::GetActionList() )
aActions.push_back( action );
}
void KIWAY::SetLanguage( int aLanguage )
{
wxString errMsg;

View File

@ -256,7 +256,7 @@ int COMMON_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
int COMMON_CONTROL::ListHotKeys( const TOOL_EVENT& aEvent )
{
DisplayHotkeyList( m_frame, m_toolMgr );
DisplayHotkeyList( m_frame );
return 0;
}

View File

@ -372,12 +372,6 @@ void TOOL_MANAGER::PostEvent( const TOOL_EVENT& aEvent )
}
const std::map<std::string, TOOL_ACTION*>& TOOL_MANAGER::GetActions() const
{
return m_actionMgr->GetActions();
}
int TOOL_MANAGER::GetHotKey( const TOOL_ACTION& aAction ) const
{
return m_actionMgr->GetHotKey( aAction );

View File

@ -32,6 +32,7 @@
#include <ignore.h>
#include <widgets/gal_options_panel.h>
#include <settings/app_settings.h>
#include <eda_draw_frame.h>
#include <config_map.h>
@ -65,10 +66,9 @@ static const UTIL::CFG_MAP<KIGFX::GRID_SNAPPING> gridSnapConfigVals =
};
GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ) :
GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, APP_SETTINGS_BASE* aAppSettings ) :
wxPanel( aParent, wxID_ANY ),
m_drawFrame( aDrawFrame ),
m_galOptions( aDrawFrame->GetGalDisplayOptions() )
m_cfg( aAppSettings )
{
// the main sizer that holds "columns" of settings
m_mainSizer = new wxBoxSizer( wxHORIZONTAL );
@ -215,27 +215,21 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFr
bool GAL_OPTIONS_PANEL::TransferDataToWindow()
{
#ifndef __WXMAC__
if( m_drawFrame->GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
auto canvasType = static_cast<EDA_DRAW_PANEL_GAL::GAL_TYPE>( m_cfg->m_Graphics.canvas_type );
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
m_renderingEngine->SetSelection( 0 );
else
m_renderingEngine->SetSelection( 1 );
#else
ignore_unused( m_drawFrame );
#endif
m_gridSnapOptions->SetSelection( UTIL::GetConfigForVal( gridSnapConfigVals,
m_galOptions.m_gridSnapping ) );
m_gridSnapOptions->SetSelection( m_cfg->m_Window.grid.snap );
m_gridStyle->SetSelection( m_cfg->m_Window.grid.style );
m_gridLineWidth->SetValue( m_cfg->m_Window.grid.line_width );
m_gridMinSpacing->SetValue( m_cfg->m_Window.grid.min_spacing );
m_gridStyle->SetSelection( UTIL::GetConfigForVal( gridStyleSelectMap,
m_galOptions.m_gridStyle ) );
m_gridLineWidth->SetValue( m_galOptions.m_gridLineWidth );
m_gridMinSpacing->SetValue( m_galOptions.m_gridMinSpacing );
m_cursorShape->SetSelection( m_galOptions.m_fullscreenCursor );
m_forceCursorDisplay->SetValue( m_galOptions.m_forceDisplayCursor );
m_cursorShape->SetSelection( m_cfg->m_Window.cursor.fullscreen_cursor );
m_forceCursorDisplay->SetValue( m_cfg->m_Window.cursor.always_show_cursor );
return true;
}
@ -243,28 +237,18 @@ bool GAL_OPTIONS_PANEL::TransferDataToWindow()
bool GAL_OPTIONS_PANEL::TransferDataFromWindow()
{
m_galOptions.m_gridSnapping = UTIL::GetValFromConfig( gridSnapConfigVals,
m_gridSnapOptions->GetSelection() );
m_cfg->m_Window.grid.snap = m_gridSnapOptions->GetSelection();
m_cfg->m_Window.grid.style = m_gridStyle->GetSelection();
m_cfg->m_Window.grid.line_width = m_gridLineWidth->GetValue();
m_cfg->m_Window.grid.min_spacing = m_gridMinSpacing->GetValue();
m_galOptions.m_gridStyle = UTIL::GetValFromConfig( gridStyleSelectMap,
m_gridStyle->GetSelection() );
m_galOptions.m_gridLineWidth = m_gridLineWidth->GetValue();
m_galOptions.m_gridMinSpacing = m_gridMinSpacing->GetValue();
m_galOptions.m_fullscreenCursor = m_cursorShape->GetSelection();
m_galOptions.m_forceDisplayCursor = m_forceCursorDisplay->GetValue();
m_cfg->m_Window.cursor.fullscreen_cursor = m_cursorShape->GetSelection();
m_cfg->m_Window.cursor.always_show_cursor = m_forceCursorDisplay->GetValue();
#ifndef __WXMAC__
EDA_DRAW_PANEL_GAL::GAL_TYPE wantedType = m_renderingEngine->GetSelection() == 0 ?
m_cfg->m_Graphics.canvas_type = m_renderingEngine->GetSelection() == 0 ?
EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL :
EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
EDA_DRAW_PANEL_GAL::GAL_TYPE currentType = m_drawFrame->GetCanvas()->GetBackend();
if( wantedType != currentType )
m_drawFrame->GetCanvas()->SwitchBackend( wantedType );
#endif
return true;

View File

@ -128,10 +128,7 @@ void PAGED_DIALOG::finishInitialization()
m_treebook->GetTreeCtrl()->InvalidateBestSize();
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )
{
m_treebook->ExpandNode( i );
m_treebook->GetPage( i )->Layout();
}
m_treebook->Layout();
m_treebook->Fit();

View File

@ -37,7 +37,7 @@
wxDEFINE_EVENT( DELAY_FOCUS, wxCommandEvent );
UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent, wxStaticText* aLabel, wxWindow* aValueCtrl,
UNIT_BINDER::UNIT_BINDER( EDA_BASE_FRAME* aParent, wxStaticText* aLabel, wxWindow* aValueCtrl,
wxStaticText* aUnitLabel, bool allowEval ) :
m_frame( aParent ),
m_label( aLabel ),

View File

@ -97,6 +97,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
// Initialize some display options
auto displ_opts = GetDisplayOptions();
displ_opts.m_DisplayPadClearance = false; // Pad clearance has no meaning here
displ_opts.m_DisplayPadNoConnects = false; // Nor do connections
// Track and via clearance has no meaning here.
displ_opts.m_ShowTrackClearanceMode = PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE;

View File

@ -113,8 +113,8 @@ set( EESCHEMA_DLGS
dialogs/dialog_update_symbol_fields.cpp
dialogs/dialog_update_symbol_fields_base.cpp
dialogs/panel_eeschema_color_settings.cpp
dialogs/panel_eeschema_template_fieldnames.cpp
dialogs/panel_eeschema_template_fieldnames_base.cpp
dialogs/panel_template_fieldnames.cpp
dialogs/panel_template_fieldnames_base.cpp
dialogs/panel_eeschema_display_options.cpp
dialogs/panel_eeschema_display_options_base.cpp
dialogs/panel_eeschema_editing_options.cpp

View File

@ -32,7 +32,7 @@
#include <project/net_settings.h>
#include <settings/settings_manager.h>
#include "dialog_schematic_setup.h"
#include "panel_eeschema_template_fieldnames.h"
#include "panel_template_fieldnames.h"
#include <wx/treebook.h>
@ -42,11 +42,15 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
m_frame( aFrame ),
m_severities( nullptr )
{
PROJECT_FILE& project = aFrame->Prj().GetProjectFile();
SCHEMATIC& schematic = aFrame->Schematic();
PROJECT_FILE& project = aFrame->Prj().GetProjectFile();
SCHEMATIC& schematic = aFrame->Schematic();
SCHEMATIC_SETTINGS& settings = schematic.Settings();
m_formatting = new PANEL_SETUP_FORMATTING( m_treebook, aFrame );
m_fieldNameTemplates = new PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( aFrame, m_treebook, false );
m_fieldNameTemplates = new PANEL_TEMPLATE_FIELDNAMES( m_treebook,
&settings.m_TemplateFieldNames );
m_pinMap = new PANEL_SETUP_PINMAP( m_treebook, aFrame );
m_pinToPinError = ERC_ITEM::Create( ERCE_PIN_TO_PIN_WARNING );
@ -76,7 +80,10 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
m_treebook->AddSubPage( m_textVars, _( "Text Variables" ) );
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )
{
m_treebook->ExpandNode( i );
m_macHack.push_back( true );
}
// Connect Events
m_treebook->Connect( wxEVT_TREEBOOK_PAGE_CHANGED,
@ -163,7 +170,6 @@ void DIALOG_SCHEMATIC_SETUP::OnAuxiliaryAction( wxCommandEvent& event )
PROJECT* otherPrj = m_frame->GetSettingsManager()->GetProject( projectFn.GetFullPath() );
SCHEMATIC otherSch( otherPrj );
TEMPLATES templateMgr;
PROJECT_FILE& file = otherPrj->GetProjectFile();
wxASSERT( file.m_SchematicSettings );

View File

@ -25,7 +25,7 @@
class SCH_EDIT_FRAME;
class PANEL_SETUP_SEVERITIES;
class PANEL_EESCHEMA_TEMPLATE_FIELDNAMES;
class PANEL_TEMPLATE_FIELDNAMES;
class PANEL_SETUP_FORMATTING;
class PANEL_SETUP_PINMAP;
class PANEL_TEXT_VARIABLES;
@ -42,17 +42,17 @@ public:
protected:
void OnAuxiliaryAction( wxCommandEvent& event ) override;
SCH_EDIT_FRAME* m_frame;
SCH_EDIT_FRAME* m_frame;
PANEL_SETUP_FORMATTING* m_formatting;
PANEL_EESCHEMA_TEMPLATE_FIELDNAMES* m_fieldNameTemplates;
PANEL_SETUP_PINMAP* m_pinMap;
PANEL_SETUP_SEVERITIES* m_severities;
PANEL_SETUP_NETCLASSES* m_netclasses;
PANEL_TEXT_VARIABLES* m_textVars;
std::shared_ptr<ERC_ITEM> m_pinToPinError;
PANEL_SETUP_FORMATTING* m_formatting;
PANEL_TEMPLATE_FIELDNAMES* m_fieldNameTemplates;
PANEL_SETUP_PINMAP* m_pinMap;
PANEL_SETUP_SEVERITIES* m_severities;
PANEL_SETUP_NETCLASSES* m_netclasses;
PANEL_TEXT_VARIABLES* m_textVars;
std::shared_ptr<ERC_ITEM> m_pinToPinError;
std::vector<bool> m_macHack;
std::vector<bool> m_macHack;
// event handlers
void OnPageChange( wxBookCtrlEvent& event );

View File

@ -354,7 +354,7 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataFromWindow()
{
wxPanel temp( this );
temp.Hide();
PANEL_EESCHEMA_COLOR_SETTINGS prefs( m_frame, &temp );
PANEL_EESCHEMA_COLOR_SETTINGS prefs( &temp );
wxString checkboxLabel = prefs.m_optOverrideColors->GetLabel();
KIDIALOG dlg( this, _( "Note: item colors are overridden in the current color theme." ),

View File

@ -54,10 +54,8 @@ std::set<int> g_excludedLayers =
};
PANEL_EESCHEMA_COLOR_SETTINGS::PANEL_EESCHEMA_COLOR_SETTINGS( SCH_BASE_FRAME* aFrame,
wxWindow* aParent ) :
PANEL_EESCHEMA_COLOR_SETTINGS::PANEL_EESCHEMA_COLOR_SETTINGS( wxWindow* aParent ) :
PANEL_COLOR_SETTINGS( aParent ),
m_frame( aFrame ),
m_preview( nullptr ),
m_page( nullptr ),
m_titleBlock( nullptr ),
@ -67,9 +65,6 @@ PANEL_EESCHEMA_COLOR_SETTINGS::PANEL_EESCHEMA_COLOR_SETTINGS( SCH_BASE_FRAME* aF
m_colorNamespace = "schematic";
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
mgr.ReloadColorSettings();
COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
EESCHEMA_SETTINGS* app_settings = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
COLOR_SETTINGS* current = mgr.GetColorSettings( app_settings->m_ColorTheme );
@ -94,26 +89,10 @@ PANEL_EESCHEMA_COLOR_SETTINGS::PANEL_EESCHEMA_COLOR_SETTINGS( SCH_BASE_FRAME* aF
m_backgroundLayer = LAYER_SCHEMATIC_BACKGROUND;
createSwatches();
m_galDisplayOptions.ReadConfig( *common_settings, app_settings->m_Window, this );
m_galDisplayOptions.m_forceDisplayCursor = false;
auto type = static_cast<EDA_DRAW_PANEL_GAL::GAL_TYPE>( app_settings->m_Graphics.canvas_type );
m_preview = new SCH_PREVIEW_PANEL( this, wxID_ANY, wxDefaultPosition, wxSize( -1, -1 ),
m_galDisplayOptions, type );
m_preview->SetStealsFocus( false );
m_preview->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
m_preview->GetGAL()->SetAxesEnabled( false );
m_colorsMainSizer->Add( 10, 0, 0, wxEXPAND, 5 );
m_colorsMainSizer->Add( m_preview, 1, wxALL | wxEXPAND, 5 );
m_colorsMainSizer->Add( 10, 0, 0, wxEXPAND, 5 );
createPreviewItems();
updatePreview();
zoomFitPreview();
m_galType = static_cast<EDA_DRAW_PANEL_GAL::GAL_TYPE>( app_settings->m_Graphics.canvas_type );
}
@ -136,8 +115,6 @@ bool PANEL_EESCHEMA_COLOR_SETTINGS::TransferDataFromWindow()
if( !saveCurrentTheme( true ) )
return false;
m_frame->GetCanvas()->GetView()->GetPainter()->GetSettings()->LoadColors( m_currentSettings );
SETTINGS_MANAGER& settingsMgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* app_settings = settingsMgr.GetAppSettings<EESCHEMA_SETTINGS>();
app_settings->m_ColorTheme = m_currentSettings->GetFilename();
@ -231,6 +208,22 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createSwatches()
int min_width = m_colorsGridSizer->GetMinSize().x;
const int margin = 20; // A margin around the sizer
m_colorsListWindow->SetMinSize( wxSize( min_width + margin, -1 ) );
m_preview = new SCH_PREVIEW_PANEL( this, wxID_ANY, wxDefaultPosition, wxSize( -1, -1 ),
m_galDisplayOptions, m_galType );
m_preview->SetStealsFocus( false );
m_preview->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
m_preview->GetGAL()->SetAxesEnabled( false );
m_colorsMainSizer->Add( 10, 0, 0, wxEXPAND, 5 );
m_colorsMainSizer->Add( m_preview, 1, wxALL | wxEXPAND, 5 );
m_colorsMainSizer->Add( 10, 0, 0, wxEXPAND, 5 );
m_colorsMainSizer->Layout();
createPreviewItems();
updatePreview();
zoomFitPreview();
}
@ -495,18 +488,21 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::updatePreview()
void PANEL_EESCHEMA_COLOR_SETTINGS::zoomFitPreview()
{
KIGFX::VIEW* view = m_preview->GetView();
if( m_preview )
{
KIGFX::VIEW* view = m_preview->GetView();
view->SetScale( 1.0 );
VECTOR2D screenSize = view->ToWorld( m_preview->GetClientSize(), false );
view->SetScale( 1.0 );
VECTOR2D screenSize = view->ToWorld( m_preview->GetClientSize(), false );
VECTOR2I psize( m_page->GetWidthIU(), m_page->GetHeightIU() );
double scale = view->GetScale() / std::max( fabs( psize.x / screenSize.x ),
fabs( psize.y / screenSize.y ) );
VECTOR2I psize( m_page->GetWidthIU(), m_page->GetHeightIU() );
double scale = view->GetScale() / std::max( fabs( psize.x / screenSize.x ),
fabs( psize.y / screenSize.y ) );
view->SetScale( scale * m_galDisplayOptions.m_scaleFactor * 0.8 /* margin */ );
view->SetCenter( m_drawingSheet->ViewBBox().Centre() );
m_preview->ForceRefresh();
view->SetScale( scale * m_galDisplayOptions.m_scaleFactor * 0.8 /* margin */ );
view->SetCenter( m_drawingSheet->ViewBBox().Centre() );
m_preview->ForceRefresh();
}
}

View File

@ -22,15 +22,11 @@
#ifndef PANEL_EESCHEMA_COLOR_SETTINGS_H_
#define PANEL_EESCHEMA_COLOR_SETTINGS_H_
#include <gal/color4d.h>
#include <gal/gal_display_options.h>
#include <layer_ids.h>
#include <dialogs/panel_color_settings.h>
#include <class_draw_panel_gal.h>
class COLOR_SETTINGS;
class SCH_BASE_FRAME;
class PAGE_INFO;
class SCH_ITEM;
class EDA_ITEM;
class SCH_PREVIEW_PANEL;
class TITLE_BLOCK;
class DS_PROXY_VIEW_ITEM;
@ -39,7 +35,7 @@ class DS_PROXY_VIEW_ITEM;
class PANEL_EESCHEMA_COLOR_SETTINGS : public PANEL_COLOR_SETTINGS
{
public:
PANEL_EESCHEMA_COLOR_SETTINGS( SCH_BASE_FRAME* aFrame, wxWindow* aParent );
PANEL_EESCHEMA_COLOR_SETTINGS( wxWindow* aParent );
~PANEL_EESCHEMA_COLOR_SETTINGS() override;
@ -59,23 +55,23 @@ protected:
bool saveCurrentTheme( bool aValidate ) override;
private:
SCH_BASE_FRAME* m_frame;
SCH_PREVIEW_PANEL* m_preview;
PAGE_INFO* m_page;
TITLE_BLOCK* m_titleBlock;
DS_PROXY_VIEW_ITEM* m_drawingSheet;
std::vector<EDA_ITEM*> m_previewItems;
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions;
void createSwatches() override;
private:
void createPreviewItems();
void createSwatches();
void updatePreview();
void zoomFitPreview();
private:
SCH_PREVIEW_PANEL* m_preview;
PAGE_INFO* m_page;
TITLE_BLOCK* m_titleBlock;
DS_PROXY_VIEW_ITEM* m_drawingSheet;
std::vector<EDA_ITEM*> m_previewItems;
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions;
EDA_DRAW_PANEL_GAL::GAL_TYPE m_galType;
};

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 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
@ -22,18 +22,18 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <sch_edit_frame.h>
#include <sch_painter.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <eeschema_settings.h>
#include <panel_eeschema_display_options.h>
#include <widgets/gal_options_panel.h>
#include <sch_junction.h>
#include <widgets/ui_common.h>
PANEL_EESCHEMA_DISPLAY_OPTIONS::PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME* aFrame,
wxWindow* aWindow ) :
PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( aWindow ),
m_frame( aFrame )
PANEL_EESCHEMA_DISPLAY_OPTIONS::PANEL_EESCHEMA_DISPLAY_OPTIONS( wxWindow* aParent,
APP_SETTINGS_BASE* aAppSettings ) :
PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( aParent )
{
m_galOptsPanel = new GAL_OPTIONS_PANEL( this, m_frame );
m_galOptsPanel = new GAL_OPTIONS_PANEL( this, aAppSettings );
m_galOptionsSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 );
@ -43,7 +43,8 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS::PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME*
bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow()
{
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
m_checkShowHiddenPins->SetValue( cfg->m_Appearance.show_hidden_pins );
m_checkShowHiddenFields->SetValue( cfg->m_Appearance.show_hidden_fields );
@ -66,7 +67,8 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow()
bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
{
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
cfg->m_Appearance.show_hidden_pins = m_checkShowHiddenPins->GetValue();
cfg->m_Appearance.show_hidden_fields = m_checkShowHiddenFields->GetValue();
@ -81,14 +83,6 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
cfg->m_CrossProbing.zoom_to_fit = m_checkCrossProbeZoom->GetValue();
cfg->m_CrossProbing.auto_highlight = m_checkCrossProbeAutoHighlight->GetValue();
// Update canvas
m_frame->GetRenderSettings()->m_ShowHiddenPins = m_checkShowHiddenPins->GetValue();
m_frame->GetRenderSettings()->m_ShowHiddenText = m_checkShowHiddenFields->GetValue();
m_frame->GetRenderSettings()->SetShowPageLimits( cfg->m_Appearance.show_page_limits );
m_frame->GetCanvas()->GetView()->MarkDirty();
m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT );
m_frame->GetCanvas()->Refresh();
m_galOptsPanel->TransferDataFromWindow();
return true;

View File

@ -17,28 +17,26 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KICAD_PANEL_EESCHEMA_DISPLAY_OPTIONS_H
#define KICAD_PANEL_EESCHEMA_DISPLAY_OPTIONS_H
#ifndef PANEL_EESCHEMA_DISPLAY_OPTIONS_H
#define PANEL_EESCHEMA_DISPLAY_OPTIONS_H
#include <widgets/unit_binder.h>
#include "panel_eeschema_display_options_base.h"
class SCH_EDIT_FRAME;
class APP_SETTINGS_BASE;
class GAL_OPTIONS_PANEL;
class PANEL_EESCHEMA_DISPLAY_OPTIONS : public PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE
{
public:
PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow );
PANEL_EESCHEMA_DISPLAY_OPTIONS( wxWindow* aParent, APP_SETTINGS_BASE* aAppSettings );
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
SCH_EDIT_FRAME* m_frame;
GAL_OPTIONS_PANEL* m_galOptsPanel;
};
#endif //KICAD_PANEL_EESCHEMA_DISPLAY_OPTIONS_H
#endif // PANEL_EESCHEMA_DISPLAY_OPTIONS_H

View File

@ -22,20 +22,18 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <sch_edit_frame.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <settings/color_settings.h>
#include <painter.h>
#include <eeschema_settings.h>
#include "panel_eeschema_editing_options.h"
PANEL_EESCHEMA_EDITING_OPTIONS::PANEL_EESCHEMA_EDITING_OPTIONS( SCH_EDIT_FRAME* aFrame,
wxWindow* aWindow ) :
PANEL_EESCHEMA_EDITING_OPTIONS::PANEL_EESCHEMA_EDITING_OPTIONS( wxWindow* aWindow,
EDA_BASE_FRAME* aUnitsProvider ) :
PANEL_EESCHEMA_EDITING_OPTIONS_BASE( aWindow ),
m_frame( aFrame ),
m_hPitch( aFrame, m_hPitchLabel, m_hPitchCtrl, m_hPitchUnits ),
m_vPitch( aFrame, m_vPitchLabel, m_vPitchCtrl, m_vPitchUnits )
m_hPitch( aUnitsProvider, m_hPitchLabel, m_hPitchCtrl, m_hPitchUnits ),
m_vPitch( aUnitsProvider, m_vPitchLabel, m_vPitchCtrl, m_vPitchUnits )
{
// Make the color swatch show "Clear Color" instead
m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
@ -51,13 +49,14 @@ PANEL_EESCHEMA_EDITING_OPTIONS::PANEL_EESCHEMA_EDITING_OPTIONS( SCH_EDIT_FRAME*
bool PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataToWindow()
{
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
m_hPitch.SetValue( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ) );
m_vPitch.SetValue( Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) );
m_spinLabelRepeatStep->SetValue( cfg->m_Drawing.repeat_label_increment );
COLOR_SETTINGS* settings = m_frame->GetColorSettings();
COLOR_SETTINGS* settings = mgr.GetColorSettings();
COLOR4D schematicBackground = settings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
m_borderColorSwatch->SetSwatchBackground( schematicBackground );
@ -85,7 +84,8 @@ bool PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataToWindow()
bool PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataFromWindow()
{
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
cfg->m_Drawing.default_sheet_border_color = m_borderColorSwatch->GetSwatchColor();
cfg->m_Drawing.default_sheet_background_color = m_backgroundColorSwatch->GetSwatchColor();
@ -107,8 +107,6 @@ bool PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataFromWindow()
cfg->m_Drawing.auto_start_wires = m_cbAutoStartWires->GetValue();
m_frame->SaveProjectSettings();
return true;
}

View File

@ -23,19 +23,18 @@
#include <widgets/unit_binder.h>
#include "panel_eeschema_editing_options_base.h"
class SCH_EDIT_FRAME;
class EDA_BASE_FRAME;
class PANEL_EESCHEMA_EDITING_OPTIONS : public PANEL_EESCHEMA_EDITING_OPTIONS_BASE
{
public:
PANEL_EESCHEMA_EDITING_OPTIONS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow );
PANEL_EESCHEMA_EDITING_OPTIONS( wxWindow* aWindow, EDA_BASE_FRAME* aUnitsProvider );
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
SCH_EDIT_FRAME* m_frame;
UNIT_BINDER m_hPitch;
UNIT_BINDER m_vPitch;
};

View File

@ -21,31 +21,29 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <eeschema_settings.h>
#include <symbol_edit_frame.h>
#include <symbol_editor_settings.h>
#include <sch_painter.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <symbol_editor_settings.h>
#include "panel_sym_color_settings.h"
PANEL_SYM_COLOR_SETTINGS::PANEL_SYM_COLOR_SETTINGS( SYMBOL_EDIT_FRAME* aFrame,
wxWindow* aWindow )
: PANEL_SYM_COLOR_SETTINGS_BASE( aWindow ), m_frame( aFrame )
PANEL_SYM_COLOR_SETTINGS::PANEL_SYM_COLOR_SETTINGS( wxWindow* aWindow ) :
PANEL_SYM_COLOR_SETTINGS_BASE( aWindow )
{
}
bool PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow()
{
SYMBOL_EDITOR_SETTINGS* cfg = m_frame->GetSettings();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
if( cfg->m_UseEeschemaColorSettings )
m_eeschemaRB->SetValue( true );
else
m_themeRB->SetValue( true );
COLOR_SETTINGS* current = m_frame->GetSettingsManager()->GetColorSettings( cfg->m_ColorTheme );
COLOR_SETTINGS* current = mgr.GetColorSettings( cfg->m_ColorTheme );
int width = 0;
int height = 0;
@ -53,7 +51,7 @@ bool PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow()
m_themes->Clear();
for( COLOR_SETTINGS* settings : m_frame->GetSettingsManager()->GetColorSettingsList() )
for( COLOR_SETTINGS* settings : mgr.GetColorSettingsList() )
{
int pos = m_themes->Append( settings->GetName(), static_cast<void*>( settings ) );
@ -74,26 +72,19 @@ bool PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow()
bool PANEL_SYM_COLOR_SETTINGS::TransferDataFromWindow()
{
SETTINGS_MANAGER* mgr = m_frame->GetSettingsManager();
int sel = m_themes->GetSelection();
COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
SYMBOL_EDITOR_SETTINGS* cfg = mgr->GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
cfg->m_UseEeschemaColorSettings = m_eeschemaRB->GetValue();
if( cfg->m_UseEeschemaColorSettings )
{
EESCHEMA_SETTINGS* eecfg = mgr->GetAppSettings<EESCHEMA_SETTINGS>();
colors = mgr->GetColorSettings( eecfg->m_ColorTheme );
}
else
if( !cfg->m_UseEeschemaColorSettings )
{
int sel = m_themes->GetSelection();
COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
cfg->m_ColorTheme = colors->GetFilename();
}
RENDER_SETTINGS* settings = m_frame->GetCanvas()->GetView()->GetPainter()->GetSettings();
settings->LoadColors( colors );
return true;
}

View File

@ -26,13 +26,11 @@
#include "panel_sym_color_settings_base.h"
class SYMBOL_EDIT_FRAME;
class PANEL_SYM_COLOR_SETTINGS : public PANEL_SYM_COLOR_SETTINGS_BASE
{
public:
PANEL_SYM_COLOR_SETTINGS( SYMBOL_EDIT_FRAME* aFrame, wxWindow* aWindow );
PANEL_SYM_COLOR_SETTINGS( wxWindow* aWindow );
protected:
void OnThemeChanged( wxCommandEvent& event ) override;
@ -41,8 +39,6 @@ private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
SYMBOL_EDIT_FRAME* m_frame;
};
#endif

View File

@ -22,29 +22,27 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <symbol_edit_frame.h>
#include <sch_painter.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <symbol_editor/symbol_editor_settings.h>
#include "panel_sym_editing_options.h"
PANEL_SYM_EDITING_OPTIONS::PANEL_SYM_EDITING_OPTIONS( SYMBOL_EDIT_FRAME* aFrame,
wxWindow* aWindow ) :
PANEL_SYM_EDITING_OPTIONS::PANEL_SYM_EDITING_OPTIONS( wxWindow* aWindow,
EDA_BASE_FRAME* aUnitsProvider ) :
PANEL_SYM_EDITING_OPTIONS_BASE( aWindow ),
m_frame( aFrame ),
m_lineWidth( aFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits ),
m_textSize( aFrame, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
m_pinLength( aFrame, m_pinLengthLabel, m_pinLengthCtrl, m_pinLengthUnits ),
m_pinNameSize( aFrame, m_pinNameSizeLabel, m_pinNameSizeCtrl, m_pinNameSizeUnits ),
m_pinNumberSize( aFrame, m_pinNumSizeLabel, m_pinNumSizeCtrl, m_pinNumSizeUnits )
m_lineWidth( aUnitsProvider, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits ),
m_textSize( aUnitsProvider, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
m_pinLength( aUnitsProvider, m_pinLengthLabel, m_pinLengthCtrl, m_pinLengthUnits ),
m_pinNameSize( aUnitsProvider, m_pinNameSizeLabel, m_pinNameSizeCtrl, m_pinNameSizeUnits ),
m_pinNumberSize( aUnitsProvider, m_pinNumSizeLabel, m_pinNumSizeCtrl, m_pinNumSizeUnits )
{}
bool PANEL_SYM_EDITING_OPTIONS::TransferDataToWindow()
{
SYMBOL_EDITOR_SETTINGS* settings = m_frame->GetSettings();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* settings = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
m_lineWidth.SetValue( Mils2iu( settings->m_Defaults.line_width ) );
m_textSize.SetValue( Mils2iu( settings->m_Defaults.text_size ) );
@ -53,8 +51,7 @@ bool PANEL_SYM_EDITING_OPTIONS::TransferDataToWindow()
m_pinNameSize.SetValue( Mils2iu( settings->m_Defaults.pin_name_size ) );
m_choicePinDisplacement->SetSelection( settings->m_Repeat.pin_step == 50 ? 1 : 0 );
m_spinRepeatLabel->SetValue( settings->m_Repeat.label_delta );
m_cbShowPinElectricalType->SetValue( m_frame->GetRenderSettings()->m_ShowPinsElectricalType );
m_cbShowPinElectricalType->SetValue( settings->m_ShowPinElectricalType );
return true;
}
@ -62,7 +59,8 @@ bool PANEL_SYM_EDITING_OPTIONS::TransferDataToWindow()
bool PANEL_SYM_EDITING_OPTIONS::TransferDataFromWindow()
{
SYMBOL_EDITOR_SETTINGS* settings = m_frame->GetSettings();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* settings = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
settings->m_Defaults.line_width = Iu2Mils( (int) m_lineWidth.GetValue() );
settings->m_Defaults.text_size = Iu2Mils( (int) m_textSize.GetValue() );
@ -71,9 +69,7 @@ bool PANEL_SYM_EDITING_OPTIONS::TransferDataFromWindow()
settings->m_Defaults.pin_name_size = Iu2Mils( (int) m_pinNameSize.GetValue() );
settings->m_Repeat.label_delta = m_spinRepeatLabel->GetValue();
settings->m_Repeat.pin_step = m_choicePinDisplacement->GetSelection() == 1 ? 50 : 100;
m_frame->GetRenderSettings()->m_ShowPinsElectricalType = m_cbShowPinElectricalType->GetValue();
m_frame->GetCanvas()->Refresh();
settings->m_ShowPinElectricalType = m_cbShowPinElectricalType->GetValue();
return true;
}

View File

@ -23,20 +23,18 @@
#include <widgets/unit_binder.h>
#include "panel_sym_editing_options_base.h"
class SYMBOL_EDIT_FRAME;
class EDA_BASE_FRAME;
class PANEL_SYM_EDITING_OPTIONS : public PANEL_SYM_EDITING_OPTIONS_BASE
{
public:
PANEL_SYM_EDITING_OPTIONS( SYMBOL_EDIT_FRAME* aFrame, wxWindow* aWindow );
PANEL_SYM_EDITING_OPTIONS( wxWindow* aWindow, EDA_BASE_FRAME* aUnitsProvider );
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
SYMBOL_EDIT_FRAME* m_frame;
UNIT_BINDER m_lineWidth;
UNIT_BINDER m_textSize;

View File

@ -22,24 +22,53 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <eeschema_settings.h>
#include <widgets/wx_grid.h>
#include <template_fieldnames.h>
#include <grid_tricks.h>
#include <sch_edit_frame.h>
#include <bitmaps.h>
#include <schematic.h>
#include <panel_eeschema_template_fieldnames.h>
#include <kiface_base.h>
#include <macros.h>
#include <panel_template_fieldnames.h>
PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( SCH_EDIT_FRAME* aFrame,
wxWindow* aWindow,
bool aGlobal ) :
PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE( aWindow ),
m_frame( aFrame ),
m_global( aGlobal )
PANEL_TEMPLATE_FIELDNAMES::PANEL_TEMPLATE_FIELDNAMES( wxWindow* aWindow,
TEMPLATES* aProjectTemplateMgr ) :
PANEL_TEMPLATE_FIELDNAMES_BASE( aWindow )
{
m_title->SetLabel( aGlobal ? _( "Global field name templates:" )
: _( "Project field name templates:" ) );
if( aProjectTemplateMgr )
{
m_title->SetLabel( _( "Project field name templates:" ) );
m_global = false;
m_templateMgr = aProjectTemplateMgr;
}
else
{
m_title->SetLabel( _( "Global field name templates:" ) );
m_global = true;
m_templateMgr = &m_templateMgrInstance;
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
if( cfg )
{
// Read global fieldname templates
wxString templateFieldNames = cfg->m_Drawing.field_names;
if( !templateFieldNames.IsEmpty() )
{
TEMPLATE_FIELDNAMES_LEXER field_lexer( TO_UTF8( templateFieldNames ) );
try
{
m_templateMgr->Parse( &field_lexer, true );
}
catch( const IO_ERROR& )
{
}
}
}
}
m_addFieldButton->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
m_deleteFieldButton->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
@ -51,23 +80,22 @@ PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( SCH_EDIT
}
PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::~PANEL_EESCHEMA_TEMPLATE_FIELDNAMES()
PANEL_TEMPLATE_FIELDNAMES::~PANEL_TEMPLATE_FIELDNAMES()
{
// Delete the GRID_TRICKS.
m_grid->PopEventHandler( true );
}
bool PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataToWindow()
bool PANEL_TEMPLATE_FIELDNAMES::TransferDataToWindow()
{
SCHEMATIC& schematic = m_frame->Schematic();
m_fields = m_templateMgr->GetTemplateFieldNames( true );
m_fields = schematic.Settings().m_TemplateFieldNames.GetTemplateFieldNames( m_global );
return TransferDataToGrid();
}
void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::OnAddButtonClick( wxCommandEvent& event )
void PANEL_TEMPLATE_FIELDNAMES::OnAddButtonClick( wxCommandEvent& event )
{
if( !m_grid->CommitPendingChanges() )
return;
@ -86,7 +114,7 @@ void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::OnAddButtonClick( wxCommandEvent& event
}
void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::OnDeleteButtonClick( wxCommandEvent& event )
void PANEL_TEMPLATE_FIELDNAMES::OnDeleteButtonClick( wxCommandEvent& event )
{
if( !m_grid->CommitPendingChanges() )
return;
@ -113,7 +141,7 @@ void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::OnDeleteButtonClick( wxCommandEvent& ev
}
bool PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataToGrid()
bool PANEL_TEMPLATE_FIELDNAMES::TransferDataToGrid()
{
m_grid->Freeze();
@ -145,7 +173,7 @@ bool PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataToGrid()
}
bool PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataFromGrid()
bool PANEL_TEMPLATE_FIELDNAMES::TransferDataFromGrid()
{
if( !m_grid->CommitPendingChanges() )
return false;
@ -161,27 +189,25 @@ bool PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataFromGrid()
}
bool PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataFromWindow()
bool PANEL_TEMPLATE_FIELDNAMES::TransferDataFromWindow()
{
if( !TransferDataFromGrid() )
return false;
SCHEMATIC& schematic = m_frame->Schematic();
schematic.Settings().m_TemplateFieldNames.DeleteAllFieldNameTemplates( m_global );
m_templateMgr->DeleteAllFieldNameTemplates( m_global );
for( const TEMPLATE_FIELDNAME& field : m_fields )
schematic.Settings().m_TemplateFieldNames.AddTemplateFieldName( field, m_global );
m_templateMgr->AddTemplateFieldName( field, m_global );
if( m_global )
{
auto* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
if( cfg )
{
// Save global fieldname templates
STRING_FORMATTER sf;
schematic.Settings().m_TemplateFieldNames.Format( &sf, 0, true );
m_templateMgr->Format( &sf, 0, true );
wxString record = FROM_UTF8( sf.GetString().c_str() );
record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines
@ -195,7 +221,7 @@ bool PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataFromWindow()
}
void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::AdjustGridColumns( int aWidth )
void PANEL_TEMPLATE_FIELDNAMES::AdjustGridColumns( int aWidth )
{
if( aWidth <= 0 )
return;
@ -209,7 +235,7 @@ void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::AdjustGridColumns( int aWidth )
}
void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::OnSizeGrid( wxSizeEvent& event )
void PANEL_TEMPLATE_FIELDNAMES::OnSizeGrid( wxSizeEvent& event )
{
AdjustGridColumns( event.GetSize().GetX() );
@ -217,7 +243,7 @@ void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::OnSizeGrid( wxSizeEvent& event )
}
void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::ImportSettingsFrom( TEMPLATES* templateMgr )
void PANEL_TEMPLATE_FIELDNAMES::ImportSettingsFrom( TEMPLATES* templateMgr )
{
m_fields = templateMgr->GetTemplateFieldNames( m_global );
TransferDataToGrid();

View File

@ -21,16 +21,16 @@
#define PANEL_EESCHEMA_DEFUALT_FIELDS_H
#include <template_fieldnames.h>
#include "panel_eeschema_template_fieldnames_base.h"
#include "panel_template_fieldnames_base.h"
class SCH_EDIT_FRAME;
class PANEL_EESCHEMA_TEMPLATE_FIELDNAMES : public PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE
class PANEL_TEMPLATE_FIELDNAMES : public PANEL_TEMPLATE_FIELDNAMES_BASE
{
public:
PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow, bool aGlobal );
~PANEL_EESCHEMA_TEMPLATE_FIELDNAMES() override;
PANEL_TEMPLATE_FIELDNAMES( wxWindow* aWindow, TEMPLATES* aProjectTemplateMgr );
~PANEL_TEMPLATE_FIELDNAMES() override;
void ImportSettingsFrom( TEMPLATES* templateMgr );
@ -67,11 +67,12 @@ private:
bool TransferDataFromGrid();
protected:
SCH_EDIT_FRAME* m_frame;
TEMPLATES* m_templateMgr;
TEMPLATE_FIELDNAMES m_fields;
bool m_global; // Editing global (vs. project) fieldname templates
bool m_global; // Editing global (vs. project) fieldname templates
int m_checkboxColWidth;
TEMPLATES m_templateMgrInstance;
};

View File

@ -7,11 +7,11 @@
#include "widgets/wx_grid.h"
#include "panel_eeschema_template_fieldnames_base.h"
#include "panel_template_fieldnames_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
PANEL_TEMPLATE_FIELDNAMES_BASE::PANEL_TEMPLATE_FIELDNAMES_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
wxBoxSizer* bPanelSizer;
bPanelSizer = new wxBoxSizer( wxHORIZONTAL );
@ -85,16 +85,16 @@ PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE
bPanelSizer->Fit( this );
// Connect Events
m_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::OnSizeGrid ), NULL, this );
m_addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::OnAddButtonClick ), NULL, this );
m_deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::OnDeleteButtonClick ), NULL, this );
m_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_TEMPLATE_FIELDNAMES_BASE::OnSizeGrid ), NULL, this );
m_addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_TEMPLATE_FIELDNAMES_BASE::OnAddButtonClick ), NULL, this );
m_deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_TEMPLATE_FIELDNAMES_BASE::OnDeleteButtonClick ), NULL, this );
}
PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::~PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE()
PANEL_TEMPLATE_FIELDNAMES_BASE::~PANEL_TEMPLATE_FIELDNAMES_BASE()
{
// Disconnect Events
m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::OnSizeGrid ), NULL, this );
m_addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::OnAddButtonClick ), NULL, this );
m_deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::OnDeleteButtonClick ), NULL, this );
m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_TEMPLATE_FIELDNAMES_BASE::OnSizeGrid ), NULL, this );
m_addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_TEMPLATE_FIELDNAMES_BASE::OnAddButtonClick ), NULL, this );
m_deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_TEMPLATE_FIELDNAMES_BASE::OnDeleteButtonClick ), NULL, this );
}

View File

@ -11,12 +11,12 @@
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">panel_eeschema_template_fieldnames_base</property>
<property name="file">panel_template_fieldnames_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">PanelEeschemaTemplateFieldnames</property>
<property name="name">PanelTemplateFieldnames</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
@ -41,7 +41,7 @@
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE</property>
<property name="name">PANEL_TEMPLATE_FIELDNAMES_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="subclass">; forward_declare</property>

View File

@ -30,9 +30,9 @@ class WX_GRID;
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE
/// Class PANEL_TEMPLATE_FIELDNAMES_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE : public wxPanel
class PANEL_TEMPLATE_FIELDNAMES_BASE : public wxPanel
{
private:
@ -52,8 +52,8 @@ class PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE : public wxPanel
public:
PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE();
PANEL_TEMPLATE_FIELDNAMES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_TEMPLATE_FIELDNAMES_BASE();
};

View File

@ -39,6 +39,7 @@
#include <kiway.h>
#include <sim/sim_plot_frame.h>
#include <settings/settings_manager.h>
#include <symbol_editor_settings.h>
#include <sexpr/sexpr.h>
#include <sexpr/sexpr_parser.h>
#include <kiface_ids.h>
@ -48,6 +49,12 @@
#include <schematic.h>
#include <connection_graph.h>
#include <panel_template_fieldnames.h>
#include <panel_eeschema_color_settings.h>
#include <panel_sym_color_settings.h>
#include <panel_eeschema_editing_options.h>
#include <panel_sym_editing_options.h>
#include <dialogs/panel_gal_display_options.h>
// The main sheet of the project
SCH_SHEET* g_RootSheet = nullptr;
@ -167,6 +174,85 @@ static struct IFACE : public KIFACE_BASE
// Dialog has completed; nothing to return.
return nullptr;
case PANEL_SYM_DISPLAY_OPTIONS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
return new PANEL_GAL_DISPLAY_OPTIONS( aParent, cfg );
}
case PANEL_SYM_EDIT_OPTIONS:
{
EDA_BASE_FRAME* unitsProvider = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false );
if( !unitsProvider )
unitsProvider = aKiway->Player( FRAME_SCH_VIEWER, false );
if( !unitsProvider )
unitsProvider = aKiway->Player( FRAME_SCH, false );
if( !unitsProvider )
{
// If we can't find an eeschema unitsProvider we'll have to make do with the units
// defined in whatever FRAME we _can_ find.
for( unsigned i = 0; !unitsProvider && i < KIWAY_PLAYER_COUNT; ++i )
unitsProvider = aKiway->Player( (FRAME_T) i, false );
}
if( !unitsProvider )
{
wxWindow* manager = wxFindWindowByName( KICAD_MANAGER_FRAME_NAME );
unitsProvider = static_cast<EDA_BASE_FRAME*>( manager );
}
return new PANEL_SYM_EDITING_OPTIONS( aParent, unitsProvider );
}
case PANEL_SYM_COLORS:
return new PANEL_SYM_COLOR_SETTINGS( aParent );
case PANEL_SCH_DISPLAY_OPTIONS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
return new PANEL_GAL_DISPLAY_OPTIONS( aParent, cfg );
}
case PANEL_SCH_EDIT_OPTIONS:
{
EDA_BASE_FRAME* unitsProvider = aKiway->Player( FRAME_SCH, false );
if( !unitsProvider )
unitsProvider = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false );
if( !unitsProvider )
unitsProvider = aKiway->Player( FRAME_SCH_VIEWER, false );
if( !unitsProvider )
{
// If we can't find an eeschema frame we'll have to make do with the units
// defined in whatever FRAME we _can_ find.
for( unsigned i = 0; !unitsProvider && i < KIWAY_PLAYER_COUNT; ++i )
unitsProvider = aKiway->Player( (FRAME_T) i, false );
}
if( !unitsProvider )
{
wxWindow* manager = wxFindWindowByName( KICAD_MANAGER_FRAME_NAME );
unitsProvider = static_cast<EDA_BASE_FRAME*>( manager );
}
return new PANEL_EESCHEMA_EDITING_OPTIONS( aParent, unitsProvider );
}
case PANEL_SCH_COLORS:
return new PANEL_EESCHEMA_COLOR_SETTINGS( aParent );
case PANEL_SCH_FIELD_NAME_TEMPLATES:
return new PANEL_TEMPLATE_FIELDNAMES( aParent, nullptr );
default:
return nullptr;
}

View File

@ -25,17 +25,10 @@
#include <symbol_library.h>
#include <confirm.h>
#include <dialogs/panel_eeschema_color_settings.h>
#include <dialogs/panel_eeschema_display_options.h>
#include <dialogs/panel_eeschema_editing_options.h>
#include <dialogs/panel_eeschema_template_fieldnames.h>
#include <dialogs/panel_sym_color_settings.h>
#include <dialogs/panel_sym_editing_options.h>
#include <dialogs/dialog_schematic_setup.h>
#include <kiway.h>
#include <symbol_edit_frame.h>
#include <dialogs/panel_gal_display_options.h>
#include <panel_hotkeys_editor.h>
#include <pgm_base.h>
#include <project/project_file.h>
#include <project/net_settings.h>
@ -45,11 +38,9 @@
#include <settings/app_settings.h>
#include <settings/settings_manager.h>
#include <symbol_lib_table.h>
#include <widgets/paged_dialog.h>
#include <wildcards_and_files_ext.h>
#include <drawing_sheet/ds_data_model.h>
#include <zoom_defines.h>
#include <wx/treebook.h>
/// Helper for all the old plotting/printing code while it still exists
@ -59,22 +50,6 @@ COLOR4D GetLayerColor( SCH_LAYER_ID aLayer )
}
void SCH_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
{
wxTreebook* book = aParent->GetTreebook();
book->AddPage( new wxPanel( book ), _( "Schematic Editor" ) );
book->AddSubPage( new PANEL_EESCHEMA_DISPLAY_OPTIONS( this, book ), _( "Display Options" ) );
book->AddSubPage( new PANEL_EESCHEMA_EDITING_OPTIONS( this, book ), _( "Editing Options" ) );
book->AddSubPage( new PANEL_EESCHEMA_COLOR_SETTINGS( this, book ), _( "Colors" ) );
book->AddSubPage( new PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( this, book, true ),
_( "Field Name Templates" ) );
aHotkeysPanel->AddHotKeys( GetToolManager() );
}
bool SCH_EDIT_FRAME::LoadProjectSettings()
{
SCHEMATIC_SETTINGS& settings = Schematic().Settings();
@ -242,20 +217,6 @@ void SCH_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
}
void SYMBOL_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
{
wxTreebook* book = aParent->GetTreebook();
book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) );
book->AddSubPage( new PANEL_GAL_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
book->AddSubPage( new PANEL_SYM_EDITING_OPTIONS( this, book ), _( "Editing Options" ) );
book->AddSubPage( new PANEL_SYM_COLOR_SETTINGS( this, book ), _( "Colors" ) );
aHotkeysPanel->AddHotKeys( GetToolManager() );
}
static std::mutex s_symbolTableMutex;

View File

@ -418,11 +418,15 @@ void SCH_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
{
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
m_colorSettings = Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
COLOR_SETTINGS* colorSettings = GetColorSettings();
GetCanvas()->GetView()->GetPainter()->GetSettings()->LoadColors( colorSettings );
GetCanvas()->GetGAL()->SetAxesColor( colorSettings->GetColor( LAYER_SCHEMATIC_GRID_AXES ) );
GetCanvas()->GetGAL()->DrawGrid();
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
GetCanvas()->Refresh();
GetCanvas()->GetView()->RecacheAllItems();
GetCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
@ -430,9 +434,19 @@ COLOR_SETTINGS* SCH_BASE_FRAME::GetColorSettings() const
{
if( !m_colorSettings )
{
SETTINGS_MANAGER& settingsManager = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = settingsManager.GetAppSettings<EESCHEMA_SETTINGS>();
COLOR_SETTINGS* colorSettings = settingsManager.GetColorSettings( cfg->m_ColorTheme );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
wxString colorTheme = cfg->m_ColorTheme;
if( IsType( FRAME_SCH_SYMBOL_EDITOR ) )
{
SYMBOL_EDITOR_SETTINGS* symCfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
if( !symCfg->m_UseEeschemaColorSettings )
colorTheme = symCfg->m_ColorTheme;
}
COLOR_SETTINGS* colorSettings = mgr.GetColorSettings( colorTheme );
const_cast<SCH_BASE_FRAME*>( this )->m_colorSettings = colorSettings;
}

View File

@ -1475,6 +1475,15 @@ void SCH_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
ShowAllIntersheetRefs( settings.m_IntersheetRefsShow );
auto cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
GetRenderSettings()->m_ShowHiddenPins = cfg->m_Appearance.show_hidden_pins;
GetRenderSettings()->m_ShowHiddenText = cfg->m_Appearance.show_hidden_fields;
GetRenderSettings()->SetShowPageLimits( cfg->m_Appearance.show_page_limits );
GetCanvas()->ForceRefresh();
RecreateToolbars();
Layout();
SendSizeEvent();

View File

@ -784,11 +784,6 @@ public:
*/
void RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags );
/**
* Allow Eeschema to install its preferences panels into the preferences dialog.
*/
void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
/**
* Called after the preferences dialog is run.
*/

View File

@ -1102,8 +1102,14 @@ void SYMBOL_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextV
{
SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
GetCanvas()->GetGAL()->SetAxesColor( m_colorSettings->GetColor( LAYER_SCHEMATIC_GRID_AXES ) );
GetCanvas()->GetGAL()->DrawGrid();
SETTINGS_MANAGER* mgr = GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr->GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
GetRenderSettings()->m_ShowPinsElectricalType = cfg->m_ShowPinElectricalType;
GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
GetCanvas()->ForceRefresh();
RecreateToolbars();

View File

@ -310,11 +310,6 @@ public:
*/
void RefreshLibraryTree();
/**
* Allow the symbol editor to install its preferences panel into the preferences dialog.
*/
void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
/**
* Called after the preferences dialog is run.
*/

View File

@ -740,8 +740,12 @@ void SYMBOL_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTex
{
SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
auto cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
GetGalDisplayOptions().ReadWindowSettings( cfg->m_LibViewPanel.window );
GetCanvas()->GetGAL()->SetAxesColor( m_colorSettings->GetColor( LAYER_SCHEMATIC_GRID_AXES ) );
GetCanvas()->GetGAL()->DrawGrid();
GetCanvas()->ForceRefresh();
if( aEnvVarsChanged )
ReCreateLibList();

View File

@ -21,8 +21,6 @@ set( DIALOGS_SRCS
dialogs/panel_gerbview_display_options_base.cpp
dialogs/panel_gerbview_excellon_settings.cpp
dialogs/panel_gerbview_excellon_settings_base.cpp
dialogs/panel_gerbview_settings.cpp
dialogs/panel_gerbview_settings_base.cpp
dialogs/dialog_layers_select_to_pcb.cpp
dialogs/dialog_layers_select_to_pcb_base.cpp
dialogs/dialog_print_gerbview.cpp

View File

@ -18,22 +18,34 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gerbview.h>
#include <gerbview_frame.h>
#include <class_draw_panel_gal.h>
#include <view/view.h>
#include <gerbview_painter.h>
#include <gal/gal_display_options.h>
#include <vector>
#include <core/arraydim.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <gerbview_settings.h>
#include <widgets/gal_options_panel.h>
#include "panel_gerbview_display_options.h"
PANEL_GERBVIEW_DISPLAY_OPTIONS::PANEL_GERBVIEW_DISPLAY_OPTIONS( GERBVIEW_FRAME *aFrame,
wxWindow* aWindow ) :
PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE( aWindow, wxID_ANY ),
m_Parent( aFrame )
/// List of page sizes
static const wxChar* gerberPageSizeList[] =
{
m_galOptsPanel = new GAL_OPTIONS_PANEL( this, m_Parent );
wxT( "GERBER" ), // index 0: full size page selection
wxT( "A4" ),
wxT( "A3" ),
wxT( "A2" ),
wxT( "A" ),
wxT( "B" ),
wxT( "C" ),
};
PANEL_GERBVIEW_DISPLAY_OPTIONS::PANEL_GERBVIEW_DISPLAY_OPTIONS( wxWindow* aParent ) :
PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE( aParent, wxID_ANY )
{
GERBVIEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<GERBVIEW_SETTINGS>();
m_galOptsPanel = new GAL_OPTIONS_PANEL( this, cfg );
m_galOptionsSizer->Add( m_galOptsPanel, 0, wxEXPAND | wxLEFT, 5 );
}
@ -42,14 +54,26 @@ bool PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataToWindow( )
{
m_galOptsPanel->TransferDataToWindow();
// Show Option Draw Lines. We use DisplayPcbTrackFill as Lines draw option
m_OptDisplayLines->SetValue( !m_Parent->GetDisplayOptions().m_DisplayLinesFill );
m_OptDisplayFlashedItems->SetValue( !m_Parent->GetDisplayOptions().m_DisplayFlashedItemsFill );
GERBVIEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<GERBVIEW_SETTINGS>();
// Show Option Draw polygons
m_OptDisplayPolygons->SetValue( !m_Parent->GetDisplayOptions().m_DisplayPolygonsFill );
m_OptDisplayPolygons->SetValue( !cfg->m_Display.m_DisplayPolygonsFill );
m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( LAYER_DCODES ) );
// Show Option Draw Lines. We use DisplayPcbTrackFill as Lines draw option
m_OptDisplayLines->SetValue( !cfg->m_Display.m_DisplayLinesFill );
m_OptDisplayFlashedItems->SetValue( !cfg->m_Display.m_DisplayFlashedItemsFill );
m_OptDisplayDCodes->SetValue( cfg->m_Display.m_DisplayDCodes );
for( unsigned i = 0; i < arrayDim( gerberPageSizeList ); ++i )
{
if( gerberPageSizeList[i] == cfg->m_Appearance.page_type )
{
m_PageSize->SetSelection( i );
break;
}
}
m_ShowPageLimitsOpt->SetValue( cfg->m_Display.m_DisplayPageLimits );
return true;
}
@ -57,49 +81,17 @@ bool PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataToWindow( )
bool PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow()
{
GBR_DISPLAY_OPTIONS displayOptions = m_Parent->GetDisplayOptions();
bool needs_repaint = false, option;
option = !m_OptDisplayLines->GetValue();
if( option != displayOptions.m_DisplayLinesFill )
needs_repaint = true;
displayOptions.m_DisplayLinesFill = option;
option = !m_OptDisplayFlashedItems->GetValue();
if( option != m_Parent->GetDisplayOptions().m_DisplayFlashedItemsFill )
needs_repaint = true;
displayOptions.m_DisplayFlashedItemsFill = option;
option = !m_OptDisplayPolygons->GetValue();
if( option != displayOptions.m_DisplayPolygonsFill )
needs_repaint = true;
displayOptions.m_DisplayPolygonsFill = option;
m_Parent->SetElementVisibility( LAYER_DCODES, m_OptDisplayDCodes->GetValue() );
GERBVIEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<GERBVIEW_SETTINGS>();
m_galOptsPanel->TransferDataFromWindow();
if( displayOptions.m_DiffMode )
m_Parent->UpdateDiffLayers();
cfg->m_Display.m_DisplayLinesFill = !m_OptDisplayLines->GetValue();
cfg->m_Display.m_DisplayFlashedItemsFill = !m_OptDisplayFlashedItems->GetValue();
cfg->m_Display.m_DisplayPolygonsFill = !m_OptDisplayPolygons->GetValue();
cfg->m_Display.m_DisplayDCodes = m_OptDisplayDCodes->GetValue();
// Apply changes to the GAL
auto view = m_Parent->GetCanvas()->GetView();
auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( view->GetPainter() );
auto settings = painter->GetSettings();
settings->LoadDisplayOptions( displayOptions );
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
if( needs_repaint )
view->UpdateAllItems( KIGFX::REPAINT );
m_Parent->GetCanvas()->Refresh();
cfg->m_Appearance.page_type = gerberPageSizeList[ m_PageSize->GetSelection() ];
cfg->m_Display.m_DisplayPageLimits = m_ShowPageLimitsOpt->GetValue();
return true;
}

View File

@ -21,30 +21,28 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef KICAD_PANEL_GERBVIEW_DISPLAY_OPTIONS_H
#define KICAD_PANEL_GERBVIEW_DISPLAY_OPTIONS_H
#ifndef PANEL_GERBVIEW_DISPLAY_OPTIONS_H
#define PANEL_GERBVIEW_DISPLAY_OPTIONS_H
#include "panel_gerbview_display_options_base.h"
class GERBVIEW_FRAME;
class GAL_OPTIONS_PANEL;
class PANEL_GERBVIEW_DISPLAY_OPTIONS : public PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE
{
public:
PANEL_GERBVIEW_DISPLAY_OPTIONS( GERBVIEW_FRAME* aFrame, wxWindow* aWindow );
PANEL_GERBVIEW_DISPLAY_OPTIONS( wxWindow* aParent );
~PANEL_GERBVIEW_DISPLAY_OPTIONS() {};
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
GERBVIEW_FRAME* m_Parent;
GAL_OPTIONS_PANEL* m_galOptsPanel;
};
#endif //KICAD_PANEL_GERBVIEW_DISPLAY_OPTIONS_H
#endif // PANEL_GERBVIEW_DISPLAY_OPTIONS_H

View File

@ -24,30 +24,45 @@ PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE::PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE( wxWind
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Annotations") ), wxVERTICAL );
wxStaticBoxSizer* sbAnnotations;
sbAnnotations = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Annotations") ), wxVERTICAL );
m_OptDisplayDCodes = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Show D codes"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptDisplayDCodes = new wxCheckBox( sbAnnotations->GetStaticBox(), wxID_ANY, _("Show D codes"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptDisplayDCodes->SetValue(true);
sbSizer1->Add( m_OptDisplayDCodes, 0, wxBOTTOM|wxLEFT, 5 );
sbAnnotations->Add( m_OptDisplayDCodes, 0, wxBOTTOM|wxLEFT, 5 );
m_ShowPageLimitsOpt = new wxCheckBox( sbAnnotations->GetStaticBox(), wxID_ANY, _("Show page limits"), wxDefaultPosition, wxDefaultSize, 0 );
sbAnnotations->Add( m_ShowPageLimitsOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bRightSizer->Add( sbSizer1, 0, wxEXPAND|wxALL, 5 );
bRightSizer->Add( sbAnnotations, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Drawing Mode") ), wxVERTICAL );
wxStaticBoxSizer* sbDrawingMode;
sbDrawingMode = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Drawing Mode") ), wxVERTICAL );
m_OptDisplayFlashedItems = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Sketch flashed items"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_OptDisplayFlashedItems, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_OptDisplayFlashedItems = new wxCheckBox( sbDrawingMode->GetStaticBox(), wxID_ANY, _("Sketch flashed items"), wxDefaultPosition, wxDefaultSize, 0 );
sbDrawingMode->Add( m_OptDisplayFlashedItems, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_OptDisplayLines = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Sketch lines"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_OptDisplayLines, 0, wxALL, 5 );
m_OptDisplayLines = new wxCheckBox( sbDrawingMode->GetStaticBox(), wxID_ANY, _("Sketch lines"), wxDefaultPosition, wxDefaultSize, 0 );
sbDrawingMode->Add( m_OptDisplayLines, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_OptDisplayPolygons = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Sketch polygons"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_OptDisplayPolygons, 0, wxALL, 5 );
m_OptDisplayPolygons = new wxCheckBox( sbDrawingMode->GetStaticBox(), wxID_ANY, _("Sketch polygons"), wxDefaultPosition, wxDefaultSize, 0 );
sbDrawingMode->Add( m_OptDisplayPolygons, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bRightSizer->Add( sbSizer2, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bRightSizer->Add( sbDrawingMode, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bPageSize;
bPageSize = new wxBoxSizer( wxVERTICAL );
wxString m_PageSizeChoices[] = { _("Full size"), _("Size A4"), _("Size A3"), _("Size A2"), _("Size A"), _("Size B"), _("Size C") };
int m_PageSizeNChoices = sizeof( m_PageSizeChoices ) / sizeof( wxString );
m_PageSize = new wxRadioBox( this, wxID_ANY, _("Page Size"), wxDefaultPosition, wxDefaultSize, m_PageSizeNChoices, m_PageSizeChoices, 1, wxRA_SPECIFY_COLS );
m_PageSize->SetSelection( 0 );
bPageSize->Add( m_PageSize, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
bRightSizer->Add( bPageSize, 1, wxEXPAND, 5 );
m_UpperSizer->Add( bRightSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );

View File

@ -2,7 +2,7 @@
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration" />
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
@ -14,11 +14,12 @@
<property name="file">panel_gerbview_display_options_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">PanelGerbviewDisplayOptions</property>
<property name="namespace" />
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header" />
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
@ -29,57 +30,27 @@
<object class="Panel" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg" />
<property name="context_help" />
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg" />
<property name="font" />
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size" />
<property name="minimum_size" />
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE</property>
<property name="pos" />
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="subclass">; forward_declare</property>
<property name="tooltip" />
<property name="window_extra_style" />
<property name="window_name" />
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnAuiFindManager" />
<event name="OnAuiPaneButton" />
<event name="OnAuiPaneClose" />
<event name="OnAuiPaneMaximize" />
<event name="OnAuiPaneRestore" />
<event name="OnAuiRender" />
<event name="OnChar" />
<event name="OnEnterWindow" />
<event name="OnEraseBackground" />
<event name="OnInitDialog" />
<event name="OnKeyDown" />
<event name="OnKeyUp" />
<event name="OnKillFocus" />
<event name="OnLeaveWindow" />
<event name="OnLeftDClick" />
<event name="OnLeftDown" />
<event name="OnLeftUp" />
<event name="OnMiddleDClick" />
<event name="OnMiddleDown" />
<event name="OnMiddleUp" />
<event name="OnMotion" />
<event name="OnMouseEvents" />
<event name="OnMouseWheel" />
<event name="OnPaint" />
<event name="OnRightDClick" />
<event name="OnRightDown" />
<event name="OnRightUp" />
<event name="OnSetFocus" />
<event name="OnSize" />
<event name="OnUpdateUI" />
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size" />
<property name="minimum_size"></property>
<property name="name">bDialogSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
@ -88,7 +59,7 @@
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size" />
<property name="minimum_size"></property>
<property name="name">m_UpperSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">protected</property>
@ -97,7 +68,7 @@
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size" />
<property name="minimum_size"></property>
<property name="name">m_galOptionsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
@ -108,7 +79,7 @@
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size" />
<property name="minimum_size"></property>
<property name="name">bRightSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
@ -119,12 +90,11 @@
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Annotations</property>
<property name="minimum_size" />
<property name="name">sbSizer1</property>
<property name="minimum_size"></property>
<property name="name">sbAnnotations</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI" />
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT</property>
@ -134,83 +104,123 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer" />
<property name="aui_name" />
<property name="aui_position" />
<property name="aui_row" />
<property name="best_size" />
<property name="bg" />
<property name="caption" />
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">1</property>
<property name="close_button">1</property>
<property name="context_help" />
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg" />
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font" />
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show D codes</property>
<property name="max_size" />
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size" />
<property name="min_size" />
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size" />
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_OptDisplayDCodes</property>
<property name="pane_border">1</property>
<property name="pane_position" />
<property name="pane_size" />
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos" />
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size" />
<property name="style" />
<property name="subclass" />
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip" />
<property name="validator_data_type" />
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable" />
<property name="window_extra_style" />
<property name="window_name" />
<property name="window_style" />
<event name="OnChar" />
<event name="OnCheckBox" />
<event name="OnEnterWindow" />
<event name="OnEraseBackground" />
<event name="OnKeyDown" />
<event name="OnKeyUp" />
<event name="OnKillFocus" />
<event name="OnLeaveWindow" />
<event name="OnLeftDClick" />
<event name="OnLeftDown" />
<event name="OnLeftUp" />
<event name="OnMiddleDClick" />
<event name="OnMiddleDown" />
<event name="OnMiddleUp" />
<event name="OnMotion" />
<event name="OnMouseEvents" />
<event name="OnMouseWheel" />
<event name="OnPaint" />
<event name="OnRightDClick" />
<event name="OnRightDown" />
<event name="OnRightUp" />
<event name="OnSetFocus" />
<event name="OnSize" />
<event name="OnUpdateUI" />
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show page limits</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_ShowPageLimitsOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
@ -222,12 +232,11 @@
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Drawing Mode</property>
<property name="minimum_size" />
<property name="name">sbSizer2</property>
<property name="minimum_size"></property>
<property name="name">sbDrawingMode</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI" />
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
@ -237,259 +246,264 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer" />
<property name="aui_name" />
<property name="aui_position" />
<property name="aui_row" />
<property name="best_size" />
<property name="bg" />
<property name="caption" />
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help" />
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg" />
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font" />
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Sketch flashed items</property>
<property name="max_size" />
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size" />
<property name="min_size" />
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size" />
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_OptDisplayFlashedItems</property>
<property name="pane_border">1</property>
<property name="pane_position" />
<property name="pane_size" />
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos" />
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size" />
<property name="style" />
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip" />
<property name="validator_data_type" />
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable" />
<property name="window_extra_style" />
<property name="window_name" />
<property name="window_style" />
<event name="OnChar" />
<event name="OnCheckBox" />
<event name="OnEnterWindow" />
<event name="OnEraseBackground" />
<event name="OnKeyDown" />
<event name="OnKeyUp" />
<event name="OnKillFocus" />
<event name="OnLeaveWindow" />
<event name="OnLeftDClick" />
<event name="OnLeftDown" />
<event name="OnLeftUp" />
<event name="OnMiddleDClick" />
<event name="OnMiddleDown" />
<event name="OnMiddleUp" />
<event name="OnMotion" />
<event name="OnMouseEvents" />
<event name="OnMouseWheel" />
<event name="OnPaint" />
<event name="OnRightDClick" />
<event name="OnRightDown" />
<event name="OnRightUp" />
<event name="OnSetFocus" />
<event name="OnSize" />
<event name="OnUpdateUI" />
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer" />
<property name="aui_name" />
<property name="aui_position" />
<property name="aui_row" />
<property name="best_size" />
<property name="bg" />
<property name="caption" />
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help" />
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg" />
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font" />
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Sketch lines</property>
<property name="max_size" />
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size" />
<property name="min_size" />
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size" />
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_OptDisplayLines</property>
<property name="pane_border">1</property>
<property name="pane_position" />
<property name="pane_size" />
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos" />
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size" />
<property name="style" />
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip" />
<property name="validator_data_type" />
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable" />
<property name="window_extra_style" />
<property name="window_name" />
<property name="window_style" />
<event name="OnChar" />
<event name="OnCheckBox" />
<event name="OnEnterWindow" />
<event name="OnEraseBackground" />
<event name="OnKeyDown" />
<event name="OnKeyUp" />
<event name="OnKillFocus" />
<event name="OnLeaveWindow" />
<event name="OnLeftDClick" />
<event name="OnLeftDown" />
<event name="OnLeftUp" />
<event name="OnMiddleDClick" />
<event name="OnMiddleDown" />
<event name="OnMiddleUp" />
<event name="OnMotion" />
<event name="OnMouseEvents" />
<event name="OnMouseWheel" />
<event name="OnPaint" />
<event name="OnRightDClick" />
<event name="OnRightDown" />
<event name="OnRightUp" />
<event name="OnSetFocus" />
<event name="OnSize" />
<event name="OnUpdateUI" />
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer" />
<property name="aui_name" />
<property name="aui_position" />
<property name="aui_row" />
<property name="best_size" />
<property name="bg" />
<property name="caption" />
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help" />
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg" />
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font" />
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Sketch polygons</property>
<property name="max_size" />
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size" />
<property name="min_size" />
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size" />
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_OptDisplayPolygons</property>
<property name="pane_border">1</property>
<property name="pane_position" />
<property name="pane_size" />
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos" />
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size" />
<property name="style" />
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip" />
<property name="validator_data_type" />
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable" />
<property name="window_extra_style" />
<property name="window_name" />
<property name="window_style" />
<event name="OnChar" />
<event name="OnCheckBox" />
<event name="OnEnterWindow" />
<event name="OnEraseBackground" />
<event name="OnKeyDown" />
<event name="OnKeyUp" />
<event name="OnKillFocus" />
<event name="OnLeaveWindow" />
<event name="OnLeftDClick" />
<event name="OnLeftDown" />
<event name="OnLeftUp" />
<event name="OnMiddleDClick" />
<event name="OnMiddleDown" />
<event name="OnMiddleUp" />
<event name="OnMotion" />
<event name="OnMouseEvents" />
<event name="OnMouseWheel" />
<event name="OnPaint" />
<event name="OnRightDClick" />
<event name="OnRightDown" />
<event name="OnRightUp" />
<event name="OnSetFocus" />
<event name="OnSize" />
<event name="OnUpdateUI" />
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bPageSize</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Full size&quot; &quot;Size A4&quot; &quot;Size A3&quot; &quot;Size A2&quot; &quot;Size A&quot; &quot;Size B&quot; &quot;Size C&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Page Size</property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_PageSize</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>

View File

@ -18,6 +18,7 @@
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
@ -34,9 +35,11 @@ class PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE : public wxPanel
wxBoxSizer* m_UpperSizer;
wxBoxSizer* m_galOptionsSizer;
wxCheckBox* m_OptDisplayDCodes;
wxCheckBox* m_ShowPageLimitsOpt;
wxCheckBox* m_OptDisplayFlashedItems;
wxCheckBox* m_OptDisplayLines;
wxCheckBox* m_OptDisplayPolygons;
wxRadioBox* m_PageSize;
public:

View File

@ -18,26 +18,23 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gerbview.h>
#include <gerbview_frame.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <gerbview_settings.h>
#include "panel_gerbview_excellon_settings.h"
#include <widgets/paged_dialog.h>
PANEL_GERBVIEW_EXCELLON_SETTINGS::PANEL_GERBVIEW_EXCELLON_SETTINGS(
GERBVIEW_FRAME *aFrame, wxWindow* aWindow ) :
PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE( aWindow, wxID_ANY ),
m_Parent( aFrame )
PANEL_GERBVIEW_EXCELLON_SETTINGS::PANEL_GERBVIEW_EXCELLON_SETTINGS( wxWindow* aParent ) :
PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE( aParent, wxID_ANY )
{
}
bool PANEL_GERBVIEW_EXCELLON_SETTINGS::TransferDataToWindow( )
{
GERBVIEW_SETTINGS* config = static_cast<GERBVIEW_SETTINGS*>( m_Parent->config() );
EXCELLON_DEFAULTS curr_settings;
GERBVIEW_SETTINGS* config = Pgm().GetSettingsManager().GetAppSettings<GERBVIEW_SETTINGS>();
EXCELLON_DEFAULTS curr_settings;
config->GetExcellonDefaults( curr_settings );
applySettingsToPanel( curr_settings );
@ -48,7 +45,7 @@ bool PANEL_GERBVIEW_EXCELLON_SETTINGS::TransferDataToWindow( )
bool PANEL_GERBVIEW_EXCELLON_SETTINGS::TransferDataFromWindow()
{
GERBVIEW_SETTINGS* config = static_cast<GERBVIEW_SETTINGS*>( m_Parent->config() );
GERBVIEW_SETTINGS* config = Pgm().GetSettingsManager().GetAppSettings<GERBVIEW_SETTINGS>();
config->m_ExcellonDefaults.m_UnitsMM = m_rbUnits->GetSelection() != 0;
config->m_ExcellonDefaults.m_LeadingZero = m_rbZeroFormat->GetSelection();

View File

@ -26,15 +26,13 @@
#include "panel_gerbview_excellon_settings_base.h"
class GERBVIEW_FRAME;
class GAL_OPTIONS_PANEL;
struct EXCELLON_DEFAULTS;
class PANEL_GERBVIEW_EXCELLON_SETTINGS : public PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE
{
public:
PANEL_GERBVIEW_EXCELLON_SETTINGS( GERBVIEW_FRAME* aFrame, wxWindow* aWindow );
PANEL_GERBVIEW_EXCELLON_SETTINGS( wxWindow* aParent );
~PANEL_GERBVIEW_EXCELLON_SETTINGS() {};
private:
@ -43,7 +41,5 @@ private:
void ResetPanel() override;
void applySettingsToPanel( const EXCELLON_DEFAULTS& aSettings );
GERBVIEW_FRAME* m_Parent;
};

View File

@ -1,77 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2018 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 <gerbview.h>
#include <gerbview_frame.h>
#include <core/arraydim.h>
#include "panel_gerbview_settings.h"
/// List of page sizes
static const wxChar* gerberPageSizeList[] =
{
wxT( "GERBER" ), // index 0: full size page selection
wxT( "A4" ),
wxT( "A3" ),
wxT( "A2" ),
wxT( "A" ),
wxT( "B" ),
wxT( "C" ),
};
PANEL_GERBVIEW_SETTINGS::PANEL_GERBVIEW_SETTINGS( GERBVIEW_FRAME *aFrame, wxWindow* aWindow ) :
PANEL_GERBVIEW_SETTINGS_BASE( aWindow, wxID_ANY ),
m_Parent( aFrame )
{
}
bool PANEL_GERBVIEW_SETTINGS::TransferDataToWindow( )
{
m_ShowPageLimitsOpt->SetValue( m_Parent->GetDisplayOptions().m_DisplayPageLimits );
for( unsigned i = 0; i < arrayDim( gerberPageSizeList ); ++i )
{
if( gerberPageSizeList[i] == m_Parent->GetPageSettings().GetType() )
{
m_PageSize->SetSelection( i );
break;
}
}
return true;
}
bool PANEL_GERBVIEW_SETTINGS::TransferDataFromWindow()
{
auto opts = m_Parent->GetDisplayOptions();
opts.m_DisplayPageLimits = m_ShowPageLimitsOpt->GetValue();
PAGE_INFO pageInfo( gerberPageSizeList[ m_PageSize->GetSelection() ] );
m_Parent->SetPageSettings( pageInfo );
m_Parent->UpdateDisplayOptions( opts );
return true;
}

View File

@ -1,45 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018-2021 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,
* 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, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef KICAD_PANEL_GERBVIEW_SETTINGS_H
#define KICAD_PANEL_GERBVIEW_SETTINGS_H
#include "panel_gerbview_settings_base.h"
class GERBVIEW_FRAME;
class PANEL_GERBVIEW_SETTINGS : public PANEL_GERBVIEW_SETTINGS_BASE
{
public:
PANEL_GERBVIEW_SETTINGS( GERBVIEW_FRAME* aFrame, wxWindow* aWindow );
~PANEL_GERBVIEW_SETTINGS() {};
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
GERBVIEW_FRAME* m_Parent;
};
#endif //KICAD_PANEL_GERBVIEW_SETTINGS_H

View File

@ -1,45 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "panel_gerbview_settings_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_GERBVIEW_SETTINGS_BASE::PANEL_GERBVIEW_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
wxBoxSizer* bDialogSizer;
bDialogSizer = new wxBoxSizer( wxVERTICAL );
m_UpperSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL );
wxString m_PageSizeChoices[] = { _("Full size"), _("Size A4"), _("Size A3"), _("Size A2"), _("Size A"), _("Size B"), _("Size C") };
int m_PageSizeNChoices = sizeof( m_PageSizeChoices ) / sizeof( wxString );
m_PageSize = new wxRadioBox( this, wxID_ANY, _("Page Size"), wxDefaultPosition, wxDefaultSize, m_PageSizeNChoices, m_PageSizeChoices, 1, wxRA_SPECIFY_COLS );
m_PageSize->SetSelection( 0 );
bLeftSizer->Add( m_PageSize, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
m_ShowPageLimitsOpt = new wxCheckBox( this, wxID_ANY, _("Show page limits"), wxDefaultPosition, wxDefaultSize, 0 );
bLeftSizer->Add( m_ShowPageLimitsOpt, 0, wxALL, 10 );
m_UpperSizer->Add( bLeftSizer, 0, wxEXPAND|wxRIGHT, 5 );
bDialogSizer->Add( m_UpperSizer, 0, wxEXPAND|wxRIGHT, 5 );
this->SetSizer( bDialogSizer );
this->Layout();
bDialogSizer->Fit( this );
}
PANEL_GERBVIEW_SETTINGS_BASE::~PANEL_GERBVIEW_SETTINGS_BASE()
{
}

View File

@ -1,212 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">panel_gerbview_settings_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">PanelGerbviewSettings</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">PANEL_GERBVIEW_SETTINGS_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="subclass">; forward_declare</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bDialogSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_UpperSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bLeftSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Full size&quot; &quot;Size A4&quot; &quot;Size A3&quot; &quot;Size A2&quot; &quot;Size A&quot; &quot;Size B&quot; &quot;Size C&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Page Size</property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_PageSize</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show page limits</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_ShowPageLimitsOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -1,44 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_GERBVIEW_SETTINGS_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_GERBVIEW_SETTINGS_BASE : public wxPanel
{
private:
protected:
wxBoxSizer* m_UpperSizer;
wxRadioBox* m_PageSize;
wxCheckBox* m_ShowPageLimitsOpt;
public:
PANEL_GERBVIEW_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_GERBVIEW_SETTINGS_BASE();
};

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012-2016 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see change_log.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
@ -22,14 +22,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file gbr_display_options.h
* @brief Class GBR_DISPLAY_OPTIONS is a helper class to handle display options
* (filling modes and afew other options
*/
#ifndef GBR_DISPLAY_OPTIONS_H
#define GBR_DISPLAY_OPTIONS_H
#ifndef CLASS_GBR_DISPLAY_OPTIONS_H
#define CLASS_GBR_DISPLAY_OPTIONS_H
using KIGFX::COLOR4D;
/**
* @note Some of these parameters are used only for printing, some others only
@ -74,4 +70,4 @@ public:
}
};
#endif // #ifndef CLASS_GBR_DISPLAY_OPTIONS_H
#endif // GBR_DISPLAY_OPTIONS_H

View File

@ -35,6 +35,8 @@
#include <nlohmann/json.hpp>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <dialogs/panel_gerbview_display_options.h>
#include <dialogs/panel_gerbview_excellon_settings.h>
#include <wildcards_and_files_ext.h>
#include <wx/ffile.h>
@ -61,11 +63,13 @@ static struct IFACE : public KIFACE_BASE
switch( aClassId )
{
case FRAME_GERBER:
{
GERBVIEW_FRAME* frame = new GERBVIEW_FRAME( aKiway, aParent );
return frame;
}
break;
return new GERBVIEW_FRAME( aKiway, aParent );
case PANEL_GBR_DISPLAY_OPTIONS:
return new PANEL_GERBVIEW_DISPLAY_OPTIONS( aParent );
case PANEL_GBR_EXCELLON_OPTIONS:
return new PANEL_GERBVIEW_EXCELLON_SETTINGS( aParent );
default:
;

View File

@ -33,7 +33,6 @@
#include <gerbview_settings.h>
#include <gal/graphics_abstraction_layer.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <settings/common_settings.h>
#include <settings/settings_manager.h>
#include <tool/tool_manager.h>
#include <tool/action_toolbar.h>
@ -52,13 +51,7 @@
#include <base_screen.h>
#include <gerbview_painter.h>
#include <widgets/msgpanel.h>
#include <widgets/paged_dialog.h>
#include <dialogs/panel_gerbview_settings.h>
#include <dialogs/panel_gerbview_display_options.h>
#include <dialogs/panel_gerbview_excellon_settings.h>
#include <panel_hotkeys_editor.h>
#include <wx/wupdlock.h>
#include <wx/treebook.h>
#include "widgets/gbr_layer_box_selector.h"
#include "widgets/gerbview_layer_widget.h"
@ -1051,23 +1044,6 @@ void GERBVIEW_FRAME::ActivateGalCanvas()
}
void GERBVIEW_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
{
wxTreebook* book = aParent->GetTreebook();
book->AddPage( new wxPanel( book ), _( "GerbView" ) );
book->AddSubPage( new PANEL_GERBVIEW_DISPLAY_OPTIONS( this, book ),
_( "Display Options" ) );
book->AddSubPage( new PANEL_GERBVIEW_SETTINGS( this, book ), _( "Editing Options" ) );
book->AddSubPage( new PANEL_GERBVIEW_EXCELLON_SETTINGS( this, book ),
_( "Excellon Options" ) );
aHotkeysPanel->AddHotKeys( GetToolManager() );
}
void GERBVIEW_FRAME::setupTools()
{
// Create the manager and dispatcher & route draw panel events to the dispatcher
@ -1196,6 +1172,23 @@ void GERBVIEW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
{
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
GERBVIEW_SETTINGS* cfg = static_cast<GERBVIEW_SETTINGS*>( config() );
SetPageSettings( PAGE_INFO( cfg->m_Appearance.page_type ) );
if( cfg->m_Display.m_DiffMode )
UpdateDiffLayers();
// Apply changes to the GAL
auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( GetCanvas()->GetView()->GetPainter() );
auto settings = painter->GetSettings();
settings->LoadDisplayOptions( GetDisplayOptions() );
SetElementVisibility( LAYER_DCODES, GetDisplayOptions().m_DisplayDCodes );
GetCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT );
GetCanvas()->ForceRefresh();
RecreateToolbars();
Layout();
SendSizeEvent();

View File

@ -382,11 +382,6 @@ public:
///< @copydoc EDA_DRAW_FRAME::ActivateGalCanvas
void ActivateGalCanvas() override;
/**
* Allow Gerbview to install its preferences panels into the preferences dialog.
*/
void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
/**
* Called after the preferences dialog is run.
*/

View File

@ -26,7 +26,7 @@
#include <settings/app_settings.h>
#include <excellon_defaults.h>
#include <gbr_display_options.h>
class GERBVIEW_SETTINGS : public APP_SETTINGS_BASE
{
@ -58,6 +58,8 @@ public:
APPEARANCE m_Appearance;
GBR_DISPLAY_OPTIONS m_Display;
int m_BoardLayersCount;
std::vector<wxString> m_DrillFileHistory;

View File

@ -32,7 +32,6 @@
#include <dialog_shim.h>
class TOOL_MANAGER;
class PANEL_HOTKEYS_EDITOR;
@ -48,7 +47,7 @@ public:
*
* @param aParent the parent frame
*/
DIALOG_LIST_HOTKEYS( EDA_BASE_FRAME* aParent, TOOL_MANAGER* aToolManager );
DIALOG_LIST_HOTKEYS( EDA_BASE_FRAME* aParent );
protected:

View File

@ -62,6 +62,7 @@ protected:
void OnColorChanged( wxCommandEvent& aEvent );
virtual void createSwatches() = 0;
void updateSwatches();
/**

View File

@ -24,19 +24,17 @@
#include <wx/panel.h>
class GAL_OPTIONS_PANEL;
class EDA_DRAW_FRAME;
class PAGED_DIALOG;
class PANEL_GAL_DISPLAY_OPTIONS : public wxPanel
{
public:
PANEL_GAL_DISPLAY_OPTIONS( EDA_DRAW_FRAME* aFrame, PAGED_DIALOG* aParent );
PANEL_GAL_DISPLAY_OPTIONS( wxWindow* aParent, APP_SETTINGS_BASE* aAppSettings );
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
EDA_DRAW_FRAME* m_frame;
GAL_OPTIONS_PANEL* m_galOptsPanel;
};

View File

@ -44,6 +44,7 @@
#include <widgets/infobar.h>
#include <undo_redo_container.h>
#include <eda_units.h>
#include <origin_transforms.h>
// Option for main frames
#define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
@ -137,6 +138,12 @@ public:
virtual void ToggleUserUnits() { }
/**
* Return a reference to the default ORIGIN_TRANSFORMS object
*/
virtual ORIGIN_TRANSFORMS& GetOriginTransforms() { return m_originTransforms; }
SETTINGS_MANAGER* GetSettingsManager() const { return m_settingsManager; }
virtual SEVERITY GetSeverity( int aErrorCode ) const { return RPT_SEVERITY_UNDEFINED; }
@ -290,14 +297,6 @@ public:
*/
virtual APP_SETTINGS_BASE* config() const;
/**
* Allow a frame to load its preference panels (if any) into the preferences dialog.
*
* @param aParent a paged dialog into which the preference panels should be installed.
*/
virtual void InstallPreferences( PAGED_DIALOG* , PANEL_HOTKEYS_EDITOR* ) { }
void LoadWindowState( const wxString& aFileName );
/**
* Load window settings from the given settings object.
@ -720,14 +719,15 @@ private:
int m_autoSaveInterval; // The auto save interval time in seconds.
wxTimer* m_autoSaveTimer;
int m_undoRedoCountMax; // undo/Redo command Max depth
int m_undoRedoCountMax; // undo/Redo command Max depth
UNDO_REDO_CONTAINER m_undoList; // Objects list for the undo command (old data)
UNDO_REDO_CONTAINER m_redoList; // Objects list for the redo command (old data)
wxString m_mruPath; // Most recently used path.
wxString m_mruPath; // Most recently used path.
EDA_UNITS m_userUnits;
EDA_UNITS m_userUnits;
ORIGIN_TRANSFORMS m_originTransforms; // Default display origin transforms object.
///< Map containing the UI update handlers registered with wx for each action.
std::map<int, UIUpdateHandler> m_uiUpdateMap;
@ -738,7 +738,6 @@ private:
///< Set by #NonUserClose() to indicate that the user did not request the current close.
bool m_isNonUserClose;
};

View File

@ -31,7 +31,6 @@
#include <gal/gal_display_options.h>
#include <gal/color4d.h>
#include <class_draw_panel_gal.h>
#include <origin_transforms.h>
#include <kiid.h>
#include "hotkeys_basic.h"
@ -158,13 +157,6 @@ public:
*/
wxPoint GetNearestHalfGridPosition( const wxPoint& aPosition ) const;
/**
* Return a reference to the default ORIGIN_TRANSFORMS object
*/
virtual ORIGIN_TRANSFORMS& GetOriginTransforms()
{ return m_originTransforms; }
virtual const TITLE_BLOCK& GetTitleBlock() const = 0;
virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
@ -531,9 +523,6 @@ private:
///< This the frame's interface to setting GAL display options.
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions;
///< Default display origin transforms object.
ORIGIN_TRANSFORMS m_originTransforms;
};
#endif // DRAW_FRAME_H_

View File

@ -65,6 +65,8 @@ public:
bool m_PolarCoords;
int m_RotationAngle;
bool m_Use45Limit;
int m_LibWidth;

View File

@ -65,8 +65,40 @@ enum FRAME_T
FRAME_T_COUNT,
PANEL_SYM_DISPLAY_OPTIONS = FRAME_T_COUNT,
PANEL_SYM_EDIT_OPTIONS,
PANEL_SYM_COLORS,
PANEL_SCH_DISPLAY_OPTIONS,
PANEL_SCH_EDIT_OPTIONS,
PANEL_SCH_COLORS,
PANEL_SCH_FIELD_NAME_TEMPLATES,
PANEL_FP_DISPLAY_OPTIONS,
PANEL_FP_EDIT_OPTIONS,
PANEL_FP_COLORS,
PANEL_FP_DEFAULT_VALUES,
PANEL_PCB_DISPLAY_OPTIONS,
PANEL_PCB_EDIT_OPTIONS,
PANEL_PCB_COLORS,
PANEL_PCB_ACTION_PLUGINS,
PANEL_PCB_ORIGINS_AXES,
PANEL_3DV_DISPLAY_OPTIONS,
PANEL_3DV_OPENGL,
PANEL_3DV_RAYTRACING,
PANEL_3DV_COLORS,
PANEL_GBR_DISPLAY_OPTIONS,
PANEL_GBR_EDIT_OPTIONS,
PANEL_GBR_EXCELLON_OPTIONS,
PANEL_DS_DISPLAY_OPTIONS,
PANEL_DS_COLORS,
// Library table dialogs are transient and are never returned
DIALOG_CONFIGUREPATHS = FRAME_T_COUNT,
DIALOG_CONFIGUREPATHS,
DIALOG_SCH_LIBRARY_TABLE,
DIALOG_PCB_LIBRARY_TABLE
};

View File

@ -70,7 +70,7 @@ public:
*/
HOTKEY_STORE();
void Init( std::vector<TOOL_MANAGER*> aToolManagerList, bool aIncludeReadOnlyCmds );
void Init( std::vector<TOOL_ACTION*> aActionsList, bool aIncludeReadOnlyCmds );
static wxString GetAppName( TOOL_ACTION* aAction );
static wxString GetSectionName( TOOL_ACTION* aAction );

View File

@ -93,7 +93,7 @@ wxString AddHotkeyName( const wxString& aText, int aHotKey,
* @param aToolMgr the tool manager holding the registered actions from which the hotkeys
* will be harvested.
*/
void DisplayHotkeyList( EDA_BASE_FRAME* aFrame, TOOL_MANAGER* aToolMgr );
void DisplayHotkeyList( EDA_BASE_FRAME* aFrame );
/**
* Reads a hotkey config file into a map.
@ -105,7 +105,7 @@ void ReadHotKeyConfig( const wxString& aFileName, std::map<std::string, int>& aH
/**
* Update the hotkeys config file with the hotkeys from the given actions map.
*/
int WriteHotKeyConfig( const std::map<std::string, TOOL_ACTION*>& aActionMap );
int WriteHotKeyConfig( const std::vector<TOOL_ACTION*>& aActions );
/**
* Read hotkey configuration for a given app.

View File

@ -26,6 +26,7 @@
#include <kiway.h>
#include <bin_mod.h>
#include <tool/action_manager.h>
/**
@ -112,6 +113,12 @@ public:
/// (The library search path is in the PROJECT class.)
SEARCH_STACK& KifaceSearch() { return m_bm.m_search; }
void GetActions( std::vector<TOOL_ACTION*>& aActions ) const override
{
for( TOOL_ACTION* action : ACTION_MANAGER::GetActionList() )
aActions.push_back( action );
}
private:
KIWAY::FACE_T m_id;

View File

@ -52,8 +52,6 @@ enum KIFACE_ADDR_ID : int
*/
KIFACE_GLOBAL_FOOTPRINT_TABLE,
KIFACE_NEW_DRC_ENGINE,
KIFACE_LOAD_PCB,
KIFACE_LOAD_SCHEMATIC,
KIFACE_NETLIST_SCHEMATIC,
KIFACE_SCRIPTING_LEGACY,

View File

@ -131,6 +131,7 @@ class PGM_BASE;
class KIWAY;
class KIWAY_PLAYER;
class wxTopLevelWindow;
class TOOL_ACTION;
/**
@ -227,6 +228,11 @@ struct KIFACE
* @return the requested object which must be cast into the known type.
*/
virtual void* IfaceOrAddress( int aDataId ) = 0;
/**
* Append this Kiface's registered actions to the given list.
*/
virtual void GetActions( std::vector<TOOL_ACTION*>& aActions ) const = 0;
};
@ -349,6 +355,11 @@ public:
virtual void ExpressMail( FRAME_T aDestination, MAIL_T aCommand, std::string& aPayload,
wxWindow* aSource = nullptr );
/**
* Append all registered actions to the given list.
*/
virtual void GetActions( std::vector<TOOL_ACTION*>& aActions ) const;
/**
* Return the #PROJECT associated with this KIWAY.
*

View File

@ -43,7 +43,7 @@ class PANEL_HOTKEYS_EDITOR : public RESETTABLE_PANEL
public:
PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aWindow, bool aReadOnly );
void AddHotKeys( TOOL_MANAGER* aToolMgr );
std::vector<TOOL_ACTION*>& ActionsList() { return m_actions; }
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
@ -55,6 +55,8 @@ public:
return _( "Reset all hotkeys to the built-in KiCad defaults" );
}
bool Show( bool show ) override;
private:
/**
* Install the button panel (global reset/default, import/export)
@ -87,7 +89,7 @@ protected:
EDA_BASE_FRAME* m_frame;
bool m_readOnly;
std::vector<TOOL_MANAGER*> m_toolManagers;
std::vector<TOOL_ACTION*> m_actions;
HOTKEY_STORE m_hotkeyStore;
WIDGET_HOTKEY_LIST* m_hotkeyListCtrl;
};

View File

@ -178,8 +178,6 @@ public:
return RunAction( aAction, aNow, (void*) NULL );
}
const std::map<std::string, TOOL_ACTION*>& GetActions() const;
/**
* Send a cancel event to the tool currently at the top of the tool stack.
*/

View File

@ -31,14 +31,17 @@
class wxBoxSizer;
class wxRadioBox;
class wxSpinCtrlDouble;
class wxChoice;
class wxCheckBox;
class wxStaticText;
class EDA_DRAW_FRAME;
class APP_SETTINGS_BASE;
class GAL_OPTIONS_PANEL: public wxPanel
{
public:
GAL_OPTIONS_PANEL( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame );
GAL_OPTIONS_PANEL( wxWindow* aParent, APP_SETTINGS_BASE* aAppSettings );
/**
* Load the panel controls from the given opt
@ -51,32 +54,29 @@ public:
bool TransferDataFromWindow() override;
private:
EDA_DRAW_FRAME* m_drawFrame;
wxBoxSizer* m_mainSizer;
wxBoxSizer* m_mainSizer;
#ifndef __WXMAC__
wxRadioBox* m_renderingEngine;
wxRadioBox* m_renderingEngine;
#endif
wxRadioBox* m_gridStyle;
wxStaticText* l_gridLineWidth;
wxSpinCtrlDouble* m_gridLineWidth;
wxStaticText* l_gridLineWidthUnits;
wxRadioBox* m_gridStyle;
wxStaticText* l_gridLineWidth;
wxSpinCtrlDouble* m_gridLineWidth;
wxStaticText* l_gridLineWidthUnits;
wxStaticText* l_gridMinSpacing;
wxSpinCtrlDouble* m_gridMinSpacing;
wxStaticText* l_gridMinSpacingUnits;
wxStaticText* l_gridMinSpacing;
wxSpinCtrlDouble* m_gridMinSpacing;
wxStaticText* l_gridMinSpacingUnits;
wxStaticText* l_gridSnapOptions;
wxChoice* m_gridSnapOptions;
wxStaticText* l_gridSnapSpace;
wxStaticText* l_gridSnapOptions;
wxChoice* m_gridSnapOptions;
wxStaticText* l_gridSnapSpace;
wxRadioBox* m_cursorShape;
wxCheckBox* m_forceCursorDisplay;
wxRadioBox* m_cursorShape;
wxCheckBox* m_forceCursorDisplay;
///< The GAL options to read/write
KIGFX::GAL_DISPLAY_OPTIONS& m_galOptions;
APP_SETTINGS_BASE* m_cfg;
};

View File

@ -32,6 +32,7 @@
#include <libeval/numeric_evaluator.h>
#include <wx/event.h>
class EDA_BASE_FRAME;
class EDA_DRAW_FRAME;
class wxTextEntry;
class wxSpinButton;
@ -43,7 +44,7 @@ class UNIT_BINDER : public wxEvtHandler
public:
/**
* @param aParent is the parent EDA_DRAW_FRAME.
* @param aParent is the parent EDA_BASE_FRAME, used to fetch units and coordinate systems.
* @param aLabel is the static text used to label the text input widget (note: the label
* text, trimmed of its colon, will also be used in error messages)
* @param aValueCtrl is the control used to edit or display the given value (wxTextCtrl,
@ -52,7 +53,7 @@ public:
* Can be nullptr.
* @param aAllowEval indicates \a aTextInput's content should be eval'ed before storing
*/
UNIT_BINDER( EDA_DRAW_FRAME* aParent,
UNIT_BINDER( EDA_BASE_FRAME* aParent,
wxStaticText* aLabel, wxWindow* aValueCtrl, wxStaticText* aUnitLabel,
bool aAllowEval = true );
@ -200,7 +201,7 @@ protected:
*/
double setPrecision( double aValue, bool aValueUsesUserUnits );
EDA_DRAW_FRAME* m_frame;
EDA_BASE_FRAME* m_frame;
///< The bound widgets
wxStaticText* m_label;

View File

@ -36,7 +36,6 @@
#include <kiway.h>
#include <kiway_express.h>
#include <launch_ext.h>
#include <panel_hotkeys_editor.h>
#include <reporter.h>
#include <project/project_local_settings.h>
#include <sch_file_versions.h>
@ -680,13 +679,6 @@ void KICAD_MANAGER_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
}
void KICAD_MANAGER_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
{
aHotkeysPanel->AddHotKeys( GetToolManager() );
}
void KICAD_MANAGER_FRAME::PrintPrjInfo()
{
// wxStatusBar's wxELLIPSIZE_MIDDLE flag doesn't work (at least on Mac).

View File

@ -137,8 +137,6 @@ public:
*/
void OnChangeWatchedPaths( wxCommandEvent& aEvent );
void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
const wxString GetProjectFileName() const;
bool IsProjectActive();

View File

@ -19,18 +19,12 @@
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <painter.h>
#include <view/view.h>
#include <pl_editor_settings.h>
#include "panel_pl_editor_color_settings.h"
#include "pl_editor_frame.h"
#include "pl_editor_settings.h"
PANEL_PL_EDITOR_COLOR_SETTINGS::PANEL_PL_EDITOR_COLOR_SETTINGS( PL_EDITOR_FRAME* aFrame,
wxWindow* aWindow )
: PANEL_PL_EDITOR_COLOR_SETTINGS_BASE( aWindow ),
m_frame( aFrame )
PANEL_PL_EDITOR_COLOR_SETTINGS::PANEL_PL_EDITOR_COLOR_SETTINGS( wxWindow* aParent ) :
PANEL_PL_EDITOR_COLOR_SETTINGS_BASE( aParent )
{
}
@ -68,15 +62,12 @@ bool PANEL_PL_EDITOR_COLOR_SETTINGS::TransferDataToWindow()
bool PANEL_PL_EDITOR_COLOR_SETTINGS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
int sel = m_themes->GetSelection();
COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
PL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<PL_EDITOR_SETTINGS>();
cfg->m_ColorTheme = colors->GetFilename();
int sel = m_themes->GetSelection();
COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
RENDER_SETTINGS* settings = m_frame->GetCanvas()->GetView()->GetPainter()->GetSettings();
settings->LoadColors( colors );
cfg->m_ColorTheme = colors->GetFilename();
return true;
}

View File

@ -22,19 +22,16 @@
#include "panel_pl_editor_color_settings_base.h"
class PL_EDITOR_FRAME;
class PANEL_PL_EDITOR_COLOR_SETTINGS : public PANEL_PL_EDITOR_COLOR_SETTINGS_BASE
{
public:
PANEL_PL_EDITOR_COLOR_SETTINGS( PL_EDITOR_FRAME* aFrame, wxWindow* aWindow );
PANEL_PL_EDITOR_COLOR_SETTINGS( wxWindow* aParent );
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
PL_EDITOR_FRAME* m_frame;
};

View File

@ -31,6 +31,8 @@
#include <gestfich.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <dialogs/panel_gal_display_options.h>
#include <dialogs/panel_pl_editor_color_settings.h>
#include "pl_editor_frame.h"
#include "pl_editor_settings.h"
@ -56,12 +58,19 @@ static struct IFACE : public KIFACE_BASE
switch( aClassId )
{
case FRAME_PL_EDITOR:
return new PL_EDITOR_FRAME( aKiway, aParent );
case PANEL_DS_DISPLAY_OPTIONS:
{
PL_EDITOR_FRAME* frame = new PL_EDITOR_FRAME( aKiway, aParent );
return frame;
break;
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<PL_EDITOR_SETTINGS>();
return new PANEL_GAL_DISPLAY_OPTIONS( aParent, cfg );
}
case PANEL_DS_COLORS:
return new PANEL_PL_EDITOR_COLOR_SETTINGS( aParent );
default:
;
}

View File

@ -27,11 +27,8 @@
#include <pgm_base.h>
#include <bitmaps.h>
#include <core/arraydim.h>
#include <eda_item.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <widgets/paged_dialog.h>
#include <dialogs/panel_gal_display_options.h>
#include <panel_hotkeys_editor.h>
#include <confirm.h>
#include <kiplatform/app.h>
@ -45,10 +42,7 @@
#include <tool/common_tools.h>
#include <tool/picker_tool.h>
#include <tool/zoom_tool.h>
#include <widgets/infobar.h>
#include <settings/settings_manager.h>
#include "dialogs/panel_pl_editor_color_settings.h"
#include "pl_editor_frame.h"
#include "pl_editor_id.h"
#include "pl_editor_settings.h"
@ -478,20 +472,6 @@ const BOX2I PL_EDITOR_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
}
void PL_EDITOR_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
{
wxTreebook* book = aParent->GetTreebook();
book->AddPage( new wxPanel( book ), _( "Drawing Sheet Editor" ) );
book->AddSubPage( new PANEL_GAL_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
book->AddSubPage( new PANEL_PL_EDITOR_COLOR_SETTINGS( this, aParent->GetTreebook() ),
_( "Colors" ) );
aHotkeysPanel->AddHotKeys( GetToolManager() );
}
void PL_EDITOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
EDA_DRAW_FRAME::LoadSettings( aCfg );
@ -625,7 +605,7 @@ void PL_EDITOR_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVar
GetCanvas()->GetView()->GetPainter()->GetSettings()->LoadColors( colors );
GetCanvas()->GetView()->UpdateAllItems( KIGFX::COLOR );
GetCanvas()->Refresh();
GetCanvas()->ForceRefresh();
RecreateToolbars();
Layout();

View File

@ -164,8 +164,6 @@ public:
*/
void UpdateTitleAndInfo();
void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;

View File

@ -29,6 +29,7 @@ include_directories(
./dialogs
./autorouter
${CMAKE_SOURCE_DIR}/3d-viewer
${CMAKE_SOURCE_DIR}/3d-viewer/dialogs
${CMAKE_SOURCE_DIR}/common
${CMAKE_SOURCE_DIR}/common/dialogs
./exporters

Some files were not shown because too many files have changed in this diff Show More