From dba0494b024cba5a2ed410f8cfc6d1199861e753 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 1 Sep 2015 11:13:22 +0200 Subject: [PATCH] Pcbnew: Rework on dialog global deletions. --- pcbnew/dialogs/dialog_global_deletion.cpp | 251 ++++++------ .../dialogs/dialog_global_deletion_base.cpp | 58 +-- .../dialogs/dialog_global_deletion_base.fbp | 370 +++++++++--------- pcbnew/dialogs/dialog_global_deletion_base.h | 4 +- pcbnew/dialogs/dialog_netlist.cpp | 21 +- pcbnew/initpcb.cpp | 3 +- 6 files changed, 381 insertions(+), 326 deletions(-) diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index 6bbc99893f..157ecfee77 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -94,134 +94,146 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete() m_Parent->SetCurItem( NULL ); + bool delAll = false; + if( m_DelAlls->GetValue() ) { - m_Parent->Clear_Pcb( true ); - } - else - { - if( !IsOK( this, _( "Are you sure you want to delete the selected items?" ) ) ) + if( !IsOK( this, _( "Are you sure you want to delete the entire board?" ) ) ) return; - BOARD* pcb = m_Parent->GetBoard(); - PICKED_ITEMS_LIST pickersList; - ITEM_PICKER itemPicker( NULL, UR_DELETED ); - BOARD_ITEM* item; - BOARD_ITEM* nextitem; - RN_DATA* ratsnest = pcb->GetRatsnest(); + delAll = true; + } + else if( !IsOK( this, _( "Are you sure you want to delete the selected items?" ) ) ) + return; - LSET layers_filter = LSET().set(); + BOARD* pcb = m_Parent->GetBoard(); + PICKED_ITEMS_LIST pickersList; + ITEM_PICKER itemPicker( NULL, UR_DELETED ); + BOARD_ITEM* item; + BOARD_ITEM* nextitem; + RN_DATA* ratsnest = pcb->GetRatsnest(); - if( m_rbLayersOption->GetSelection() != 0 ) // Use current layer only - layers_filter = LSET( ToLAYER_ID( m_currentLayer ) ); + LSET layers_filter = LSET().set(); - if( m_DelZones->GetValue() ) + if( m_rbLayersOption->GetSelection() != 0 ) // Use current layer only + layers_filter = LSET( ToLAYER_ID( m_currentLayer ) ); + + if( delAll || m_DelZones->GetValue() ) + { + int area_index = 0; + item = pcb->GetArea( area_index ); + + while( item ) { - int area_index = 0; + if( delAll || layers_filter[item->GetLayer()] ) + { + itemPicker.SetItem( item ); + pickersList.PushItem( itemPicker ); + pcb->Remove( item ); + item->ViewRelease(); + ratsnest->Remove( item ); + gen_rastnest = true; + } + else + { + area_index++; + } + item = pcb->GetArea( area_index ); + } + } - while( item ) + if( delAll || m_DelDrawings->GetValue() || m_DelBoardEdges->GetValue() ) + { + LSET masque_layer; + + if( m_DelDrawings->GetValue() ) + masque_layer = LSET::AllNonCuMask().set( Edge_Cuts, false ); + + if( m_DelBoardEdges->GetValue() ) + masque_layer.set( Edge_Cuts ); + + masque_layer &= layers_filter; + + for( item = pcb->m_Drawings; item; item = nextitem ) + { + nextitem = item->Next(); + + if( delAll || + ( item->Type() == PCB_LINE_T && masque_layer[item->GetLayer()] ) ) { - if( layers_filter[item->GetLayer()] ) - { - itemPicker.SetItem( item ); - pickersList.PushItem( itemPicker ); - pcb->Remove( item ); - item->ViewRelease(); - ratsnest->Remove( item ); - gen_rastnest = true; - } - else - { - area_index++; - } - - item = pcb->GetArea( area_index ); + itemPicker.SetItem( item ); + pickersList.PushItem( itemPicker ); + item->ViewRelease(); + item->UnLink(); } } + } - if( m_DelDrawings->GetValue() || m_DelBoardEdges->GetValue() ) + if( delAll || m_DelTexts->GetValue() ) + { + LSET del_text_layers = layers_filter; + + for( item = pcb->m_Drawings; item; item = nextitem ) { - LSET masque_layer; + nextitem = item->Next(); - if( m_DelDrawings->GetValue() ) - masque_layer = LSET::AllNonCuMask().set( Edge_Cuts, false ); - - if( m_DelBoardEdges->GetValue() ) - masque_layer.set( Edge_Cuts ); - - masque_layer &= layers_filter; - - for( item = pcb->m_Drawings; item; item = nextitem ) + if( delAll || + ( item->Type() == PCB_TEXT_T && del_text_layers[item->GetLayer()] ) ) { - nextitem = item->Next(); - - if( item->Type() == PCB_LINE_T && masque_layer[item->GetLayer()] ) - { - itemPicker.SetItem( item ); - pickersList.PushItem( itemPicker ); - item->ViewRelease(); - item->UnLink(); - } + itemPicker.SetItem( item ); + pickersList.PushItem( itemPicker ); + item->ViewRelease(); + item->UnLink(); } } + } - if( m_DelTexts->GetValue() ) + if( delAll || m_DelModules->GetValue() ) + { + for( item = pcb->m_Modules; item; item = nextitem ) { - LSET del_text_layers = layers_filter; + nextitem = item->Next(); - for( item = pcb->m_Drawings; item; item = nextitem ) + bool del_fp = delAll; + + if( layers_filter[item->GetLayer()] && + ( ( m_ModuleFilterNormal->GetValue() && !item->IsLocked() ) || + ( m_ModuleFilterLocked->GetValue() && item->IsLocked() ) ) ) + del_fp = true; + + if( del_fp ) { - nextitem = item->Next(); - - if( item->Type() == PCB_TEXT_T && del_text_layers[item->GetLayer()] ) - { - itemPicker.SetItem( item ); - pickersList.PushItem( itemPicker ); - item->ViewRelease(); - item->UnLink(); - } + itemPicker.SetItem( item ); + pickersList.PushItem( itemPicker ); + static_cast( item )->RunOnChildren( + boost::bind( &KIGFX::VIEW_ITEM::ViewRelease, _1 ) ); + ratsnest->Remove( item ); + item->ViewRelease(); + item->UnLink(); + gen_rastnest = true; } } + } - if( m_DelModules->GetValue() ) + if( delAll || m_DelTracks->GetValue() ) + { + STATUS_FLAGS track_mask_filter = 0; + + if( !m_TrackFilterLocked->GetValue() ) + track_mask_filter |= TRACK_LOCKED; + + if( !m_TrackFilterAR->GetValue() ) + track_mask_filter |= TRACK_AR; + + TRACK* nexttrack; + + for( TRACK *track = pcb->m_Track; track; track = nexttrack ) { - for( item = pcb->m_Modules; item; item = nextitem ) + nexttrack = track->Next(); + + if( !delAll ) { - nextitem = item->Next(); - - if( layers_filter[item->GetLayer()] && - ( ( m_ModuleFilterNormal->GetValue() && !item->IsLocked() ) || - ( m_ModuleFilterLocked->GetValue() && item->IsLocked() ) ) ) - { - itemPicker.SetItem( item ); - pickersList.PushItem( itemPicker ); - static_cast( item )->RunOnChildren( - boost::bind( &KIGFX::VIEW_ITEM::ViewRelease, _1 ) ); - ratsnest->Remove( item ); - item->ViewRelease(); - item->UnLink(); - gen_rastnest = true; - } - } - } - - if( m_DelTracks->GetValue() ) - { - STATUS_FLAGS track_mask_filter = 0; - - if( !m_TrackFilterLocked->GetValue() ) - track_mask_filter |= TRACK_LOCKED; - - if( !m_TrackFilterAR->GetValue() ) - track_mask_filter |= TRACK_AR; - - TRACK* nexttrack; - - for( TRACK *track = pcb->m_Track; track; track = nexttrack ) - { - nexttrack = track->Next(); - if( ( track->GetState( TRACK_LOCKED | TRACK_AR ) & track_mask_filter ) != 0 ) continue; @@ -234,30 +246,29 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete() if( ( track->GetLayerSet() & layers_filter ) == 0 ) continue; - - itemPicker.SetItem( track ); - pickersList.PushItem( itemPicker ); - track->ViewRelease(); - ratsnest->Remove( track ); - track->UnLink(); - gen_rastnest = true; } + + itemPicker.SetItem( track ); + pickersList.PushItem( itemPicker ); + track->ViewRelease(); + ratsnest->Remove( track ); + track->UnLink(); + gen_rastnest = true; } - - if( pickersList.GetCount() ) - m_Parent->SaveCopyInUndoList( pickersList, UR_DELETED ); - - if( m_DelMarkers->GetValue() ) - pcb->DeleteMARKERs(); - - if( gen_rastnest ) - m_Parent->Compile_Ratsnest( NULL, true ); - - if( m_Parent->IsGalCanvasActive() ) - pcb->GetRatsnest()->Recalculate(); - } + if( pickersList.GetCount() ) + m_Parent->SaveCopyInUndoList( pickersList, UR_DELETED ); + + if( m_DelMarkers->GetValue() ) + pcb->DeleteMARKERs(); + + if( gen_rastnest ) + m_Parent->Compile_Ratsnest( NULL, true ); + + if( m_Parent->IsGalCanvasActive() ) + pcb->GetRatsnest()->Recalculate(); + m_Parent->GetCanvas()->Refresh(); m_Parent->OnModify(); } diff --git a/pcbnew/dialogs/dialog_global_deletion_base.cpp b/pcbnew/dialogs/dialog_global_deletion_base.cpp index 52930bf276..8a18031d88 100644 --- a/pcbnew/dialogs/dialog_global_deletion_base.cpp +++ b/pcbnew/dialogs/dialog_global_deletion_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 9 2015) +// C++ code generated with wxFormBuilder (version Jun 17 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -22,28 +22,28 @@ DIALOG_GLOBAL_DELETION_BASE::DIALOG_GLOBAL_DELETION_BASE( wxWindow* parent, wxWi wxStaticBoxSizer* sbSizerLeft; sbSizerLeft = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Items to Delete") ), wxVERTICAL ); - m_DelZones = new wxCheckBox( this, wxID_ANY, _("Zones"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DelZones = new wxCheckBox( sbSizerLeft->GetStaticBox(), wxID_ANY, _("Zones"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizerLeft->Add( m_DelZones, 0, wxALL, 5 ); - m_DelTexts = new wxCheckBox( this, wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DelTexts = new wxCheckBox( sbSizerLeft->GetStaticBox(), wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizerLeft->Add( m_DelTexts, 0, wxALL, 5 ); - m_DelBoardEdges = new wxCheckBox( this, wxID_ANY, _("Board outlines"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DelBoardEdges = new wxCheckBox( sbSizerLeft->GetStaticBox(), wxID_ANY, _("Board outlines"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizerLeft->Add( m_DelBoardEdges, 0, wxALL, 5 ); - m_DelDrawings = new wxCheckBox( this, wxID_ANY, _("Drawings"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DelDrawings = new wxCheckBox( sbSizerLeft->GetStaticBox(), wxID_ANY, _("Drawings"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizerLeft->Add( m_DelDrawings, 0, wxALL, 5 ); - m_DelModules = new wxCheckBox( this, wxID_ANY, _("Footprints"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DelModules = new wxCheckBox( sbSizerLeft->GetStaticBox(), wxID_ANY, _("Footprints"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizerLeft->Add( m_DelModules, 0, wxALL, 5 ); - m_DelTracks = new wxCheckBox( this, wxID_ANY, _("Tracks"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DelTracks = new wxCheckBox( sbSizerLeft->GetStaticBox(), wxID_ANY, _("Tracks"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizerLeft->Add( m_DelTracks, 0, wxALL, 5 ); - m_DelMarkers = new wxCheckBox( this, wxID_ANY, _("Markers"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DelMarkers = new wxCheckBox( sbSizerLeft->GetStaticBox(), wxID_ANY, _("Markers"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizerLeft->Add( m_DelMarkers, 0, wxALL, 5 ); - m_DelAlls = new wxCheckBox( this, wxID_ANY, _("Clear Board"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DelAlls = new wxCheckBox( sbSizerLeft->GetStaticBox(), wxID_ANY, _("Clear Board"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizerLeft->Add( m_DelAlls, 0, wxALL, 5 ); @@ -54,25 +54,25 @@ DIALOG_GLOBAL_DELETION_BASE::DIALOG_GLOBAL_DELETION_BASE( wxWindow* parent, wxWi sbFilter = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Filter Settings") ), wxVERTICAL ); - m_TrackFilterAR = new wxCheckBox( this, wxID_ANY, _("Automatically routed tracks"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TrackFilterAR = new wxCheckBox( sbFilter->GetStaticBox(), wxID_ANY, _("Automatically routed tracks"), wxDefaultPosition, wxDefaultSize, 0 ); m_TrackFilterAR->SetValue(true); sbFilter->Add( m_TrackFilterAR, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_TrackFilterLocked = new wxCheckBox( this, wxID_ANY, _("Locked tracks"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TrackFilterLocked = new wxCheckBox( sbFilter->GetStaticBox(), wxID_ANY, _("Locked tracks"), wxDefaultPosition, wxDefaultSize, 0 ); sbFilter->Add( m_TrackFilterLocked, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_TrackFilterNormal = new wxCheckBox( this, wxID_ANY, _("Unlocked tracks"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TrackFilterNormal = new wxCheckBox( sbFilter->GetStaticBox(), wxID_ANY, _("Unlocked tracks"), wxDefaultPosition, wxDefaultSize, 0 ); m_TrackFilterNormal->SetValue(true); sbFilter->Add( m_TrackFilterNormal, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_TrackFilterVias = new wxCheckBox( this, wxID_ANY, _("Vias"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TrackFilterVias = new wxCheckBox( sbFilter->GetStaticBox(), wxID_ANY, _("Vias"), wxDefaultPosition, wxDefaultSize, 0 ); m_TrackFilterVias->SetValue(true); sbFilter->Add( m_TrackFilterVias, 0, wxALL, 5 ); - m_ModuleFilterLocked = new wxCheckBox( this, wxID_ANY, _("Locked footprints"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ModuleFilterLocked = new wxCheckBox( sbFilter->GetStaticBox(), wxID_ANY, _("Locked footprints"), wxDefaultPosition, wxDefaultSize, 0 ); sbFilter->Add( m_ModuleFilterLocked, 0, wxALL, 5 ); - m_ModuleFilterNormal = new wxCheckBox( this, wxID_ANY, _("Unlocked footprints"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ModuleFilterNormal = new wxCheckBox( sbFilter->GetStaticBox(), wxID_ANY, _("Unlocked footprints"), wxDefaultPosition, wxDefaultSize, 0 ); m_ModuleFilterNormal->SetValue(true); sbFilter->Add( m_ModuleFilterNormal, 0, wxALL, 5 ); @@ -85,22 +85,31 @@ DIALOG_GLOBAL_DELETION_BASE::DIALOG_GLOBAL_DELETION_BASE( wxWindow* parent, wxWi m_rbLayersOption->SetSelection( 0 ); bSizerRight->Add( m_rbLayersOption, 0, wxALL|wxEXPAND, 5 ); - m_staticText1 = new wxStaticText( this, wxID_ANY, _("Current layer:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText1->Wrap( -1 ); - bSizerRight->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_textCtrlCurrLayer = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); - m_textCtrlCurrLayer->SetMaxLength( 0 ); - bSizerRight->Add( m_textCtrlCurrLayer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - bSizerUpper->Add( bSizerRight, 3, wxALL|wxEXPAND, 5 ); bSizerMain->Add( bSizerUpper, 1, wxALL|wxEXPAND, 5 ); + wxFlexGridSizer* fgSizer1; + fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 ); + fgSizer1->AddGrowableCol( 1 ); + fgSizer1->SetFlexibleDirection( wxBOTH ); + fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText1 = new wxStaticText( this, wxID_ANY, _("Current layer:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->Wrap( -1 ); + fgSizer1->Add( m_staticText1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlCurrLayer = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); + m_textCtrlCurrLayer->SetMaxLength( 0 ); + fgSizer1->Add( m_textCtrlCurrLayer, 0, wxEXPAND|wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerMain->Add( fgSizer1, 0, wxEXPAND, 5 ); + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 ); + bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1OK = new wxButton( this, wxID_OK ); @@ -114,7 +123,6 @@ DIALOG_GLOBAL_DELETION_BASE::DIALOG_GLOBAL_DELETION_BASE( wxWindow* parent, wxWi this->SetSizer( bSizerMain ); this->Layout(); - bSizerMain->Fit( this ); this->Centre( wxBOTH ); diff --git a/pcbnew/dialogs/dialog_global_deletion_base.fbp b/pcbnew/dialogs/dialog_global_deletion_base.fbp index cb6496e47d..57122dafd5 100644 --- a/pcbnew/dialogs/dialog_global_deletion_base.fbp +++ b/pcbnew/dialogs/dialog_global_deletion_base.fbp @@ -44,7 +44,7 @@ DIALOG_GLOBAL_DELETION_BASE - -1,-1 + 339,365 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Delete Items @@ -1461,187 +1461,205 @@ - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Current layer: - - 0 - - - 0 - - 1 - m_staticText1 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_textCtrlCurrLayer - 1 - - - protected - 1 - - Resizable - 1 - - wxTE_READONLY - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxLEFT|wxRIGHT + wxEXPAND + 0 + + 2 + wxBOTH + 1 + + 0 + + fgSizer1 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Current layer: + + 0 + + + 0 + + 1 + m_staticText1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_textCtrlCurrLayer + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_READONLY + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 diff --git a/pcbnew/dialogs/dialog_global_deletion_base.h b/pcbnew/dialogs/dialog_global_deletion_base.h index 21a9584660..594ddd1b41 100644 --- a/pcbnew/dialogs/dialog_global_deletion_base.h +++ b/pcbnew/dialogs/dialog_global_deletion_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 9 2015) +// C++ code generated with wxFormBuilder (version Jun 17 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -72,7 +72,7 @@ class DIALOG_GLOBAL_DELETION_BASE : public DIALOG_SHIM public: - DIALOG_GLOBAL_DELETION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Delete Items"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_GLOBAL_DELETION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Delete Items"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 339,365 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_GLOBAL_DELETION_BASE(); }; diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index 8eae523234..07915ae723 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -66,7 +66,11 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC ) { fn = GetBoard()->GetFileName(); fn.SetExt( NetlistFileExtension ); - netlistName = fn.GetFullPath(); + + if( fn.GetName().IsEmpty() ) + netlistName.Clear(); + else + netlistName = fn.GetFullPath(); } DIALOG_NETLIST dlg( this, DC, netlistName ); @@ -152,8 +156,20 @@ void DIALOG_NETLIST::OnOpenNetlistClick( wxCommandEvent& event ) void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event ) { - wxString msg; wxString netlistFileName = m_NetlistFilenameCtrl->GetValue(); + wxFileName fn = netlistFileName; + + if( !fn.IsOk() ) + { + wxMessageBox( _("Please, choose a valid netlist file") ); + return; + } + + if( !fn.FileExists() ) + { + wxMessageBox( _("The netlist file does not exist") ); + return; + } // Give the user a chance to bail out when making changes from a netlist. if( !m_checkDryRun->GetValue() && !m_silentMode @@ -167,6 +183,7 @@ void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event ) wxBusyCursor busy; + wxString msg; msg.Printf( _( "Reading netlist file \"%s\".\n" ), GetChars( netlistFileName ) ); reporter.Report( msg, REPORTER::RPT_INFO ); diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp index 3d4a64a383..a614e84039 100644 --- a/pcbnew/initpcb.cpp +++ b/pcbnew/initpcb.cpp @@ -41,7 +41,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery ) if( GetBoard() == NULL ) return false; - if( aQuery && GetScreen()->IsModify() && !GetBoard()->IsEmpty() ) + if( aQuery && !GetBoard()->IsEmpty() ) { if( !IsOK( this, _( "Current Board will be lost and this operation cannot be undone. Continue ?" ) ) ) @@ -83,6 +83,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery ) ReCreateLayerBox(); ReCreateAuxiliaryToolbar(); ReFillLayerWidget(); + UpdateTitle(); Zoom_Automatique( false );