5
5
/*
6
6
* This program source code file is part of KiCad, a free EDA CAD application.
7
7
*
8
- * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
8
+ * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
9
9
*
10
10
* This program is free software; you can redistribute it and/or
11
11
* modify it under the terms of the GNU General Public License
@@ -46,14 +46,14 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
46
46
m_plotOpts( aParent->GetPlotSettings () )
47
47
{
48
48
m_config = Kiface ().KifaceSettings ();
49
- Init_Dialog ();
49
+ init_Dialog ();
50
50
51
51
GetSizer ()->Fit ( this );
52
52
GetSizer ()->SetSizeHints ( this );
53
53
}
54
54
55
55
56
- void DIALOG_PLOT::Init_Dialog ()
56
+ void DIALOG_PLOT::init_Dialog ()
57
57
{
58
58
wxString msg;
59
59
wxFileName fileName;
@@ -195,10 +195,10 @@ void DIALOG_PLOT::Init_Dialog()
195
195
setPlotModeChoiceSelection ( m_plotOpts.GetPlotMode () );
196
196
197
197
// Plot outline mode
198
- m_plotOutlineModeOpt ->SetValue ( m_plotOpts.GetPlotOutlineMode () );
198
+ m_DXF_plotModeOpt ->SetValue ( m_plotOpts.GetDXFPlotPolygonMode () );
199
199
200
200
// Plot text mode
201
- m_plotTextAsLineOpt ->SetValue ( m_plotOpts.GetTextMode () == PLOTTEXTMODE_DEFAULT );
201
+ m_DXF_plotTextStrokeFontOpt ->SetValue ( m_plotOpts.GetTextMode () == PLOTTEXTMODE_DEFAULT );
202
202
203
203
// Plot mirror option
204
204
m_plotMirrorOpt->SetValue ( m_plotOpts.GetMirror () );
@@ -294,11 +294,16 @@ void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event )
294
294
}
295
295
296
296
297
- void DIALOG_PLOT::OnChangeOutlineMode ( wxCommandEvent& event )
297
+ void DIALOG_PLOT::OnChangeDXFPlotMode ( wxCommandEvent& event )
298
298
{
299
- m_plotTextAsLineOpt->Enable ( !m_plotOutlineModeOpt->GetValue () );
300
- if ( !m_plotTextAsLineOpt->IsEnabled () )
301
- m_plotTextAsLineOpt->SetValue ( true );
299
+ // m_DXF_plotTextStrokeFontOpt is disabled if m_DXF_plotModeOpt
300
+ // is checked (plot in DXF polygon mode)
301
+ m_DXF_plotTextStrokeFontOpt->Enable ( !m_DXF_plotModeOpt->GetValue () );
302
+
303
+ // if m_DXF_plotTextStrokeFontOpt option is disabled (plot DXF in polygon mode),
304
+ // force m_DXF_plotTextStrokeFontOpt to true to use Pcbnew stroke font
305
+ if ( !m_DXF_plotTextStrokeFontOpt->IsEnabled () )
306
+ m_DXF_plotTextStrokeFontOpt->SetValue ( true );
302
307
}
303
308
304
309
@@ -369,15 +374,16 @@ PlotFormat DIALOG_PLOT::getPlotFormat()
369
374
// and clear also some optional values
370
375
void DIALOG_PLOT::SetPlotFormat ( wxCommandEvent& event )
371
376
{
377
+ // this option exist only in DXF format:
378
+ m_DXF_plotModeOpt->Enable ( getPlotFormat () == PLOT_FORMAT_DXF );
379
+
372
380
switch ( getPlotFormat () )
373
381
{
374
382
case PLOT_FORMAT_PDF:
375
383
case PLOT_FORMAT_SVG:
376
384
m_drillShapeOpt->Enable ( true );
377
385
m_plotModeOpt->Enable ( false );
378
386
setPlotModeChoiceSelection ( FILLED );
379
- m_plotOutlineModeOpt->Enable ( false );
380
- m_plotOutlineModeOpt->SetValue ( false );
381
387
m_plotMirrorOpt->Enable ( true );
382
388
m_useAuxOriginCheckBox->Enable ( false );
383
389
m_useAuxOriginCheckBox->SetValue ( false );
@@ -399,19 +405,16 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
399
405
m_plotPSNegativeOpt->Enable ( true );
400
406
m_forcePSA4OutputOpt->Enable ( false );
401
407
m_forcePSA4OutputOpt->SetValue ( false );
402
- m_plotTextAsLineOpt->Enable ( false );
403
- m_plotTextAsLineOpt->SetValue ( false );
404
408
405
409
m_PlotOptionsSizer->Hide ( m_GerberOptionsSizer );
406
410
m_PlotOptionsSizer->Hide ( m_HPGLOptionsSizer );
407
411
m_PlotOptionsSizer->Hide ( m_PSOptionsSizer );
412
+ m_PlotOptionsSizer->Hide ( m_SizerDXF_options );
408
413
break ;
409
414
410
415
case PLOT_FORMAT_POST:
411
416
m_drillShapeOpt->Enable ( true );
412
417
m_plotModeOpt->Enable ( true );
413
- m_plotOutlineModeOpt->Enable ( false );
414
- m_plotOutlineModeOpt->SetValue ( false );
415
418
m_plotMirrorOpt->Enable ( true );
416
419
m_useAuxOriginCheckBox->Enable ( false );
417
420
m_useAuxOriginCheckBox->SetValue ( false );
@@ -431,21 +434,18 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
431
434
m_PSFineAdjustWidthOpt->Enable ( true );
432
435
m_plotPSNegativeOpt->Enable ( true );
433
436
m_forcePSA4OutputOpt->Enable ( true );
434
- m_plotTextAsLineOpt->Enable ( false );
435
- m_plotTextAsLineOpt->SetValue ( true );
436
437
437
438
m_PlotOptionsSizer->Hide ( m_GerberOptionsSizer );
438
439
m_PlotOptionsSizer->Hide ( m_HPGLOptionsSizer );
439
440
m_PlotOptionsSizer->Show ( m_PSOptionsSizer );
441
+ m_PlotOptionsSizer->Hide ( m_SizerDXF_options );
440
442
break ;
441
443
442
444
case PLOT_FORMAT_GERBER:
443
445
m_drillShapeOpt->Enable ( false );
444
446
m_drillShapeOpt->SetSelection ( 0 );
445
447
m_plotModeOpt->Enable ( false );
446
448
setPlotModeChoiceSelection ( FILLED );
447
- m_plotOutlineModeOpt->Enable ( false );
448
- m_plotOutlineModeOpt->SetValue ( false );
449
449
m_plotMirrorOpt->Enable ( false );
450
450
m_plotMirrorOpt->SetValue ( false );
451
451
m_useAuxOriginCheckBox->Enable ( true );
@@ -465,19 +465,16 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
465
465
m_plotPSNegativeOpt->SetValue ( false );
466
466
m_forcePSA4OutputOpt->Enable ( false );
467
467
m_forcePSA4OutputOpt->SetValue ( false );
468
- m_plotTextAsLineOpt->Enable ( false );
469
- m_plotTextAsLineOpt->SetValue ( true );
470
468
471
469
m_PlotOptionsSizer->Show ( m_GerberOptionsSizer );
472
470
m_PlotOptionsSizer->Hide ( m_HPGLOptionsSizer );
473
471
m_PlotOptionsSizer->Hide ( m_PSOptionsSizer );
472
+ m_PlotOptionsSizer->Hide ( m_SizerDXF_options );
474
473
break ;
475
474
476
475
case PLOT_FORMAT_HPGL:
477
476
m_drillShapeOpt->Enable ( true );
478
477
m_plotModeOpt->Enable ( true );
479
- m_plotOutlineModeOpt->Enable ( false );
480
- m_plotOutlineModeOpt->SetValue ( false );
481
478
m_plotMirrorOpt->Enable ( true );
482
479
m_useAuxOriginCheckBox->Enable ( false );
483
480
m_useAuxOriginCheckBox->SetValue ( false );
@@ -498,19 +495,17 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
498
495
m_plotPSNegativeOpt->SetValue ( false );
499
496
m_plotPSNegativeOpt->Enable ( false );
500
497
m_forcePSA4OutputOpt->Enable ( true );
501
- m_plotTextAsLineOpt->Enable ( false );
502
- m_plotTextAsLineOpt->SetValue ( true );
503
498
504
499
m_PlotOptionsSizer->Hide ( m_GerberOptionsSizer );
505
500
m_PlotOptionsSizer->Show ( m_HPGLOptionsSizer );
506
501
m_PlotOptionsSizer->Hide ( m_PSOptionsSizer );
502
+ m_PlotOptionsSizer->Hide ( m_SizerDXF_options );
507
503
break ;
508
504
509
505
case PLOT_FORMAT_DXF:
510
506
m_drillShapeOpt->Enable ( true );
511
507
m_plotModeOpt->Enable ( false );
512
508
setPlotModeChoiceSelection ( FILLED );
513
- m_plotOutlineModeOpt->Enable ( true );
514
509
m_plotMirrorOpt->Enable ( false );
515
510
m_plotMirrorOpt->SetValue ( false );
516
511
m_useAuxOriginCheckBox->Enable ( true );
@@ -537,8 +532,9 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
537
532
m_PlotOptionsSizer->Hide ( m_GerberOptionsSizer );
538
533
m_PlotOptionsSizer->Hide ( m_HPGLOptionsSizer );
539
534
m_PlotOptionsSizer->Hide ( m_PSOptionsSizer );
535
+ m_PlotOptionsSizer->Show ( m_SizerDXF_options );
540
536
541
- OnChangeOutlineMode ( event );
537
+ OnChangeDXFPlotMode ( event );
542
538
break ;
543
539
544
540
default :
@@ -612,10 +608,14 @@ void DIALOG_PLOT::applyPlotSettings()
612
608
( m_drillShapeOpt->GetSelection () ) );
613
609
tempOptions.SetMirror ( m_plotMirrorOpt->GetValue () );
614
610
tempOptions.SetPlotMode ( m_plotModeOpt->GetSelection () == 1 ? SKETCH : FILLED );
615
- tempOptions.SetPlotOutlineMode ( m_plotOutlineModeOpt ->GetValue () );
611
+ tempOptions.SetDXFPlotPolygonMode ( m_DXF_plotModeOpt ->GetValue () );
616
612
tempOptions.SetPlotViaOnMaskLayer ( m_plotNoViaOnMaskOpt->GetValue () );
617
- tempOptions.SetTextMode ( m_plotTextAsLineOpt->GetValue () ?
618
- PLOTTEXTMODE_DEFAULT : PLOTTEXTMODE_NATIVE );
613
+
614
+ if ( !m_DXF_plotTextStrokeFontOpt->IsEnabled () ) // Currently, only DXF supports this option
615
+ tempOptions.SetTextMode ( PLOTTEXTMODE_DEFAULT );
616
+ else
617
+ tempOptions.SetTextMode ( m_DXF_plotTextStrokeFontOpt->GetValue () ?
618
+ PLOTTEXTMODE_DEFAULT : PLOTTEXTMODE_NATIVE );
619
619
620
620
// Update settings from text fields. Rewrite values back to the fields,
621
621
// since the values may have been constrained by the setters.
@@ -731,11 +731,15 @@ void DIALOG_PLOT::applyPlotSettings()
731
731
dirStr.Replace ( wxT ( " \\ " ), wxT ( " /" ) );
732
732
tempOptions.SetOutputDirectory ( dirStr );
733
733
734
- if ( m_plotOpts != tempOptions )
734
+ if ( ! m_plotOpts. IsSameAs ( tempOptions, false ) )
735
735
{
736
+ // First, mark board as modified only for parameters saved in file
737
+ if ( !m_plotOpts.IsSameAs ( tempOptions, true ) )
738
+ m_parent->OnModify ();
739
+
740
+ // Now, save any change, for the session
736
741
m_parent->SetPlotSettings ( tempOptions );
737
742
m_plotOpts = tempOptions;
738
- m_parent->OnModify ();
739
743
}
740
744
}
741
745
0 commit comments