Strip illegal chars from 3D filepath and change rotation increment to 90deg.

Fixes: lp:1823559
* https://bugs.launchpad.net/kicad/+bug/1823559
This commit is contained in:
Jeff Young 2019-08-08 23:01:48 +01:00
parent 885497ec1f
commit 17d015ed5d
4 changed files with 15 additions and 9 deletions

View File

@ -100,8 +100,8 @@ void PANEL_PREV_3D::initPanel()
m_spinXoffset,m_spinYoffset, m_spinZoffset
};
for( int ii = 0; ii < 9; ii++ )
spinButtonList[ii]->SetRange( INT_MIN, INT_MAX );
for( wxSpinButton* button : spinButtonList )
button->SetRange(INT_MIN, INT_MAX );
}

View File

@ -50,8 +50,8 @@
#define SCALE_INCREMENT_FINE 0.02
#define SCALE_INCREMENT 0.1
#define ROTATION_INCREMENT 5 // in degrees, for spin button command
#define ROTATION_INCREMENT_WHEEL 15 // in degrees, for mouse wheel command
#define ROTATION_INCREMENT 90 // in degrees, for spin button command
#define ROTATION_INCREMENT_WHEEL 90 // in degrees, for mouse wheel command
#define ROTATION_INCREMENT_WHEEL_FINE 1 // in degrees, for mouse wheel command
#define OFFSET_INCREMENT_MM 0.5

View File

@ -26,8 +26,6 @@
#include <fctsys.h>
#include <kiface_i.h>
#include <view/view.h>
#include <gr_basic.h>
#include <confirm.h>
#include <pcbnew.h>
#include <pgm_base.h>
@ -437,6 +435,10 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged( wxGridEvent& aEvent )
FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
wxString filename = m_modelsGrid->GetCellValue( aEvent.GetRow(), 0 );
filename.Replace( "\n", "" );
filename.Replace( "\r", "" );
filename.Replace( "\t", "" );
if( filename.empty() || !res->ValidateFileName( filename, hasAlias ) )
{
m_delayedErrorMessage = wxString::Format( _( "Invalid filename: %s" ), filename );
@ -456,6 +458,7 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged( wxGridEvent& aEvent )
#endif
m_shapes3D_list[ aEvent.GetRow() ].m_Filename = filename;
m_modelsGrid->SetCellValue( aEvent.GetRow(), 0, filename );
}
else if( aEvent.GetCol() == 1 )
{

View File

@ -4,7 +4,7 @@
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -25,8 +25,6 @@
*/
#include <fctsys.h>
#include <base_units.h>
#include <view/view.h>
#include <confirm.h>
#include <dialog_text_entry.h>
#include <pcbnew.h>
@ -358,6 +356,10 @@ void DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged( wxGridEvent& aEvent )
FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
wxString filename = m_modelsGrid->GetCellValue( aEvent.GetRow(), 0 );
filename.Replace( "\n", "" );
filename.Replace( "\r", "" );
filename.Replace( "\t", "" );
if( filename.empty() || !res->ValidateFileName( filename, hasAlias ) )
{
m_delayedErrorMessage = wxString::Format( _( "Invalid filename: %s" ), filename );
@ -378,6 +380,7 @@ void DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged( wxGridEvent& aEvent )
#endif
m_shapes3D_list[ aEvent.GetRow() ].m_Filename = filename;
m_modelsGrid->SetCellValue( aEvent.GetRow(), 0, filename );
}
else if( aEvent.GetCol() == 1 )
{