Allows switching GAL or legacy mode in footprint editor (previously, the mode was inherited from the board editor, and was not modifiable without closing the footprint editor) by menu or F9, F11 and F12 keys)
This commit is contained in:
parent
21332b588f
commit
84ba36fa72
|
@ -107,7 +107,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
|||
m_optionsToolBar = NULL;
|
||||
m_gridSelectBox = NULL;
|
||||
m_zoomSelectBox = NULL;
|
||||
m_HotkeysZoomAndGridList = NULL;
|
||||
m_hotkeysDescrList = NULL;
|
||||
|
||||
m_canvas = NULL;
|
||||
m_galCanvas = NULL;
|
||||
|
|
|
@ -243,15 +243,15 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
|
|||
wxString msg;
|
||||
BASE_SCREEN* screen = m_canvas->GetScreen();
|
||||
|
||||
msg = AddHotkeyName( _( "Center" ), m_HotkeysZoomAndGridList, HK_ZOOM_CENTER );
|
||||
msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
|
||||
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
|
||||
msg = AddHotkeyName( _( "Zoom in" ), m_HotkeysZoomAndGridList, HK_ZOOM_IN );
|
||||
msg = AddHotkeyName( _( "Zoom in" ), m_hotkeysDescrList, HK_ZOOM_IN );
|
||||
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
|
||||
msg = AddHotkeyName( _( "Zoom out" ), m_HotkeysZoomAndGridList, HK_ZOOM_OUT );
|
||||
msg = AddHotkeyName( _( "Zoom out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
|
||||
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
|
||||
msg = AddHotkeyName( _( "Redraw view" ), m_HotkeysZoomAndGridList, HK_ZOOM_REDRAW );
|
||||
msg = AddHotkeyName( _( "Redraw view" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
|
||||
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
|
||||
msg = AddHotkeyName( _( "Zoom auto" ), m_HotkeysZoomAndGridList, HK_ZOOM_AUTO );
|
||||
msg = AddHotkeyName( _( "Zoom auto" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
|
||||
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
|
||||
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
SetShowDeMorgan( false );
|
||||
m_drawSpecificConvert = true;
|
||||
m_drawSpecificUnit = false;
|
||||
m_HotkeysZoomAndGridList = g_Libedit_Hokeys_Descr;
|
||||
m_hotkeysDescrList = g_Libedit_Hokeys_Descr;
|
||||
m_editPinsPerPartOrConvert = false;
|
||||
m_repeatPinStep = DEFAULT_REPEAT_OFFSET_PIN;
|
||||
|
||||
|
|
|
@ -319,7 +319,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
m_printMonochrome = true;
|
||||
m_printSheetReference = true;
|
||||
SetShowPageLimits( true );
|
||||
m_HotkeysZoomAndGridList = g_Schematic_Hokeys_Descr;
|
||||
m_hotkeysDescrList = g_Schematic_Hokeys_Descr;
|
||||
m_dlgFindReplace = NULL;
|
||||
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
|
||||
m_undoItem = NULL;
|
||||
|
|
|
@ -99,7 +99,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
|||
icon.CopyFromBitmap( KiBitmap( library_browse_xpm ) );
|
||||
SetIcon( icon );
|
||||
|
||||
m_HotkeysZoomAndGridList = g_Viewlib_Hokeys_Descr;
|
||||
m_hotkeysDescrList = g_Viewlib_Hokeys_Descr;
|
||||
m_cmpList = NULL;
|
||||
m_libList = NULL;
|
||||
m_listPowerCmpOnly = false;
|
||||
|
|
|
@ -80,7 +80,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
|
||||
m_showAxis = true; // true to show X and Y axis on screen
|
||||
m_showBorderAndTitleBlock = false; // true for reference drawings.
|
||||
m_HotkeysZoomAndGridList = GerbviewHokeysDescr;
|
||||
m_hotkeysDescrList = GerbviewHokeysDescr;
|
||||
m_SelLayerBox = NULL;
|
||||
m_DCodeSelector = NULL;
|
||||
m_displayMode = 0;
|
||||
|
|
|
@ -56,7 +56,7 @@ protected:
|
|||
|
||||
wxSingleInstanceChecker* m_file_checker; ///< prevents opening same file multiple times.
|
||||
|
||||
EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList;
|
||||
EDA_HOTKEY_CONFIG* m_hotkeysDescrList;
|
||||
int m_LastGridSizeId; // the command id offset (>= 0) of the last selected grid
|
||||
// 0 is for the grid corresponding to
|
||||
// a wxCommand ID = ID_POPUP_GRID_LEVEL_1000.
|
||||
|
|
|
@ -625,14 +625,14 @@ public:
|
|||
void Show3D_Frame( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function UseGalCanvas
|
||||
* Virtual function UseGalCanvas
|
||||
* Enables/disables GAL canvas.
|
||||
* @param aEnable determines if GAL should be active or not.
|
||||
*/
|
||||
void UseGalCanvas( bool aEnable );
|
||||
|
||||
/**
|
||||
* Function ChangeCanvas
|
||||
* Function SwitchCanvas
|
||||
* switches currently used canvas (default / Cairo / OpenGL).
|
||||
*/
|
||||
void SwitchCanvas( wxCommandEvent& aEvent );
|
||||
|
|
|
@ -62,7 +62,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_showAxis = false; // true to show X and Y axis on screen
|
||||
m_showGridAxis = true;
|
||||
m_showBorderAndTitleBlock = true; // true for reference drawings.
|
||||
m_HotkeysZoomAndGridList = PlEditorHokeysDescr;
|
||||
m_hotkeysDescrList = PlEditorHokeysDescr;
|
||||
m_originSelectChoice = 0;
|
||||
SetDrawBgColor( WHITE ); // default value, user option (WHITE/BLACK)
|
||||
SetShowPageLimits( true );
|
||||
|
|
|
@ -114,7 +114,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
|
|||
icon.CopyFromBitmap( KiBitmap( module_wizard_xpm) );
|
||||
SetIcon( icon );
|
||||
|
||||
m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr;
|
||||
m_hotkeysDescrList = g_Module_Viewer_Hokeys_Descr;
|
||||
m_wizardName.Empty();
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
|
|
|
@ -319,6 +319,7 @@ EDA_HOTKEY* module_edit_Hotkey_List[] = {
|
|||
&HkMoveItem, &HkRotateItem, &HkEditBoardItem,
|
||||
&HkMoveItemExact, &HkDuplicateItem, &HkDuplicateItemAndIncrement,
|
||||
&HkCreateArray, &HkDelete, &HkSaveModule,
|
||||
&HkCanvasDefault, &HkCanvasCairo, &HkCanvasOpenGL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
|||
|
||||
// Save module
|
||||
text = AddHotkeyName( _( "&Save Footprint in Active Library" ),
|
||||
g_Module_Editor_Hokeys_Descr, HK_SAVE_MODULE );
|
||||
m_hotkeysDescrList, HK_SAVE_MODULE );
|
||||
|
||||
AddMenuItem( fileMenu, ID_MODEDIT_SAVE_LIBMODULE, text,
|
||||
_( "Save footprint in active library" ),
|
||||
|
@ -155,13 +155,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
|||
wxMenu* editMenu = new wxMenu;
|
||||
|
||||
// Undo
|
||||
text = AddHotkeyName( _( "&Undo" ), g_Module_Editor_Hokeys_Descr, HK_UNDO );
|
||||
text = AddHotkeyName( _( "&Undo" ), m_hotkeysDescrList, HK_UNDO );
|
||||
AddMenuItem( editMenu, wxID_UNDO,
|
||||
text, _( "Undo last action" ),
|
||||
KiBitmap( undo_xpm ) );
|
||||
|
||||
// Redo
|
||||
text = AddHotkeyName( _( "&Redo" ), g_Module_Editor_Hokeys_Descr, HK_REDO );
|
||||
text = AddHotkeyName( _( "&Redo" ), m_hotkeysDescrList, HK_REDO );
|
||||
AddMenuItem( editMenu, wxID_REDO,
|
||||
text, _( "Redo last action" ),
|
||||
KiBitmap( redo_xpm ) );
|
||||
|
@ -213,30 +213,54 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
|||
* in other words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators
|
||||
* for Zoom in and Zoom out sub menus
|
||||
*/
|
||||
text = AddHotkeyName( _( "Zoom &In" ), g_Module_Editor_Hokeys_Descr,
|
||||
text = AddHotkeyName( _( "Zoom &In" ), m_hotkeysDescrList,
|
||||
HK_ZOOM_IN, IS_ACCELERATOR );
|
||||
AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) );
|
||||
|
||||
text = AddHotkeyName( _( "Zoom &Out" ), g_Module_Editor_Hokeys_Descr,
|
||||
text = AddHotkeyName( _( "Zoom &Out" ), m_hotkeysDescrList,
|
||||
HK_ZOOM_OUT, IS_ACCELERATOR );
|
||||
AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) );
|
||||
|
||||
text = AddHotkeyName( _( "&Fit on Screen" ), g_Module_Editor_Hokeys_Descr,
|
||||
text = AddHotkeyName( _( "&Fit on Screen" ), m_hotkeysDescrList,
|
||||
HK_ZOOM_AUTO );
|
||||
AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT,
|
||||
KiBitmap( zoom_fit_in_page_xpm ) );
|
||||
|
||||
text = AddHotkeyName( _( "&Redraw" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_REDRAW );
|
||||
text = AddHotkeyName( _( "&Redraw" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
|
||||
AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text,
|
||||
HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) );
|
||||
|
||||
viewMenu->AppendSeparator();
|
||||
|
||||
// 3D view
|
||||
text = AddHotkeyName( _( "&3D Viewer" ), g_Module_Editor_Hokeys_Descr, HK_3D_VIEWER );
|
||||
text = AddHotkeyName( _( "&3D Viewer" ), m_hotkeysDescrList, HK_3D_VIEWER );
|
||||
AddMenuItem( viewMenu, ID_MENU_PCB_SHOW_3D_FRAME, text, _( "Show footprint in 3D viewer" ),
|
||||
KiBitmap( three_d_xpm ) );
|
||||
|
||||
// Add canvas selection
|
||||
viewMenu->AppendSeparator();
|
||||
|
||||
text = AddHotkeyName( _( "&Switch canvas to default" ), m_hotkeysDescrList,
|
||||
HK_CANVAS_DEFAULT );
|
||||
|
||||
AddMenuItem( viewMenu, ID_MENU_CANVAS_DEFAULT,
|
||||
text, _( "Switch the canvas implementation to default" ),
|
||||
KiBitmap( tools_xpm ) );
|
||||
|
||||
text = AddHotkeyName( _( "Switch canvas to Open&GL" ), m_hotkeysDescrList,
|
||||
HK_CANVAS_OPENGL );
|
||||
|
||||
AddMenuItem( viewMenu, ID_MENU_CANVAS_OPENGL,
|
||||
text, _( "Switch the canvas implementation to OpenGL" ),
|
||||
KiBitmap( tools_xpm ) );
|
||||
|
||||
text = AddHotkeyName( _( "Switch canvas to &Cairo" ), m_hotkeysDescrList,
|
||||
HK_CANVAS_CAIRO );
|
||||
|
||||
AddMenuItem( viewMenu, ID_MENU_CANVAS_CAIRO,
|
||||
text, _( "Switch the canvas implementation to Cairo" ),
|
||||
KiBitmap( tools_xpm ) );
|
||||
|
||||
//-------- Place menu --------------------
|
||||
wxMenu* placeMenu = new wxMenu;
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
_( "Clear current board and initialize a new one" ),
|
||||
KiBitmap( new_pcb_xpm ) );
|
||||
|
||||
text = AddHotkeyName( _( "&Open" ), g_Board_Editor_Hokeys_Descr, HK_LOAD_BOARD );
|
||||
text = AddHotkeyName( _( "&Open" ), m_hotkeysDescrList, HK_LOAD_BOARD );
|
||||
AddMenuItem( filesMenu, ID_LOAD_FILE, text,
|
||||
_( "Delete current board and load new board" ),
|
||||
KiBitmap( open_brd_file_xpm ) );
|
||||
|
@ -106,7 +106,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
|
||||
filesMenu->AppendSeparator();
|
||||
|
||||
text = AddHotkeyName( _( "&Save" ), g_Board_Editor_Hokeys_Descr, HK_SAVE_BOARD );
|
||||
text = AddHotkeyName( _( "&Save" ), m_hotkeysDescrList, HK_SAVE_BOARD );
|
||||
AddMenuItem( filesMenu, ID_SAVE_BOARD, text,
|
||||
_( "Save current board" ),
|
||||
KiBitmap( save_xpm ) );
|
||||
|
@ -118,7 +118,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
// when not under a project mgr, we are free to change filenames, cwd ...
|
||||
if( Kiface().IsSingle() ) // not when under a project mgr (pcbnew is run as stand alone)
|
||||
{
|
||||
text = AddHotkeyName( _( "Sa&ve As..." ), g_Board_Editor_Hokeys_Descr, HK_SAVE_BOARD_AS );
|
||||
text = AddHotkeyName( _( "Sa&ve As..." ), m_hotkeysDescrList, HK_SAVE_BOARD_AS );
|
||||
AddMenuItem( filesMenu, ID_SAVE_BOARD_AS, text,
|
||||
_( "Save the current board as..." ),
|
||||
KiBitmap( save_as_xpm ) );
|
||||
|
@ -127,7 +127,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
// but do not change the current board file name
|
||||
else
|
||||
{
|
||||
text = AddHotkeyName( _( "Sa&ve Copy As..." ), g_Board_Editor_Hokeys_Descr, HK_SAVE_BOARD_AS );
|
||||
text = AddHotkeyName( _( "Sa&ve Copy As..." ), m_hotkeysDescrList, HK_SAVE_BOARD_AS );
|
||||
AddMenuItem( filesMenu, ID_COPY_BOARD_AS, text,
|
||||
_( "Save a copy of the current board as..." ),
|
||||
KiBitmap( save_as_xpm ) );
|
||||
|
|
|
@ -993,15 +993,3 @@ void FOOTPRINT_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer )
|
|||
GetGalCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::UseGalCanvas( bool aEnable )
|
||||
{
|
||||
EDA_DRAW_FRAME::UseGalCanvas( aEnable );
|
||||
|
||||
if( aEnable )
|
||||
{
|
||||
SetBoard( m_Pcb );
|
||||
updateView();
|
||||
GetGalCanvas()->StartDrawing();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,6 +123,9 @@ public:
|
|||
*/
|
||||
void ReCreateMenuBar();
|
||||
|
||||
// The Tool Framework initalization, for GAL mode
|
||||
void setupTools();
|
||||
|
||||
void ToolOnRightClick( wxCommandEvent& event );
|
||||
void OnSelectOptionToolbar( wxCommandEvent& event );
|
||||
void OnConfigurePaths( wxCommandEvent& aEvent );
|
||||
|
@ -164,6 +167,12 @@ public:
|
|||
*/
|
||||
void Show3D_Frame( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function SwitchCanvas
|
||||
* switches currently used canvas (default / Cairo / OpenGL).
|
||||
*/
|
||||
void SwitchCanvas( wxCommandEvent& aEvent );
|
||||
|
||||
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
|
||||
void OnVerticalToolbar( wxCommandEvent& aEvent );
|
||||
|
||||
|
|
|
@ -165,6 +165,11 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
// Menu 3D Frame
|
||||
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, FOOTPRINT_EDIT_FRAME::Show3D_Frame )
|
||||
|
||||
// Switching canvases
|
||||
EVT_MENU( ID_MENU_CANVAS_DEFAULT, FOOTPRINT_EDIT_FRAME::SwitchCanvas )
|
||||
EVT_MENU( ID_MENU_CANVAS_CAIRO, FOOTPRINT_EDIT_FRAME::SwitchCanvas )
|
||||
EVT_MENU( ID_MENU_CANVAS_OPENGL, FOOTPRINT_EDIT_FRAME::SwitchCanvas )
|
||||
|
||||
EVT_UPDATE_UI( ID_MODEDIT_DELETE_PART, FOOTPRINT_EDIT_FRAME::OnUpdateLibSelected )
|
||||
EVT_UPDATE_UI( ID_MODEDIT_SELECT_CURRENT_LIB, FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib )
|
||||
EVT_UPDATE_UI( ID_MODEDIT_EXPORT_PART, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
|
||||
|
@ -197,6 +202,9 @@ END_EVENT_TABLE()
|
|||
|
||||
#define FOOTPRINT_EDIT_FRAME_NAME wxT( "ModEditFrame" )
|
||||
|
||||
// Store the canvas mode during a session:
|
||||
static enum PCB_DRAW_PANEL_GAL::GalType galmode = PCB_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
||||
|
||||
FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_MODULE_EDITOR, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
|
@ -205,7 +213,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_showBorderAndTitleBlock = false; // true to show the frame references
|
||||
m_showAxis = true; // true to show X and Y axis on screen
|
||||
m_showGridAxis = true; // show the grid origin axis
|
||||
m_HotkeysZoomAndGridList = g_Module_Editor_Hokeys_Descr;
|
||||
m_hotkeysDescrList = g_Module_Editor_Hokeys_Descr;
|
||||
|
||||
// Give an icon
|
||||
wxIcon icon;
|
||||
|
@ -216,9 +224,9 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
updateTitle();
|
||||
|
||||
// Create GAL canvas
|
||||
PCB_BASE_FRAME* parentFrame = static_cast<PCB_BASE_FRAME*>( Kiway().Player( FRAME_PCB, true ) );
|
||||
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
parentFrame->GetGalCanvas()->GetBackend() );
|
||||
galmode != PCB_DRAW_PANEL_GAL::GAL_TYPE_NONE ?
|
||||
galmode : PCB_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
|
||||
SetGalCanvas( drawPanel );
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
|
@ -293,8 +301,8 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
|
||||
// Add the layer manager ( most right side of pcbframe )
|
||||
m_auimgr.AddPane( m_Layers, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 2 ) );
|
||||
// Layers manager is visible and served only in GAL canvas mode.
|
||||
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( true ); // parentFrame->IsGalCanvasActive() );
|
||||
// Layers manager is visible
|
||||
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( true );
|
||||
|
||||
// The left vertical toolbar (fast acces to display options)
|
||||
m_auimgr.AddPane( m_optionsToolBar,
|
||||
|
@ -309,31 +317,8 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
wxAuiPaneInfo( mesg_pane ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
|
||||
|
||||
// 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 );
|
||||
|
||||
if( parentFrame->IsGalCanvasActive() )
|
||||
{
|
||||
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->RegisterTool( new MODULE_TOOLS );
|
||||
m_toolManager->RegisterTool( new PLACEMENT_TOOL );
|
||||
|
||||
m_toolManager->GetTool<SELECTION_TOOL>()->EditModules( true );
|
||||
m_toolManager->GetTool<EDIT_TOOL>()->EditModules( true );
|
||||
m_toolManager->GetTool<DRAWING_TOOL>()->EditModules( true );
|
||||
|
||||
m_toolManager->ResetTools( TOOL_BASE::RUN );
|
||||
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
|
||||
UseGalCanvas( true );
|
||||
}
|
||||
setupTools();
|
||||
UseGalCanvas( galmode != PCB_DRAW_PANEL_GAL::GAL_TYPE_NONE );
|
||||
|
||||
if( m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).IsShown() )
|
||||
{
|
||||
|
@ -448,24 +433,12 @@ const wxChar* FOOTPRINT_EDIT_FRAME::GetFootprintEditorFrameName()
|
|||
|
||||
BOARD_DESIGN_SETTINGS& FOOTPRINT_EDIT_FRAME::GetDesignSettings() const
|
||||
{
|
||||
// get the BOARD_DESIGN_SETTINGS from the parent editor, not our BOARD.
|
||||
|
||||
// @todo(DICK) change the routing to some default or the board directly, parent may not exist
|
||||
// PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true );
|
||||
// wxASSERT( parentFrame );
|
||||
|
||||
return GetBoard()->GetDesignSettings();
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings )
|
||||
{
|
||||
// set the BOARD_DESIGN_SETTINGS into parent editor, not our BOARD.
|
||||
|
||||
// @todo(DICK) change the routing to some default or the board directly, parent may not exist
|
||||
// PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true );
|
||||
// wxASSERT( parentFrame );
|
||||
|
||||
GetBoard()->SetDesignSettings( aSettings );
|
||||
}
|
||||
|
||||
|
@ -926,3 +899,81 @@ void FOOTPRINT_EDIT_FRAME::OnConfigurePaths( wxCommandEvent& aEvent )
|
|||
{
|
||||
Pgm().ConfigurePaths( this );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
|
||||
{
|
||||
int id = aEvent.GetId();
|
||||
bool use_gal = false;
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_MENU_CANVAS_DEFAULT:
|
||||
galmode = PCB_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
||||
break;
|
||||
|
||||
case ID_MENU_CANVAS_CAIRO:
|
||||
galmode = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
||||
use_gal = GetGalCanvas()->SwitchBackend( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
|
||||
break;
|
||||
|
||||
case ID_MENU_CANVAS_OPENGL:
|
||||
galmode = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
use_gal = GetGalCanvas()->SwitchBackend( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
|
||||
break;
|
||||
}
|
||||
|
||||
UseGalCanvas( use_gal );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::setupTools()
|
||||
{
|
||||
PCB_DRAW_PANEL_GAL* drawPanel = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() );
|
||||
|
||||
// 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->RegisterTool( new MODULE_TOOLS );
|
||||
m_toolManager->RegisterTool( new PLACEMENT_TOOL );
|
||||
|
||||
m_toolManager->GetTool<SELECTION_TOOL>()->EditModules( true );
|
||||
m_toolManager->GetTool<EDIT_TOOL>()->EditModules( true );
|
||||
m_toolManager->GetTool<DRAWING_TOOL>()->EditModules( true );
|
||||
|
||||
m_toolManager->ResetTools( TOOL_BASE::RUN );
|
||||
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::UseGalCanvas( bool aEnable )
|
||||
{
|
||||
EDA_DRAW_FRAME::UseGalCanvas( aEnable );
|
||||
|
||||
if( aEnable )
|
||||
{
|
||||
SetBoard( m_Pcb );
|
||||
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
|
||||
updateView();
|
||||
GetGalCanvas()->SetEventDispatcher( m_toolDispatcher );
|
||||
GetGalCanvas()->StartDrawing();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
|
||||
|
||||
// Redirect all events to the legacy canvas
|
||||
GetGalCanvas()->SetEventDispatcher( NULL );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
icon.CopyFromBitmap( KiBitmap( modview_icon_xpm ) );
|
||||
SetIcon( icon );
|
||||
|
||||
m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr;
|
||||
m_hotkeysDescrList = g_Module_Viewer_Hokeys_Descr;
|
||||
|
||||
m_libList = new wxListBox( this, ID_MODVIEW_LIB_LIST,
|
||||
wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL );
|
||||
|
|
|
@ -316,7 +316,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_SelLayerBox = NULL;
|
||||
m_show_microwave_tools = false;
|
||||
m_show_layer_manager_tools = true;
|
||||
m_HotkeysZoomAndGridList = g_Board_Editor_Hokeys_Descr;
|
||||
m_hotkeysDescrList = g_Board_Editor_Hokeys_Descr;
|
||||
m_hasAutoSave = true;
|
||||
m_RecordingMacros = -1;
|
||||
m_microWaveToolBar = NULL;
|
||||
|
|
Loading…
Reference in New Issue