Initial version of the GAL-based Module Editor.
This commit is contained in:
parent
8a5fedb728
commit
a24576f3ce
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <confirm.h>
|
||||
#include <eda_doc.h>
|
||||
#include <kicad_string.h>
|
||||
|
@ -117,6 +118,15 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
|
|||
GetScreen()->ClrModify();
|
||||
Zoom_Automatique( false );
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( GetBoard() );
|
||||
|
||||
m_Pcb->ComputeBoundingBox( false );
|
||||
EDA_RECT boardBbox = m_Pcb->GetBoundingBox();
|
||||
GetGalCanvas()->GetView()->SetViewport( BOX2D( boardBbox.GetOrigin(), boardBbox.GetSize() ) );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <kiface_i.h>
|
||||
#include <kiway.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
#include <pgm_base.h>
|
||||
|
@ -914,3 +915,15 @@ EDA_COLOR_T FOOTPRINT_EDIT_FRAME::GetGridColor() const
|
|||
return g_ColorsSettings.GetItemColor( GRID_VISIBLE );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::UseGalCanvas( bool aEnable )
|
||||
{
|
||||
EDA_DRAW_FRAME::UseGalCanvas( aEnable );
|
||||
|
||||
if( aEnable )
|
||||
{
|
||||
SetBoard( m_Pcb );
|
||||
|
||||
GetGalCanvas()->StartDrawing();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -399,6 +399,9 @@ public:
|
|||
|
||||
virtual EDA_COLOR_T GetGridColor() const;
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
||||
virtual void UseGalCanvas( bool aEnable );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
protected:
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <project.h>
|
||||
#include <kicad_plugin.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <confirm.h>
|
||||
#include <wxPcbStruct.h>
|
||||
#include <dialog_helpers.h>
|
||||
|
@ -52,6 +53,15 @@
|
|||
#include <module_editor_frame.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_dispatcher.h>
|
||||
#include "tools/selection_tool.h"
|
||||
#include "tools/edit_tool.h"
|
||||
#include "tools/drawing_tool.h"
|
||||
#include "tools/point_editor.h"
|
||||
#include "tools/pcbnew_control.h"
|
||||
#include "tools/common_actions.h"
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
|
||||
|
@ -167,6 +177,12 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
// Show a title (frame title + footprint name):
|
||||
updateTitle();
|
||||
|
||||
// Create GAL canvas
|
||||
EDA_DRAW_FRAME* drawFrame = static_cast<EDA_DRAW_FRAME*>( aParent );
|
||||
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
drawFrame->GetGalCanvas()->GetBackend() );
|
||||
SetGalCanvas( drawPanel );
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
|
||||
// restore the last footprint from the project, if any
|
||||
|
@ -224,11 +240,37 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
|
||||
m_auimgr.AddPane( m_canvas,
|
||||
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
||||
m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
|
||||
wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() );
|
||||
|
||||
m_auimgr.AddPane( m_messagePanel,
|
||||
wxAuiPaneInfo( mesg_pane ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
|
||||
|
||||
m_auimgr.Update();
|
||||
|
||||
if( drawFrame->IsGalCanvasActive() )
|
||||
{
|
||||
drawPanel->DisplayBoard( GetBoard() );
|
||||
|
||||
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
||||
m_toolManager = new TOOL_MANAGER;
|
||||
m_toolManager->SetEnvironment( GetBoard(), drawPanel->GetView(),
|
||||
drawPanel->GetViewControls(), this );
|
||||
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
|
||||
drawPanel->SetEventDispatcher( m_toolDispatcher );
|
||||
|
||||
m_toolManager->RegisterTool( new SELECTION_TOOL );
|
||||
m_toolManager->RegisterTool( new EDIT_TOOL );
|
||||
m_toolManager->RegisterTool( new DRAWING_TOOL );
|
||||
m_toolManager->RegisterTool( new POINT_EDITOR );
|
||||
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
|
||||
m_toolManager->ResetTools( TOOL_BASE::RUN );
|
||||
|
||||
// Run the selection tool, it is supposed to be always active
|
||||
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
|
||||
|
||||
UseGalCanvas( true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -545,6 +545,7 @@ void EDIT_TOOL::processChanges( const PICKED_ITEMS_LIST* aList )
|
|||
switch( operation )
|
||||
{
|
||||
case UR_CHANGED:
|
||||
case UR_MODEDIT:
|
||||
updItem->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue