Minor fixes (Bug #1414328 and Bug #1440312). Remove translatable attribute in a debug message.

tools/edit_tool.cpp: remove limitation (GAL mode) to delete the last pad in a footprint (a footprint can have 0 pad, for instance a logo)
This commit is contained in:
jean-pierre charras 2015-05-01 17:01:09 +02:00
parent 5a02b91e5f
commit 2047d87317
7 changed files with 46 additions and 34 deletions

View File

@ -316,7 +316,7 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* a
return true;
}
wxASSERT_MSG( action != NULL, wxString::Format( _( "Could not find action %s." ), aActionName ) );
wxASSERT_MSG( action != NULL, wxString::Format( wxT( "Could not find action %s." ), aActionName ) );
return false;
}

View File

@ -151,7 +151,16 @@ bool TRACKS_CLEANER::CleanupBoard( PCB_EDIT_FRAME *aFrame,
modified |= (aMergeSegments && clean_segments());
// Delete dangling tracks
modified |= (aDeleteUnconnected && deleteUnconnectedTracks());
if( aDeleteUnconnected && deleteUnconnectedTracks() )
{
modified = true ;
// Removed tracks can leave aligned segments
// (when a T was formed by tracks and the "vertical" segment
// is removed;
if( aMergeSegments )
clean_segments();
}
if( modified )
{
@ -161,6 +170,7 @@ bool TRACKS_CLEANER::CleanupBoard( PCB_EDIT_FRAME *aFrame,
aFrame->Compile_Ratsnest( NULL, true );
aFrame->OnModify();
}
return modified;
}
@ -515,6 +525,7 @@ bool TRACKS_CLEANER::clean_segments()
// merge collinear segments:
TRACK *nextsegment;
for( TRACK *segment = m_Brd->m_Track; segment; segment = nextsegment )
{
nextsegment = segment->Next();
@ -522,10 +533,12 @@ bool TRACKS_CLEANER::clean_segments()
if( segment->Type() == PCB_TRACE_T )
{
bool merged_this = merge_collinear_of_track( segment );
modified |= merged_this;
if( merged_this ) // The current segment was modified, retry to merge it again
{
nextsegment = segment->Next();
modified = true;
}
}
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -101,20 +101,14 @@ DIALOG_GEN_MODULE_POSITION_BASE::DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* pare
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnClose ) );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnInitDialog ) );
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_sdbSizerButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnCancelButton ), NULL, this );
m_sdbSizerButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnOKButton ), NULL, this );
}
DIALOG_GEN_MODULE_POSITION_BASE::~DIALOG_GEN_MODULE_POSITION_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnClose ) );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnInitDialog ) );
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_sdbSizerButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnCancelButton ), NULL, this );
m_sdbSizerButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnOKButton ), NULL, this );
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -20,8 +20,10 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -59,13 +61,13 @@
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose">OnClose</event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog">OnInitDialog</event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
@ -236,7 +238,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">350,-1</property>
@ -714,7 +716,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,150</property>
@ -789,7 +791,7 @@
<property name="name">m_sdbSizerButtons</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">OnCancelButton</event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -11,6 +11,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
@ -48,10 +50,7 @@ class DIALOG_GEN_MODULE_POSITION_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButton( wxCommandEvent& event ) { event.Skip(); }

View File

@ -49,6 +49,7 @@
#include <pcbplot.h>
#include <pcb_plot_params.h>
#include <wildcards_and_files_ext.h>
#include <kiface_i.h>
#include <dialog_gen_module_position_file_base.h>
/*
@ -70,6 +71,9 @@
* ## End
*/
#define PLACEFILE_UNITS_KEY wxT( "PlaceFileUnits" )
#define PLACEFILE_OPT_KEY wxT( "PlaceFileOpts" )
class LIST_MOD // An helper class used to build a list of useful footprints.
{
@ -93,21 +97,22 @@ public:
m_parent( aParent ),
m_plotOpts( aParent->GetPlotSettings() )
{
initDialog();
GetSizer()->SetSizeHints(this);
Centre();
}
private:
PCB_EDIT_FRAME* m_parent;
PCB_PLOT_PARAMS m_plotOpts;
wxConfigBase* m_config;
static int m_unitsOpt;
static int m_fileOpt;
void OnInitDialog( wxInitDialogEvent& event );
void initDialog();
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event );
void OnCancelButton( wxCommandEvent& event )
{
EndModal( wxID_CANCEL );
}
void OnOKButton( wxCommandEvent& event );
bool CreateFiles();
@ -149,16 +154,18 @@ int DIALOG_GEN_MODULE_POSITION::m_fileOpt = 0;
const wxString frontSideName = wxT( "top" );
const wxString backSideName = wxT( "bottom" );
void DIALOG_GEN_MODULE_POSITION::OnInitDialog( wxInitDialogEvent& event )
void DIALOG_GEN_MODULE_POSITION::initDialog()
{
m_config = Kiface().KifaceSettings();
m_config->Read( PLACEFILE_UNITS_KEY, &m_unitsOpt, 1 );
m_config->Read( PLACEFILE_OPT_KEY, &m_fileOpt, 0 );
// Output directory
m_outputDirectoryName->SetValue( m_plotOpts.GetOutputDirectory() );
m_radioBoxUnits->SetSelection( m_unitsOpt );
m_radioBoxFilesCount->SetSelection( m_fileOpt );
m_sdbSizerButtonsOK->SetDefault();
GetSizer()->SetSizeHints(this);
Centre();
}
void DIALOG_GEN_MODULE_POSITION::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
@ -196,6 +203,9 @@ void DIALOG_GEN_MODULE_POSITION::OnOKButton( wxCommandEvent& event )
m_unitsOpt = m_radioBoxUnits->GetSelection();
m_fileOpt = m_radioBoxFilesCount->GetSelection();
m_config->Write( PLACEFILE_UNITS_KEY, m_unitsOpt );
m_config->Write( PLACEFILE_OPT_KEY, m_fileOpt );
// Set output directory and replace backslashes with forward ones
// (Keep unix convention in cfg files)
wxString dirStr;

View File

@ -582,12 +582,6 @@ void EDIT_TOOL::remove( BOARD_ITEM* aItem )
if( !m_editModules )
{
if( aItem->Type() == PCB_PAD_T && module->GetPadCount() == 1 )
{
DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete the only remaining pad of the module (modules on PCB must have at least one pad)." ) );
return;
}
getView()->Remove( aItem );
board->Remove( aItem );
}