More infrastructure work for shape editor.
This commit is contained in:
parent
ee9d8fcd15
commit
cae493fe65
|
@ -305,6 +305,8 @@ KIWAY::FACE_T KIWAY::KifaceType( FRAME_T aFrameType )
|
|||
case FRAME_FOOTPRINT_VIEWER_MODAL:
|
||||
case FRAME_FOOTPRINT_WIZARD:
|
||||
case FRAME_PCB_DISPLAY3D:
|
||||
case FRAME_SHAPE_EDITOR:
|
||||
case FRAME_SHAPE_EDITOR_MODAL:
|
||||
return FACE_PCB;
|
||||
|
||||
case FRAME_CVPCB:
|
||||
|
|
|
@ -270,6 +270,7 @@ int COMMON_TOOLS::ZoomFitScreen( const TOOL_EVENT& aEvent )
|
|||
|
||||
// Leave a bigger margin for library editors & viewers
|
||||
if( frame->IsType( FRAME_FOOTPRINT_VIEWER ) || frame->IsType( FRAME_FOOTPRINT_VIEWER_MODAL )
|
||||
|| frame->IsType( FRAME_SHAPE_EDITOR ) || frame->IsType( FRAME_SHAPE_EDITOR_MODAL )
|
||||
|| frame->IsType( FRAME_SCH_VIEWER ) || frame->IsType( FRAME_SCH_VIEWER_MODAL ) )
|
||||
{
|
||||
margin_scale_factor = 1.4;
|
||||
|
|
|
@ -61,6 +61,7 @@ using KIGFX::RENDER_SETTINGS;
|
|||
#define FOOTPRINT_VIEWER_FRAME_NAME_MODAL wxT( "ModViewFrameModal" )
|
||||
#define PCB_EDIT_FRAME_NAME wxT( "PcbFrame" )
|
||||
#define SHAPE_EDIT_FRAME_NAME wxT( "ShapeEditFrame" )
|
||||
#define SHAPE_EDIT_FRAME_NAME_MODAL wxT( "ShapeEditFrameModal" )
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,6 +47,7 @@ enum FRAME_T
|
|||
FRAME_PCB_DISPLAY3D,
|
||||
FRAME_FOOTPRINT_PREVIEW,
|
||||
FRAME_SHAPE_EDITOR,
|
||||
FRAME_SHAPE_EDITOR_MODAL,
|
||||
|
||||
FRAME_CVPCB,
|
||||
FRAME_CVPCB_DISPLAY,
|
||||
|
|
|
@ -173,7 +173,7 @@ public:
|
|||
*/
|
||||
bool Destroy() override;
|
||||
|
||||
bool IsModal() { return m_modal; }
|
||||
bool IsModal() const { return m_modal; }
|
||||
void SetModal( bool aIsModal ) { m_modal = aIsModal; }
|
||||
|
||||
/**
|
||||
|
|
|
@ -185,10 +185,12 @@ public:
|
|||
|
||||
PCB_LIB_NICKNAME,
|
||||
PCB_FOOTPRINT,
|
||||
PCB_FOOTPRINT_EDITOR_FPNAME,
|
||||
PCB_FOOTPRINT_EDITOR_NICKNAME,
|
||||
PCB_FOOTPRINT_VIEWER_FPNAME,
|
||||
PCB_FOOTPRINT_VIEWER_NICKNAME,
|
||||
PCB_FOOTPRINT_EDITOR_FP_NAME,
|
||||
PCB_FOOTPRINT_EDITOR_LIB_NICKNAME,
|
||||
PCB_FOOTPRINT_VIEWER_FP_NAME,
|
||||
PCB_FOOTPRINT_VIEWER_LIB_NICKNAME,
|
||||
PCB_SHAPE_EDITOR_SHAPE_NAME,
|
||||
PCB_SHAPE_EDITOR_LIB_NICKNAME,
|
||||
|
||||
RSTRING_COUNT
|
||||
};
|
||||
|
|
|
@ -1060,6 +1060,8 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
|
|||
|
||||
// Update only enabled copper layers mask
|
||||
m_enabledLayers &= ~LSET::AllCuMask();
|
||||
|
||||
if( aNewLayerCount > 0 )
|
||||
m_enabledLayers |= LSET::AllCuMask( aNewLayerCount );
|
||||
}
|
||||
|
||||
|
|
|
@ -171,11 +171,10 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
|||
|
||||
GetGalDisplayOptions().m_axesEnabled = true;
|
||||
|
||||
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
|
||||
GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
|
||||
|
||||
// In modedit, set the default paper size to A4 for plot/print
|
||||
SetPageSettings( PAGE_INFO( PAGE_INFO::A4 ) );
|
||||
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
|
||||
GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
|
||||
|
||||
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
||||
setupTools();
|
||||
|
@ -284,7 +283,7 @@ void FOOTPRINT_EDIT_FRAME::HardRedraw()
|
|||
|
||||
void FOOTPRINT_EDIT_FRAME::ToggleSearchTree()
|
||||
{
|
||||
auto& treePane = m_auimgr.GetPane( m_treePane );
|
||||
wxAuiPaneInfo& treePane = m_auimgr.GetPane( m_treePane );
|
||||
treePane.Show( !IsSearchTreeShown() );
|
||||
m_auimgr.Update();
|
||||
}
|
||||
|
@ -350,22 +349,22 @@ void FOOTPRINT_EDIT_FRAME::retainLastFootprint()
|
|||
|
||||
if( id.IsValid() )
|
||||
{
|
||||
Prj().SetRString( PROJECT::PCB_FOOTPRINT_EDITOR_NICKNAME, id.GetLibNickname() );
|
||||
Prj().SetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FPNAME, id.GetLibItemName() );
|
||||
Prj().SetRString( PROJECT::PCB_FOOTPRINT_EDITOR_LIB_NICKNAME, id.GetLibNickname() );
|
||||
Prj().SetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FP_NAME, id.GetLibItemName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::restoreLastFootprint()
|
||||
{
|
||||
const wxString& curFootprintName = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FPNAME );
|
||||
const wxString& curNickname = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_NICKNAME );
|
||||
const wxString& footprintName = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FP_NAME );
|
||||
const wxString& libNickname = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_LIB_NICKNAME );
|
||||
|
||||
if( curNickname.Length() && curFootprintName.Length() )
|
||||
if( libNickname.Length() && footprintName.Length() )
|
||||
{
|
||||
LIB_ID id;
|
||||
id.SetLibNickname( curNickname );
|
||||
id.SetLibItemName( curFootprintName );
|
||||
id.SetLibNickname( libNickname );
|
||||
id.SetLibItemName( footprintName );
|
||||
|
||||
MODULE* module = loadFootprint( id );
|
||||
|
||||
|
@ -410,21 +409,15 @@ void FOOTPRINT_EDIT_FRAME::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSett
|
|||
|
||||
const PCB_PLOT_PARAMS& FOOTPRINT_EDIT_FRAME::GetPlotSettings() const
|
||||
{
|
||||
// get the settings from the parent editor, not our BOARD.
|
||||
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, true );
|
||||
wxASSERT( parentFrame );
|
||||
wxFAIL_MSG( "Plotting not supported in Footprint Editor" );
|
||||
|
||||
return parentFrame->GetPlotSettings();
|
||||
return PCB_BASE_FRAME::GetPlotSettings();
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::SetPlotSettings( const PCB_PLOT_PARAMS& aSettings )
|
||||
{
|
||||
// set the settings into parent editor, not our BOARD.
|
||||
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, true );
|
||||
wxASSERT( parentFrame );
|
||||
|
||||
parentFrame->SetPlotSettings( aSettings );
|
||||
wxFAIL_MSG( "Plotting not supported in Footprint Editor" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -867,7 +860,7 @@ void FOOTPRINT_EDIT_FRAME::setupTools()
|
|||
m_toolManager->RegisterTool( new PAD_TOOL );
|
||||
m_toolManager->RegisterTool( new DRAWING_TOOL );
|
||||
m_toolManager->RegisterTool( new POINT_EDITOR );
|
||||
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
|
||||
m_toolManager->RegisterTool( new PCBNEW_CONTROL ); // copy/paste
|
||||
m_toolManager->RegisterTool( new FOOTPRINT_EDITOR_TOOLS );
|
||||
m_toolManager->RegisterTool( new ALIGN_DISTRIBUTE_TOOL );
|
||||
m_toolManager->RegisterTool( new PCBNEW_PICKER_TOOL );
|
||||
|
|
|
@ -94,13 +94,9 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME )
|
|||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
/* Note:
|
||||
* FOOTPRINT_VIEWER_FRAME can be created in "modal mode", or as a usual frame.
|
||||
* In modal mode:
|
||||
* a tool to export the selected footprint is shown in the toolbar
|
||||
* the style is wxFRAME_FLOAT_ON_PARENT
|
||||
/*
|
||||
* Note: FOOTPRINT_VIEWER_FRAME can be created in "modal mode", or as a usual frame.
|
||||
*/
|
||||
|
||||
#define PARENT_STYLE ( KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT )
|
||||
#define MODAL_STYLE ( KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP )
|
||||
#define NONMODAL_STYLE ( KICAD_DEFAULT_DRAWFRAME_STYLE )
|
||||
|
@ -786,25 +782,25 @@ void FOOTPRINT_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
|
|||
|
||||
const wxString FOOTPRINT_VIEWER_FRAME::getCurNickname()
|
||||
{
|
||||
return Prj().GetRString( PROJECT::PCB_FOOTPRINT_VIEWER_NICKNAME );
|
||||
return Prj().GetRString( PROJECT::PCB_FOOTPRINT_VIEWER_LIB_NICKNAME );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::setCurNickname( const wxString& aNickname )
|
||||
{
|
||||
Prj().SetRString( PROJECT::PCB_FOOTPRINT_VIEWER_NICKNAME, aNickname );
|
||||
Prj().SetRString( PROJECT::PCB_FOOTPRINT_VIEWER_LIB_NICKNAME, aNickname );
|
||||
}
|
||||
|
||||
|
||||
const wxString FOOTPRINT_VIEWER_FRAME::getCurFootprintName()
|
||||
{
|
||||
return Prj().GetRString( PROJECT::PCB_FOOTPRINT_VIEWER_FPNAME );
|
||||
return Prj().GetRString( PROJECT::PCB_FOOTPRINT_VIEWER_FP_NAME );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::setCurFootprintName( const wxString& aName )
|
||||
{
|
||||
Prj().SetRString( PROJECT::PCB_FOOTPRINT_VIEWER_FPNAME, aName );
|
||||
Prj().SetRString( PROJECT::PCB_FOOTPRINT_VIEWER_FP_NAME, aName );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -147,6 +147,9 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
|
|||
{
|
||||
ReCreateMenuBar();
|
||||
ReCreateHToolbar();
|
||||
|
||||
if( IsSearchTreeShown() )
|
||||
ToggleSearchTree();
|
||||
}
|
||||
|
||||
Update3DView( true );
|
||||
|
|
|
@ -356,6 +356,14 @@ TOOL_ACTION PCB_ACTIONS::defaultPadProperties( "pcbnew.ModuleEditor.defaultPadPr
|
|||
options_pad_xpm );
|
||||
|
||||
|
||||
// SHAPE_EDITOR_TOOLS
|
||||
//
|
||||
TOOL_ACTION PCB_ACTIONS::shapeProperties( "pcbnew.ShapeEditor.shapeProperties",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Shape Properties..." ), "",
|
||||
options_pad_xpm );
|
||||
|
||||
|
||||
// GLOBAL_EDIT_TOOL
|
||||
//
|
||||
TOOL_ACTION PCB_ACTIONS::updateFootprint( "pcbnew.GlobalEdit.updateFootprint",
|
||||
|
|
|
@ -350,6 +350,7 @@ public:
|
|||
|
||||
static TOOL_ACTION footprintProperties;
|
||||
static TOOL_ACTION defaultPadProperties;
|
||||
static TOOL_ACTION shapeProperties;
|
||||
|
||||
/// Activation of the drawing tool (placing a PAD)
|
||||
static TOOL_ACTION placePad;
|
||||
|
|
Loading…
Reference in New Issue