Hook up 3D viewer to common preferences.

Also removes nanny limits on text sizes.

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

Fixes: lp:1794345
* https://bugs.launchpad.net/kicad/+bug/1794345
This commit is contained in:
Jeff Young 2018-09-25 20:23:54 +01:00
parent dfd028a66a
commit 86b654e493
10 changed files with 44 additions and 41 deletions

View File

@ -37,7 +37,7 @@
#include "panel_prev_model.h"
#include <class_board.h>
#include <class_drawpanel.h>
#include <pgm_base.h>
PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE* aModule,
std::vector<MODULE_3D_SETTINGS> *aParentModelList ) :
@ -57,8 +57,10 @@ PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE*
// Set 3d viewer configuration for preview
m_settings3Dviewer = new CINFO3D_VISU();
m_settings3Dviewer->SetFlag( FL_MOUSEWHEEL_PANNING,
aFrame->GetCanvas()->GetEnableMousewheelPan() );
bool option;
Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option, false );
m_settings3Dviewer->SetFlag( FL_MOUSEWHEEL_PANNING, option );
// Create the 3D canvas
m_previewPane = new EDA_3D_CANVAS( this, COGL_ATT_LIST::GetAttributesList( true ),

View File

@ -138,12 +138,6 @@ void EDA_3D_VIEWER::CreateMenuBar()
menuBar->Append( prefsMenu, _( "&Preferences" ) );
AddMenuItem( prefsMenu, ID_MENU3D_MOUSEWHEEL_PANNING,
_( "Use Touchpad to Pan" ),
KiBitmap( tools_xpm ), wxITEM_CHECK );
prefsMenu->AppendSeparator();
AddMenuItem( prefsMenu, ID_TOOL_SET_VISIBLE_ITEMS,
_( "Display Options" ),
KiBitmap( read_setup_xpm ) );
@ -368,10 +362,6 @@ void EDA_3D_VIEWER::SetMenuBarOptionsState()
wxMenuItem* item;
// Set the state of toggle menus according to the current display options
item = menuBar->FindItem( ID_MENU3D_MOUSEWHEEL_PANNING );
item->Check( m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) );
item = menuBar->FindItem( ID_MENU3D_ENGINE_OPENGL_LEGACY );
item->Check( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY );

View File

