~stol/kicad/bug593968

« back to all changes in this revision

Viewing changes to pcbnew/files.cpp

  • Committer: stol at bredband
  • Date: 2015-09-19 15:16:13 UTC
  • Revision ID: stol@bredband.net-20150919151613-cmgdy24q3p3prdnf
Bug593968 Possible to set Edge cut lines at creation of pcb

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include <kicad_string.h>
35
35
#include <gestfich.h>
36
36
#include <wxPcbStruct.h>
37
 
#include <macros.h>
38
37
#include <3d_viewer.h>
39
 
#include <richio.h>
40
 
#include <filter_reader.h>
41
38
#include <pgm_base.h>
42
 
#include <msgpanel.h>
43
39
#include <fp_lib_table.h>
44
40
 
45
41
#include <pcbnew.h>
46
42
#include <pcbnew_id.h>
47
 
#include <io_mgr.h>
48
43
#include <wildcards_and_files_ext.h>
49
44
 
50
45
#include <class_board.h>
51
46
#include <build_version.h>      // LEGACY_BOARD_FILE_VERSION
52
 
#include <module_editor_frame.h>
53
 
#include <modview_frame.h>
 
47
 
 
48
#include <dialog_pcb_setup.h>
 
49
#include <pcb_draw_panel_gal.h>
 
50
#include <invoke_pcb_dialog.h>
54
51
 
55
52
 
56
53
//#define     USE_INSTRUMENTATION     true
387
384
 
388
385
bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
389
386
{
 
387
    bool                use_DialogPCBSetup = false;
 
388
    DIALOG_PCB_SETUP*   pcbSetupDlg = NULL;
 
389
 
390
390
    // This is for python:
391
391
    if( aFileSet.size() != 1 )
392
392
    {
445
445
                );
446
446
        if( !IsOK( this, ask ) )
447
447
            return false;
 
448
 
 
449
        //
 
450
        // Ask the user how large the pcb should be
 
451
        // and add the edge lines to the newly created board
 
452
        //
 
453
        // Use this->GetParent() so it will be centered on the basic window
 
454
        // and not on the, still invisible, pcb window
 
455
        //
 
456
        pcbSetupDlg = new DIALOG_PCB_SETUP( this->GetParent() );
 
457
 
 
458
        if( pcbSetupDlg->ShowModal() == wxID_OK )
 
459
        {
 
460
            use_DialogPCBSetup = true;
 
461
        }
448
462
    }
449
463
 
450
464
    Clear_Pcb( false );     // pass false since we prompted above for a modified board
595
609
    if( m_Draw3DFrame )
596
610
        m_Draw3DFrame->NewDisplay();
597
611
 
 
612
    if ( use_DialogPCBSetup && ( pcbSetupDlg != NULL ) )
 
613
    {
 
614
        //
 
615
        pcbSetupDlg->AddEdgeCuts( this );
 
616
        //
 
617
        // Use this->GetParent() so it will be centered on the basic window
 
618
        // and not on the, still invisible, pcb window
 
619
        //
 
620
        if( InvokeLayerSetup( this, GetBoard() ) )
 
621
        {
 
622
            LAYER_ID cur_layer = GetActiveLayer();
 
623
 
 
624
            // If after showing the dialog the user has removed the active layer,
 
625
            // then select a new active layer (front copper layer).
 
626
            if( !GetBoard()->GetEnabledLayers()[ cur_layer ] )
 
627
                cur_layer = F_Cu;
 
628
 
 
629
            SetActiveLayer( cur_layer );
 
630
 
 
631
            OnModify();
 
632
            ReCreateLayerBox();
 
633
            ReFillLayerWidget();
 
634
 
 
635
            if( IsGalCanvasActive() )
 
636
                static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( GetBoard() );
 
637
        }
 
638
    }
 
639
 
598
640
#if 0 && defined(DEBUG)
599
641
    // Output the board object tree to stdout, but please run from command prompt:
600
642
    GetBoard()->Show( 0, std::cout );