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_endMouseCaptureCallback = NULL;
wxConfigBase* cfg = Kiface().KifaceSettings();
if( cfg )
{
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 );
}
Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &m_enableMousewheelPan, false );
Pgm().CommonSettings()->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false );
Pgm().CommonSettings()->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true );
m_requestAutoPan = false;
m_enableBlockCommands = false;

View File

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

View File

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

View File

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

View File

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