@ -38,6 +38,7 @@
#include <hotkeys_basic.h>
#include <wx/toolbar.h>
#include <bitmaps.h>
#include <pgm_base.h>
/**
* Trace mask used to enable or disable the trace output of this class.
@ -158,6 +159,10 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent,
icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
SetIcon( icon );
bool option;
Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option, false );
m_settings.SetFlag( FL_MOUSEWHEEL_PANNING, option );
LoadSettings( config() );
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
@ -374,10 +379,6 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
Set3DBoardBodyColorFromUser();
break;
case ID_MENU3D_MOUSEWHEEL_PANNING:
m_settings.SetFlag( FL_MOUSEWHEEL_PANNING, isChecked );
break;
case ID_MENU3D_REALISTIC_MODE:
m_settings.SetFlag( FL_USE_REALISTIC_MODE, isChecked );
SetMenuBarOptionsState();
@ -724,9 +725,6 @@ void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
bool tmp;
aCfg->Read( keyMousewheelPanning, &tmp, false );
m_settings.SetFlag( FL_MOUSEWHEEL_PANNING, tmp );
aCfg->Read( keyShowRealisticMode, &tmp, true );
m_settings.SetFlag( FL_USE_REALISTIC_MODE, tmp );
@ -843,8 +841,6 @@ void EDA_3D_VIEWER::SaveSettings( wxConfigBase *aCfg )
aCfg->Write( keyShowRealisticMode, m_settings.GetFlag( FL_USE_REALISTIC_MODE ) );
aCfg->Write( keyMousewheelPanning, m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) );
aCfg->Write( keyRenderEngine, (int)m_settings.RenderEngineGet() );
aCfg->Write( keyRenderMaterial, (int)m_settings.MaterialModeGet() );

View File

@ -56,7 +56,6 @@ enum id_3dview_frm
ID_MENU3D_COMMENTS_ONOFF,
ID_MENU3D_ECO_ONOFF,
ID_MENU3D_SHOW_BOARD_BODY,
ID_MENU3D_MOUSEWHEEL_PANNING,
ID_MENU3D_REALISTIC_MODE,
ID_MENU3D_FL,

View File

@ -800,8 +800,7 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
// Read grid color:
COLOR4D wtmp = COLOR4D::UNSPECIFIED;
if( wtmp.SetFromWxString( aCfg->Read(
baseCfgName + GridColorEntryKeyword, wxT( "NONE" ) ) ) )
if( wtmp.SetFromWxString( aCfg->Read( baseCfgName + GridColorEntryKeyword, wxT( "NONE" ) ) ) )
SetGridColor( wtmp );
aCfg->Read( baseCfgName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L );

View File

@ -571,6 +571,8 @@ public:
void LoadSettings( wxConfigBase* aCfg ) override;
void SaveSettings( wxConfigBase* aCfg ) override;
void CommonSettingsChanged() override;
bool InvokeDialogGrid();
void OnTogglePolarCoords( wxCommandEvent& aEvent );

View File

@ -996,9 +996,6 @@ void FOOTPRINT_EDIT_FRAME::CommonSettingsChanged()
{
PCB_BASE_EDIT_FRAME::CommonSettingsChanged();
ReCreateHToolbar();
ReCreateVToolbar();
ReCreateOptToolbar();
Layout();
SendSizeEvent();
}

View File

@ -38,7 +38,7 @@
#include <pcb_base_frame.h>
#include <base_units.h>
#include <msgpanel.h>
#include <pgm_base.h>
#include <3d_viewer/eda_3d_viewer.h> // To include VIEWER3D_FRAMENAME
#include <pcbnew.h>
@ -112,7 +112,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
{
m_Pcb = NULL;
m_UserGridSize = wxPoint( 10 * IU_PER_MILS, 10 * IU_PER_MILS );
m_UserGridSize = wxPoint( (int) 10 * IU_PER_MILS, (int) 10 * IU_PER_MILS );
m_Collector = new GENERAL_COLLECTOR();
m_FastGrid1 = 0;
@ -405,10 +405,10 @@ double PCB_BASE_FRAME::BestZoom()
// Find the first child dialog.
wxWindow* findDialog( wxWindowList& aList )
{
for( wxWindowList::iterator iter = aList.begin(); iter != aList.end(); ++iter )
for( wxWindow* window : aList )
{
if( dynamic_cast<DIALOG_SHIM*>( *iter ) )
return *iter;
if( dynamic_cast<DIALOG_SHIM*>( window ) )
return window;
}
return NULL;
}
@ -467,7 +467,7 @@ void PCB_BASE_FRAME::FocusOnLocation( const wxPoint& aPos,
// Virtual function
void PCB_BASE_FRAME::ReCreateMenuBar( void )
void PCB_BASE_FRAME::ReCreateMenuBar()
{
}
@ -1061,6 +1061,26 @@ void PCB_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
}
void PCB_BASE_FRAME::CommonSettingsChanged()
{
EDA_DRAW_FRAME::CommonSettingsChanged();
ReCreateHToolbar();
ReCreateAuxiliaryToolbar();
ReCreateVToolbar();
ReCreateOptToolbar();
EDA_3D_VIEWER* viewer = Get3DViewerFrame();
if( viewer )
{
bool option;
Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option );
viewer->GetSettings().SetFlag( FL_MOUSEWHEEL_PANNING, option );
}
}
void PCB_BASE_FRAME::OnModify()
{
GetScreen()->SetModify();

View File

@ -1315,11 +1315,8 @@ void PCB_EDIT_FRAME::CommonSettingsChanged()
{
PCB_BASE_EDIT_FRAME::CommonSettingsChanged();
ReCreateHToolbar();
ReCreateAuxiliaryToolbar();
ReCreateVToolbar();
ReCreateOptToolbar();
ReCreateMicrowaveVToolbar();
Layout();
SendSizeEvent();
}

View File

@ -63,9 +63,10 @@ enum ENDPOINT_T {
#define DIM_ANCRE_MODULE 3 // Anchor size (footprint center)
#define TEXTS_MIN_SIZE Mils2iu( 5 ) ///< Minimum text size in Pcbnew units value (5 mils)
#define TEXTS_MAX_SIZE Mils2iu( 1000 ) ///< Maximum text size in Pcbnew units value (1 inch) )
#define TEXTS_MAX_WIDTH Mils2iu( 500 ) ///< Maximum text width in Pcbnew units value (0.5 inches)
// These are only here for algorithmic safety, not to tell the user what to do
#define TEXTS_MIN_SIZE Mils2iu( 1 ) ///< Minimum text size in internal units (1 mil)
#define TEXTS_MAX_SIZE Mils2iu( 10000 ) ///< Maximum text size in internal units (10 inches)
#define TEXTS_MAX_WIDTH Mils2iu( 10000 ) ///< Maximum text width in internal units (10 inches)
// Flag to force the SKETCH mode to display items (.m_Flags member)