pcbnew test scale values when printing/ploting to avoid 0 scale or others stupid values
(scale now allowed from 0.01 to 100)
This commit is contained in:
parent
c333da1916
commit
a3a4bbc03b
File diff suppressed because it is too large
Load Diff
|
@ -26,12 +26,15 @@ static long s_SelectedLayers;
|
|||
static double s_ScaleList[] =
|
||||
{ 0, 0.5, 0.7, 0.999, 1.0, 1.4, 2.0, 3.0, 4.0 };
|
||||
|
||||
// Define min et max reasonnable values for print scale
|
||||
#define MIN_SCALE 0.01
|
||||
#define MAX_SCALE 100.0
|
||||
|
||||
// static print data and page setup data, to remember settings during the session
|
||||
static wxPrintData* g_PrintData;
|
||||
|
||||
// Variables locales
|
||||
static int s_PrintPenMinWidth = 1;
|
||||
static int s_PrintPenMinWidth = 50; // A reasonnable value to draw items that do dot have aspecifed line width
|
||||
static int s_PrintMaskLayer;
|
||||
static int s_OptionPrintPage = 0;
|
||||
static int s_Print_Black_and_White = TRUE;
|
||||
|
@ -189,6 +192,7 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
|
|||
m_Exclude_Edges_Pcb->Show( true );
|
||||
#endif
|
||||
|
||||
m_XScaleAdjust = m_YScaleAdjust = 1.0; // Default value for scale
|
||||
// Read the scale adjust option
|
||||
if( m_Config )
|
||||
{
|
||||
|
@ -197,6 +201,10 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
|
|||
m_Config->Read( OPTKEY_PRINT_Y_FINESCALE_ADJ, &m_YScaleAdjust );
|
||||
m_Config->Read( OPTKEY_PRINT_SCALE, &s_Scale_Select );
|
||||
|
||||
// Test for a reasonnable scale value. Set to 1 if problem
|
||||
if ( m_XScaleAdjust < MIN_SCALE || m_YScaleAdjust < MIN_SCALE || m_XScaleAdjust > MAX_SCALE || m_YScaleAdjust > MAX_SCALE )
|
||||
m_XScaleAdjust = m_YScaleAdjust = 1.0;
|
||||
|
||||
s_SelectedLayers = 0;
|
||||
for( int layer = 0; layer<layer_max; ++layer )
|
||||
{
|
||||
|
@ -611,6 +619,12 @@ void EDA_Printout::DrawPage()
|
|||
scaleY = (double) SheetSize.y / PlotAreaSize.y;
|
||||
scale = wxMax( scaleX, scaleY ) / userscale; // Use x or y scaling factor, whichever fits on the DC
|
||||
|
||||
if ( m_PrintFrame->m_XScaleAdjust > MAX_SCALE || m_PrintFrame->m_YScaleAdjust > MAX_SCALE )
|
||||
DisplayInfo(NULL, _("Warning: Scale option set to a very large value") );
|
||||
// Test for a reasonnable scale value
|
||||
if ( m_PrintFrame->m_XScaleAdjust < MIN_SCALE || m_PrintFrame->m_YScaleAdjust < MIN_SCALE )
|
||||
DisplayInfo(NULL, _("Warning: Scale option set to a very small value") );
|
||||
|
||||
// ajust the real draw scale
|
||||
double accurate_Xscale, accurate_Yscale;
|
||||
dc->SetUserScale( DrawZoom / scale * m_PrintFrame->m_XScaleAdjust,
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
#define OPTKEY_ALWAYS_PRINT_PADS wxT( "PlotAlwaysPads" )
|
||||
#define OPTKEY_OUTPUT_FORMAT wxT( "PlotOutputFormat" )
|
||||
|
||||
// Define min et max reasonnable values for print scale
|
||||
#define MIN_SCALE 0.01
|
||||
#define MAX_SCALE 100.0
|
||||
|
||||
|
||||
static long s_SelectedLayers = CUIVRE_LAYER | CMP_LAYER |
|
||||
SILKSCREEN_LAYER_CMP | SILKSCREEN_LAYER_CU;
|
||||
|
@ -259,6 +263,10 @@ void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event )
|
|||
config->Read( OPTKEY_YFINESCALE_ADJ, &m_YScaleAdjust );
|
||||
}
|
||||
|
||||
// Test for a reasonnable scale value. Set to 1 if problem
|
||||
if ( m_XScaleAdjust < MIN_SCALE || m_YScaleAdjust < MIN_SCALE || m_XScaleAdjust > MAX_SCALE || m_YScaleAdjust > MAX_SCALE )
|
||||
m_XScaleAdjust = m_YScaleAdjust = 1.0;
|
||||
|
||||
m_FineAdjustXscaleOpt = new WinEDA_DFloatValueCtrl( this,
|
||||
_( "X scale adjust" ), m_XScaleAdjust,
|
||||
RightBoxSizer );
|
||||
|
@ -688,9 +696,9 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
// Test for a reasonnable scale value
|
||||
if ( Scale_X < 0.01 || Scale_Y < 0.01 )
|
||||
if ( Scale_X < MIN_SCALE || Scale_Y < MIN_SCALE )
|
||||
DisplayInfo(this, _("Warning: Scale option set to a very small value") );
|
||||
if ( Scale_X > 100.0 || Scale_Y > 100.0 )
|
||||
if ( Scale_X > MAX_SCALE || Scale_Y > MAX_SCALE )
|
||||
DisplayInfo(this, _("Warning: Scale option set to a very large value") );
|
||||
|
||||
int mask = 1;
|
||||
|
|
Loading…
Reference in New Issue