Separate out axes definitions between ModEdit and PCBNew.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5711
This commit is contained in:
parent
881cf9dfcf
commit
fc4bc10d27
|
@ -41,7 +41,9 @@ PANEL_GRID_SETTINGS::PANEL_GRID_SETTINGS( wxWindow* aParent, UNITS_PROVIDER* aUn
|
|||
wxWindow* aEventSource, APP_SETTINGS_BASE* aCfg,
|
||||
FRAME_T aFrameType ) :
|
||||
PANEL_GRID_SETTINGS_BASE( aParent ),
|
||||
m_unitsProvider( aUnitsProvider ), m_cfg( aCfg ), m_frameType( aFrameType ),
|
||||
m_unitsProvider( aUnitsProvider ),
|
||||
m_cfg( aCfg ),
|
||||
m_frameType( aFrameType ),
|
||||
m_eventSource( aEventSource )
|
||||
{
|
||||
RebuildGridSizes();
|
||||
|
|
|
@ -1140,6 +1140,7 @@ if( ADVANCED_CFG::GetCfg().m_EnableGit && false )
|
|||
book->AddPage( new wxPanel( book ), _( "Footprint Editor" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DISPLAY_OPTIONS ), _( "Display Options" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_GRIDS ), _( "Grids" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_ORIGINS_AXES ), _( "Origins & Axes" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_COLORS ), _( "Colors" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_VALUES ), _( "Default Values" ) );
|
||||
|
@ -1150,10 +1151,10 @@ if( ADVANCED_CFG::GetCfg().m_EnableGit && false )
|
|||
book->AddPage( new wxPanel( book ), _( "PCB Editor" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_DISPLAY_OPTS ), _( "Display Options" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_GRIDS ), _( "Grids" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ORIGINS_AXES ), _( "Origins & Axes" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_EDIT_OPTIONS ), _( "Editing Options" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_COLORS ), _( "Colors" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ACTION_PLUGINS ), _( "Action Plugins" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ORIGINS_AXES ), _( "Origins & Axes" ) );
|
||||
|
||||
if( GetFrameType() == FRAME_PCB_DISPLAY3D )
|
||||
expand.push_back( (int) book->GetPageCount() );
|
||||
|
|
|
@ -69,6 +69,8 @@ public:
|
|||
USER_GRID m_UserGrid;
|
||||
|
||||
bool m_PolarCoords;
|
||||
bool m_DisplayInvertXAxis;
|
||||
bool m_DisplayInvertYAxis;
|
||||
|
||||
EDA_ANGLE m_RotationAngle;
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ enum FRAME_T
|
|||
PANEL_FP_EDIT_OPTIONS,
|
||||
PANEL_FP_COLORS,
|
||||
PANEL_FP_DEFAULT_VALUES,
|
||||
PANEL_FP_ORIGINS_AXES,
|
||||
|
||||
PANEL_PCB_DISPLAY_OPTS,
|
||||
PANEL_PCB_GRIDS,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 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
|
||||
|
@ -25,20 +25,36 @@
|
|||
#include <pgm_base.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <pcbnew_settings.h>
|
||||
#include <footprint_editor_settings.h>
|
||||
#include <panel_pcbnew_display_origin.h>
|
||||
|
||||
|
||||
PANEL_PCBNEW_DISPLAY_ORIGIN::PANEL_PCBNEW_DISPLAY_ORIGIN( wxWindow* aParent ) :
|
||||
PANEL_PCBNEW_DISPLAY_ORIGIN_BASE( aParent )
|
||||
PANEL_PCBNEW_DISPLAY_ORIGIN::PANEL_PCBNEW_DISPLAY_ORIGIN( wxWindow* aParent,
|
||||
APP_SETTINGS_BASE* aCfg,
|
||||
FRAME_T aFrameType ) :
|
||||
PANEL_PCBNEW_DISPLAY_ORIGIN_BASE( aParent ),
|
||||
m_cfg( aCfg ),
|
||||
m_frameType( aFrameType )
|
||||
{
|
||||
m_DisplayOrigin->Show( m_frameType == FRAME_PCB_EDITOR );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PCBNEW_DISPLAY_ORIGIN::loadPCBSettings( PCBNEW_SETTINGS* aCfg )
|
||||
void PANEL_PCBNEW_DISPLAY_ORIGIN::loadSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
if( m_frameType == FRAME_FOOTPRINT_EDITOR )
|
||||
{
|
||||
FOOTPRINT_EDITOR_SETTINGS* cfg = static_cast<FOOTPRINT_EDITOR_SETTINGS*>( aCfg );
|
||||
|
||||
m_XAxisDirection->SetSelection( cfg->m_DisplayInvertXAxis ? 1 : 0 );
|
||||
m_YAxisDirection->SetSelection( cfg->m_DisplayInvertYAxis ? 0 : 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
PCBNEW_SETTINGS* cfg = static_cast<PCBNEW_SETTINGS*>( aCfg );
|
||||
int origin = 0;
|
||||
|
||||
switch( aCfg->m_Display.m_DisplayOrigin )
|
||||
switch( cfg->m_Display.m_DisplayOrigin )
|
||||
{
|
||||
case PCB_DISPLAY_ORIGIN::PCB_ORIGIN_PAGE: origin = 0; break;
|
||||
case PCB_DISPLAY_ORIGIN::PCB_ORIGIN_AUX: origin = 1; break;
|
||||
|
@ -46,16 +62,15 @@ void PANEL_PCBNEW_DISPLAY_ORIGIN::loadPCBSettings( PCBNEW_SETTINGS* aCfg )
|
|||
}
|
||||
|
||||
m_DisplayOrigin->SetSelection( origin );
|
||||
m_XAxisDirection->SetSelection( aCfg->m_Display.m_DisplayInvertXAxis ? 1 : 0 );
|
||||
m_YAxisDirection->SetSelection( aCfg->m_Display.m_DisplayInvertYAxis ? 0 : 1 );
|
||||
m_XAxisDirection->SetSelection( cfg->m_Display.m_DisplayInvertXAxis ? 1 : 0 );
|
||||
m_YAxisDirection->SetSelection( cfg->m_Display.m_DisplayInvertYAxis ? 0 : 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_PCBNEW_DISPLAY_ORIGIN::TransferDataToWindow()
|
||||
{
|
||||
PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
|
||||
loadPCBSettings( cfg );
|
||||
loadSettings( m_cfg );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -63,7 +78,16 @@ bool PANEL_PCBNEW_DISPLAY_ORIGIN::TransferDataToWindow()
|
|||
|
||||
bool PANEL_PCBNEW_DISPLAY_ORIGIN::TransferDataFromWindow()
|
||||
{
|
||||
PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
if( m_frameType == FRAME_FOOTPRINT_EDITOR )
|
||||
{
|
||||
FOOTPRINT_EDITOR_SETTINGS* cfg = static_cast<FOOTPRINT_EDITOR_SETTINGS*>( m_cfg );
|
||||
|
||||
cfg->m_DisplayInvertXAxis = m_XAxisDirection->GetSelection() != 0;
|
||||
cfg->m_DisplayInvertYAxis = m_YAxisDirection->GetSelection() == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
PCBNEW_SETTINGS* cfg = static_cast<PCBNEW_SETTINGS*>( m_cfg );
|
||||
|
||||
switch( m_DisplayOrigin->GetSelection() )
|
||||
{
|
||||
|
@ -74,6 +98,7 @@ bool PANEL_PCBNEW_DISPLAY_ORIGIN::TransferDataFromWindow()
|
|||
|
||||
cfg->m_Display.m_DisplayInvertXAxis = m_XAxisDirection->GetSelection() != 0;
|
||||
cfg->m_Display.m_DisplayInvertYAxis = m_YAxisDirection->GetSelection() == 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -81,10 +106,20 @@ bool PANEL_PCBNEW_DISPLAY_ORIGIN::TransferDataFromWindow()
|
|||
|
||||
void PANEL_PCBNEW_DISPLAY_ORIGIN::ResetPanel()
|
||||
{
|
||||
if( m_frameType == FRAME_FOOTPRINT_EDITOR )
|
||||
{
|
||||
FOOTPRINT_EDITOR_SETTINGS cfg;
|
||||
cfg.Load(); // Loading without a file will init to defaults
|
||||
|
||||
loadSettings( &cfg );
|
||||
}
|
||||
else
|
||||
{
|
||||
PCBNEW_SETTINGS cfg;
|
||||
cfg.Load(); // Loading without a file will init to defaults
|
||||
|
||||
loadPCBSettings( &cfg );
|
||||
loadSettings( &cfg );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,13 +25,14 @@
|
|||
#ifndef PANEL_PCBNEW_DISPLAY_ORIGIN_H
|
||||
#define PANEL_PCBNEW_DISPLAY_ORIGIN_H 1
|
||||
|
||||
#include <frame_type.h>
|
||||
#include "panel_pcbnew_display_origin_base.h"
|
||||
|
||||
|
||||
class PANEL_PCBNEW_DISPLAY_ORIGIN : public PANEL_PCBNEW_DISPLAY_ORIGIN_BASE
|
||||
{
|
||||
public:
|
||||
PANEL_PCBNEW_DISPLAY_ORIGIN( wxWindow* aParent );
|
||||
PANEL_PCBNEW_DISPLAY_ORIGIN( wxWindow* aParent, APP_SETTINGS_BASE* aCfg, FRAME_T aFrameType );
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
@ -39,7 +40,11 @@ public:
|
|||
void ResetPanel() override;
|
||||
|
||||
private:
|
||||
void loadPCBSettings( PCBNEW_SETTINGS* aCfg );
|
||||
void loadSettings( APP_SETTINGS_BASE* aCfg );
|
||||
|
||||
private:
|
||||
APP_SETTINGS_BASE* m_cfg;
|
||||
FRAME_T m_frameType;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
|
|||
m_Display(),
|
||||
m_UserGrid(),
|
||||
m_PolarCoords( false ),
|
||||
m_DisplayInvertXAxis( false ),
|
||||
m_DisplayInvertYAxis( false ),
|
||||
m_RotationAngle( ANGLE_90 ),
|
||||
m_Use45Limit( true ),
|
||||
m_ArcEditMode( ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ),
|
||||
|
@ -102,6 +104,12 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
|
|||
m_params.emplace_back( new PARAM<bool>( "editing.polar_coords",
|
||||
&m_PolarCoords, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "origin_invert_x_axis",
|
||||
&m_DisplayInvertXAxis, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "origin_invert_y_axis",
|
||||
&m_DisplayInvertYAxis, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM_LAMBDA<int>( "editing.rotation_angle",
|
||||
[this] () -> int
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019-2020 Reece R. Pollack <reece@his.com>
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 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
|
||||
|
@ -25,6 +25,7 @@
|
|||
#include <wx/debug.h> // for wxASSERT
|
||||
#include <pcb_base_frame.h>
|
||||
#include <pcbnew_settings.h>
|
||||
#include <footprint_editor_settings.h>
|
||||
#include <pcb_origin_transforms.h>
|
||||
|
||||
using COORD_TYPE = ORIGIN_TRANSFORMS::COORD_TYPES_T;
|
||||
|
@ -119,10 +120,16 @@ int PCB_ORIGIN_TRANSFORMS::getUserYOrigin() const
|
|||
|
||||
bool PCB_ORIGIN_TRANSFORMS::invertXAxis() const
|
||||
{
|
||||
if( m_pcbBaseFrame.GetFrameType() == FRAME_PCB_EDITOR )
|
||||
return m_pcbBaseFrame.GetPcbNewSettings()->m_Display.m_DisplayInvertXAxis;
|
||||
else
|
||||
return m_pcbBaseFrame.GetFootprintEditorSettings()->m_DisplayInvertXAxis;
|
||||
}
|
||||
|
||||
bool PCB_ORIGIN_TRANSFORMS::invertYAxis() const
|
||||
{
|
||||
if( m_pcbBaseFrame.GetFrameType() == FRAME_PCB_EDITOR )
|
||||
return m_pcbBaseFrame.GetPcbNewSettings()->m_Display.m_DisplayInvertYAxis;
|
||||
else
|
||||
return m_pcbBaseFrame.GetFootprintEditorSettings()->m_DisplayInvertYAxis;
|
||||
}
|
||||
|
|
|
@ -210,11 +210,19 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
|||
case PANEL_PCB_DISPLAY_OPTS:
|
||||
{
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>();
|
||||
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
|
||||
|
||||
return new PANEL_PCB_DISPLAY_OPTIONS( aParent, cfg );
|
||||
}
|
||||
|
||||
case PANEL_FP_ORIGINS_AXES:
|
||||
{
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
|
||||
|
||||
return new PANEL_PCBNEW_DISPLAY_ORIGIN( aParent, cfg, FRAME_FOOTPRINT_EDITOR );
|
||||
}
|
||||
|
||||
case PANEL_PCB_GRIDS:
|
||||
{
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
|
@ -264,7 +272,12 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
|||
return new PANEL_PCBNEW_ACTION_PLUGINS( aParent );
|
||||
|
||||
case PANEL_PCB_ORIGINS_AXES:
|
||||
return new PANEL_PCBNEW_DISPLAY_ORIGIN( aParent );
|
||||
{
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>();
|
||||
|
||||
return new PANEL_PCBNEW_DISPLAY_ORIGIN( aParent, cfg, FRAME_PCB_EDITOR );
|
||||
}
|
||||
|
||||
case PANEL_3DV_DISPLAY_OPTIONS:
|
||||
return new PANEL_3D_DISPLAY_OPTIONS( aParent );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-2023 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
|
||||
|
@ -199,13 +199,20 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
|
||||
frame()->PushTool( aEvent );
|
||||
|
||||
bool invertXAxis = displayOptions().m_DisplayInvertXAxis;
|
||||
bool invertYAxis = displayOptions().m_DisplayInvertYAxis;
|
||||
|
||||
if( IsFootprintFrame() )
|
||||
{
|
||||
invertXAxis = frame()->GetFootprintEditorSettings()->m_DisplayInvertXAxis;
|
||||
invertYAxis = frame()->GetFootprintEditorSettings()->m_DisplayInvertYAxis;
|
||||
}
|
||||
|
||||
TWO_POINT_GEOMETRY_MANAGER twoPtMgr;
|
||||
PCB_GRID_HELPER grid( m_toolMgr, frame()->GetMagneticItemsSettings() );
|
||||
bool originSet = false;
|
||||
EDA_UNITS units = frame()->GetUserUnits();
|
||||
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, pcbIUScale, units,
|
||||
displayOptions().m_DisplayInvertXAxis,
|
||||
displayOptions().m_DisplayInvertYAxis );
|
||||
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, pcbIUScale, units, invertXAxis, invertYAxis );
|
||||
|
||||
view.Add( &ruler );
|
||||
view.SetVisible( &ruler, false );
|
||||
|
@ -323,8 +330,16 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( evt->IsAction( &ACTIONS::updatePreferences ) )
|
||||
{
|
||||
ruler.UpdateDir( displayOptions().m_DisplayInvertXAxis,
|
||||
displayOptions().m_DisplayInvertYAxis );
|
||||
invertXAxis = displayOptions().m_DisplayInvertXAxis;
|
||||
invertYAxis = displayOptions().m_DisplayInvertYAxis;
|
||||
|
||||
if( IsFootprintFrame() )
|
||||
{
|
||||
invertXAxis = frame()->GetFootprintEditorSettings()->m_DisplayInvertXAxis;
|
||||
invertYAxis = frame()->GetFootprintEditorSettings()->m_DisplayInvertYAxis;
|
||||
}
|
||||
|
||||
ruler.UpdateDir( invertXAxis, invertYAxis );
|
||||
|
||||
view.Update( &ruler, KIGFX::GEOMETRY );
|
||||
canvas()->Refresh();
|
||||
|
|
Loading…
Reference in New Issue