Create CvPcb's footprint viewer through Kiway().Player()

This allows it to participate in Kiway things such as updating
language or common settings.

Fixes: lp:1779558
* https://bugs.launchpad.net/kicad/+bug/1779558

(cherry picked from commit b3f8478)
This commit is contained in:
Jeff Young 2018-07-01 15:48:35 +01:00
parent df863e44e2
commit 34857d06c4
6 changed files with 32 additions and 37 deletions

View File

@ -121,14 +121,9 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_mouseCaptureCallback = NULL; m_mouseCaptureCallback = NULL;
m_endMouseCaptureCallback = NULL; m_endMouseCaptureCallback = NULL;
wxConfigBase* cfg = Kiface().KifaceSettings(); Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &m_enableMousewheelPan, false );
Pgm().CommonSettings()->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false );
if( cfg ) Pgm().CommonSettings()->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true );
{
cfg->Read( ENBL_MOUSEWHEEL_PAN_KEY, &m_enableMousewheelPan, false );
cfg->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false );
cfg->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true );
}
m_requestAutoPan = false; m_requestAutoPan = false;
m_enableBlockCommands = false; m_enableBlockCommands = false;

View File

@ -252,8 +252,11 @@ void EDA_BASE_FRAME::ReCreateMenuBar()
void EDA_BASE_FRAME::ShowChangedLanguage() void EDA_BASE_FRAME::ShowChangedLanguage()
{ {
ReCreateMenuBar(); if( GetMenuBar() )
GetMenuBar()->Refresh(); {
ReCreateMenuBar();
GetMenuBar()->Refresh();
}
} }
@ -263,9 +266,12 @@ void EDA_BASE_FRAME::CommonSettingsChanged()
Pgm().CommonSettings()->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval ); Pgm().CommonSettings()->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval );
SetAutoSaveInterval( autosaveInterval ); SetAutoSaveInterval( autosaveInterval );
// For icons in menus & icon scaling if( GetMenuBar() )
ReCreateMenuBar(); {
GetMenuBar()->Refresh(); // For icons in menus & icon scaling
ReCreateMenuBar();
GetMenuBar()->Refresh();
}
} }

View File

@ -36,6 +36,7 @@
#include <cvpcb.h> #include <cvpcb.h>
#include <cvpcb_mainframe.h> #include <cvpcb_mainframe.h>
#include <display_footprints_frame.h>
#include <cvpcb_id.h> #include <cvpcb_id.h>
#include <build_version.h> #include <build_version.h>
@ -65,11 +66,10 @@ static struct IFACE : public KIFACE_I
switch( aClassId ) switch( aClassId )
{ {
case FRAME_CVPCB: case FRAME_CVPCB:
{ return new CVPCB_MAINFRAME( aKiway, aParent );
CVPCB_MAINFRAME* frame = new CVPCB_MAINFRAME( aKiway, aParent );
return frame; case FRAME_CVPCB_DISPLAY:
} return new DISPLAY_FOOTPRINTS_FRAME( aKiway, aParent );
break;
default: default:
; ;

View File

@ -836,7 +836,7 @@ void CVPCB_MAINFRAME::CreateScreenCmp()
if( !fpframe ) if( !fpframe )
{ {
fpframe = new DISPLAY_FOOTPRINTS_FRAME( &Kiway(), this ); fpframe = (DISPLAY_FOOTPRINTS_FRAME*) Kiway().Player( FRAME_CVPCB_DISPLAY, true, this );
fpframe->Show( true ); fpframe->Show( true );
} }
else else

View File

@ -72,10 +72,10 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
END_EVENT_TABLE() END_EVENT_TABLE()
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRAME* aParent ) : DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ), PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME ) KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME )
{ {
m_showAxis = true; // true to draw axis. m_showAxis = true; // true to draw axis.
@ -259,7 +259,6 @@ void DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent )
aEvent.Check( displ_opts->m_DisplayModTextFill == SKETCH ); aEvent.Check( displ_opts->m_DisplayModTextFill == SKETCH );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i] ); m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i] );
} }

View File

@ -42,8 +42,8 @@ class CVPCB_MAINFRAME;
class DISPLAY_FOOTPRINTS_FRAME : public PCB_BASE_FRAME class DISPLAY_FOOTPRINTS_FRAME : public PCB_BASE_FRAME
{ {
public: public:
DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRAME* aParent ); DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aParent );
~DISPLAY_FOOTPRINTS_FRAME(); ~DISPLAY_FOOTPRINTS_FRAME() override;
void OnCloseWindow( wxCloseEvent& Event ) override; void OnCloseWindow( wxCloseEvent& Event ) override;
@ -55,7 +55,6 @@ public:
void ReCreateHToolbar() override; void ReCreateHToolbar() override;
void ReCreateVToolbar() override; void ReCreateVToolbar() override;
void ReCreateOptToolbar() override; void ReCreateOptToolbar() override;
void RecreateMenuBar();
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
@ -74,7 +73,7 @@ public:
* Function IsGridVisible() , virtual * Function IsGridVisible() , virtual
* @return true if the grid must be shown * @return true if the grid must be shown
*/ */
virtual bool IsGridVisible() const override; bool IsGridVisible() const override;
/** /**
* Function SetGridVisibility() , virtual * Function SetGridVisibility() , virtual
@ -82,12 +81,12 @@ public:
* if you want to store/retrieve the grid visibility in configuration. * if you want to store/retrieve the grid visibility in configuration.
* @param aVisible = true if the grid must be shown * @param aVisible = true if the grid must be shown
*/ */
virtual void SetGridVisibility( bool aVisible ) override; void SetGridVisibility( bool aVisible ) override;
/** /**
* Function GetGridColor() , virtual * Function GetGridColor() , virtual
* @return the color of the grid * @return the color of the grid
*/ */
virtual COLOR4D GetGridColor() override; COLOR4D GetGridColor() override;
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override; void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) override; void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) override;
@ -99,8 +98,6 @@ public:
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription() ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override { return NULL; } EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override { return NULL; }
void Process_Settings( wxCommandEvent& event );
/** /**
* Display 3D frame of current footprint selection. * Display 3D frame of current footprint selection.
*/ */
@ -110,9 +107,8 @@ public:
* currently: do nothing in CvPcb. * currently: do nothing in CvPcb.
* but but be defined because it is a pure virtual in PCB_BASE_FRAME * but but be defined because it is a pure virtual in PCB_BASE_FRAME
*/ */
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UNDO_REDO_T aTypeCommand = UR_UNSPECIFIED,
UNDO_REDO_T aTypeCommand = UR_UNSPECIFIED, const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override
{ {
} }
@ -126,9 +122,8 @@ public:
* @param aTransformPoint = the reference point of the transformation, * @param aTransformPoint = the reference point of the transformation,
* for commands like move * for commands like move
*/ */
virtual void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO_T aTypeCommand,
UNDO_REDO_T aTypeCommand, const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override
{ {
// currently: do nothing in CvPcb. // currently: do nothing in CvPcb.
} }