Commit 683921f9 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: fix crash in intermediate netlist generation when a component has no...

Eeschema: fix crash in intermediate netlist generation when a component has no pins (like logos or images).
Pcbnew: texts in dimensions can be now moved.
Gerbview: fix incorrect number of layers  in export to pcbnew function.
parent cc097762
...@@ -328,9 +328,17 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) ...@@ -328,9 +328,17 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
{ {
// Temporary change the help filename // Temporary change the help filename
wxString tmp = wxGetApp().m_HelpFileName; wxString tmp = wxGetApp().m_HelpFileName;
wxGetApp().m_HelpFileName = wxT( "Getting_Started_in_KiCad.pdf" );
// Search for "getting_started_in_kicad.pdf" or "Getting_Started_in_KiCad.pdf"
wxGetApp().m_HelpFileName = wxT( "getting_started_in_kicad.pdf" );
wxString helpFile = wxGetApp().GetHelpFile(); wxString helpFile = wxGetApp().GetHelpFile();
if( !helpFile )
{ // Try to find "Getting_Started_in_KiCad.pdf"
wxGetApp().m_HelpFileName = wxT( "Getting_Started_in_KiCad.pdf" );
wxString helpFile = wxGetApp().GetHelpFile();
}
if( !helpFile ) if( !helpFile )
{ {
msg.Printf( _( "Help file %s could not be found." ), msg.Printf( _( "Help file %s could not be found." ),
......
...@@ -787,7 +787,7 @@ XNODE* EXPORT_HELP::makeGenericLibParts() ...@@ -787,7 +787,7 @@ XNODE* EXPORT_HELP::makeGenericLibParts()
* Common pins (VCC, GND) can also be found more than once. * Common pins (VCC, GND) can also be found more than once.
*/ */
sort( pinList.begin(), pinList.end(), sortPinsByNumber ); sort( pinList.begin(), pinList.end(), sortPinsByNumber );
for( unsigned ii = 0; ii < pinList.size()-1; ii++ ) for( int ii = 0; ii < (int)pinList.size()-1; ii++ )
{ {
if( pinList[ii]->GetNumber() == pinList[ii+1]->GetNumber() ) if( pinList[ii]->GetNumber() == pinList[ii+1]->GetNumber() )
{ // 2 pins have the same number, remove the redundant pin at index i+1 { // 2 pins have the same number, remove the redundant pin at index i+1
......
...@@ -66,19 +66,17 @@ GBR_TO_PCB_EXPORTER::~GBR_TO_PCB_EXPORTER() ...@@ -66,19 +66,17 @@ GBR_TO_PCB_EXPORTER::~GBR_TO_PCB_EXPORTER()
*/ */
void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event ) void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
{ {
int ii = 0; int layercount = 0;
bool no_used_layers = true; // Changed to false if any used layer found
// Check whether any of the Gerber layers are actually currently used // Count the Gerber layers which are actually currently used
while( no_used_layers && ii < 32 ) for( int ii = 0; ii < 32; ii++ )
{ {
if( g_GERBER_List[ii] != NULL ) if( g_GERBER_List[ii] != NULL )
no_used_layers = false; layercount++;
ii++;
} }
if( no_used_layers ) if( layercount == 0 )
{ {
DisplayInfoMessage( this, DisplayInfoMessage( this,
_( "None of the Gerber layers contain any data" ) ); _( "None of the Gerber layers contain any data" ) );
...@@ -233,6 +231,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable ) ...@@ -233,6 +231,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
} }
cleanBoard(); cleanBoard();
m_pcb->SetCopperLayerCount( LayerLookUpTable[32] );
// Switch the locale to standard C (needed to print floating point numbers) // Switch the locale to standard C (needed to print floating point numbers)
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
...@@ -297,7 +296,7 @@ void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aL ...@@ -297,7 +296,7 @@ void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aL
break; break;
case GBR_ARC: case GBR_ARC:
// export_segarc_copper_item( aGbrItem, aLayer ); export_segarc_copper_item( aGbrItem, aLayer );
break; break;
default: default:
...@@ -325,6 +324,7 @@ void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem ...@@ -325,6 +324,7 @@ void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem
void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer ) void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{ {
#if 0 // TODO: does not work in all cases, so needs some work
double a = atan2( (double)( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y ), double a = atan2( (double)( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y ),
(double)( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) ); (double)( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) );
double b = atan2( (double)( aGbrItem->m_End.y - aGbrItem->m_ArcCentre.y ), double b = atan2( (double)( aGbrItem->m_End.y - aGbrItem->m_ArcCentre.y ),
...@@ -374,6 +374,7 @@ void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, ...@@ -374,6 +374,7 @@ void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem,
NEGATE( newtrack->m_End.y ); NEGATE( newtrack->m_End.y );
m_pcb->Add( newtrack ); m_pcb->Add( newtrack );
} }
#endif
} }
......
...@@ -94,7 +94,7 @@ void LAYERS_MAP_DIALOG::initDialog() ...@@ -94,7 +94,7 @@ void LAYERS_MAP_DIALOG::initDialog()
// Ensure we have: // Ensure we have:
// at least 2 copper layers and NB_COPPER_LAYERS copper layers max // at least 2 copper layers and NB_COPPER_LAYERS copper layers max
// an even layers count because board *must* have even layers count // and even layers count because a board *must* have even layers count
// and maxi NB_COPPER_LAYERS copper layers count // and maxi NB_COPPER_LAYERS copper layers count
normalizeBrdLayersCount(); normalizeBrdLayersCount();
...@@ -279,7 +279,7 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event ) ...@@ -279,7 +279,7 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
} }
/* Stores the current mayers selection in config /* Stores the current layers selection in config
*/ */
void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event ) void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event )
{ {
......
...@@ -1253,6 +1253,9 @@ public: ...@@ -1253,6 +1253,9 @@ public:
void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC ); void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC );
DIMENSION* EditDimension( DIMENSION* aDimension, wxDC* aDC ); DIMENSION* EditDimension( DIMENSION* aDimension, wxDC* aDC );
void DeleteDimension( DIMENSION* aDimension, wxDC* aDC ); void DeleteDimension( DIMENSION* aDimension, wxDC* aDC );
void BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC );
void PlaceDimensionText( DIMENSION* aItem, wxDC* DC );
// netlist handling: // netlist handling:
void InstallNetlistFrame( wxDC* DC ); void InstallNetlistFrame( wxDC* DC );
......
...@@ -21,6 +21,7 @@ set(PCBNEW_DIALOGS ...@@ -21,6 +21,7 @@ set(PCBNEW_DIALOGS
dialogs/dialog_copper_zones_base.cpp dialogs/dialog_copper_zones_base.cpp
dialogs/dialog_design_rules.cpp dialogs/dialog_design_rules.cpp
dialogs/dialog_design_rules_base.cpp dialogs/dialog_design_rules_base.cpp
dialogs/dialog_dimension_editor_base.cpp
dialogs/dialog_display_options.cpp dialogs/dialog_display_options.cpp
dialogs/dialog_display_options_base.cpp dialogs/dialog_display_options_base.cpp
dialogs/dialog_drc_base.cpp dialogs/dialog_drc_base.cpp
......
...@@ -235,6 +235,7 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage ) ...@@ -235,6 +235,7 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
( (DIMENSION*) aImage )->SetText( txt ); ( (DIMENSION*) aImage )->SetText( txt );
EXCHG( ( (DIMENSION*) aItem )->m_Width, ( (DIMENSION*) aImage )->m_Width ); EXCHG( ( (DIMENSION*) aItem )->m_Width, ( (DIMENSION*) aImage )->m_Width );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Size, ( (DIMENSION*) aImage )->m_Text->m_Size ); EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Size, ( (DIMENSION*) aImage )->m_Text->m_Size );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Pos, ( (DIMENSION*) aImage )->m_Text->m_Pos );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Thickness, EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Thickness,
( (DIMENSION*) aImage )->m_Text->m_Thickness ); ( (DIMENSION*) aImage )->m_Text->m_Thickness );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Mirror, EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Mirror,
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_dimension_editor_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
m_staticTextDim = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDim->Wrap( -1 );
bSizerMain->Add( m_staticTextDim, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_Name = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Name->SetMinSize( wxSize( 400,-1 ) );
bSizerMain->Add( m_Name, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerLeft;
bSizerLeft = new wxBoxSizer( wxVERTICAL );
m_staticTextSizeX = new wxStaticText( this, wxID_ANY, _("Size X"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeX->Wrap( -1 );
bSizerLeft->Add( m_staticTextSizeX, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TxtSizeXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerLeft->Add( m_TxtSizeXCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextSizeY = new wxStaticText( this, wxID_ANY, _("Size Y"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeY->Wrap( -1 );
bSizerLeft->Add( m_staticTextSizeY, 0, wxRIGHT|wxLEFT, 5 );
m_TxtSizeYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerLeft->Add( m_TxtSizeYCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextWidth = new wxStaticText( this, wxID_ANY, _("Width"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextWidth->Wrap( -1 );
bSizerLeft->Add( m_staticTextWidth, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TxtWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerLeft->Add( m_TxtWidthCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextPosX = new wxStaticText( this, wxID_ANY, _("Text position X"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPosX->Wrap( -1 );
bSizerLeft->Add( m_staticTextPosX, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_textCtrlPosX = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerLeft->Add( m_textCtrlPosX, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextPosY = new wxStaticText( this, wxID_ANY, _("Text position Y"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPosY->Wrap( -1 );
bSizerLeft->Add( m_staticTextPosY, 0, wxRIGHT|wxLEFT, 5 );
m_textCtrlPosY = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerLeft->Add( m_textCtrlPosY, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerUpper->Add( bSizerLeft, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxVERTICAL );
wxString m_rbMirrorChoices[] = { _("Normal"), _("Mirror") };
int m_rbMirrorNChoices = sizeof( m_rbMirrorChoices ) / sizeof( wxString );
m_rbMirror = new wxRadioBox( this, wxID_ANY, _("Display"), wxDefaultPosition, wxDefaultSize, m_rbMirrorNChoices, m_rbMirrorChoices, 1, wxRA_SPECIFY_COLS );
m_rbMirror->SetSelection( 0 );
bSizerRight->Add( m_rbMirror, 0, wxALL|wxEXPAND, 5 );
m_staticTextLayer = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextLayer->Wrap( -1 );
bSizerRight->Add( m_staticTextLayer, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_SelLayerBox = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bSizerRight->Add( m_SelLayerBox, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerUpper->Add( bSizerRight, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_sdbSizerBts = new wxStdDialogButtonSizer();
m_sdbSizerBtsOK = new wxButton( this, wxID_OK );
m_sdbSizerBts->AddButton( m_sdbSizerBtsOK );
m_sdbSizerBtsCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizerBts->AddButton( m_sdbSizerBtsCancel );
m_sdbSizerBts->Realize();
bSizerMain->Add( m_sdbSizerBts, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_sdbSizerBtsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizerBtsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnOKClick ), NULL, this );
}
DIALOG_DIMENSION_EDITOR_BASE::~DIALOG_DIMENSION_EDITOR_BASE()
{
// Disconnect Events
m_sdbSizerBtsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizerBtsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnOKClick ), NULL, this );
}
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_DIMENSION_EDITOR_BASE_H__
#define __DIALOG_DIMENSION_EDITOR_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/combobox.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_DIMENSION_EDITOR_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_DIMENSION_EDITOR_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_staticTextDim;
wxTextCtrl* m_Name;
wxStaticText* m_staticTextSizeX;
wxTextCtrl* m_TxtSizeXCtrl;
wxStaticText* m_staticTextSizeY;
wxTextCtrl* m_TxtSizeYCtrl;
wxStaticText* m_staticTextWidth;
wxTextCtrl* m_TxtWidthCtrl;
wxStaticText* m_staticTextPosX;
wxTextCtrl* m_textCtrlPosX;
wxStaticText* m_staticTextPosY;
wxTextCtrl* m_textCtrlPosY;
wxRadioBox* m_rbMirror;
wxStaticText* m_staticTextLayer;
wxComboBox* m_SelLayerBox;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizerBts;
wxButton* m_sdbSizerBtsOK;
wxButton* m_sdbSizerBtsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Dimension Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 378,328 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DIMENSION_EDITOR_BASE();
};
#endif //__DIALOG_DIMENSION_EDITOR_BASE_H__
This diff is collapsed.
...@@ -55,9 +55,6 @@ ...@@ -55,9 +55,6 @@
// Uncomment following line to enable wxBell() command (which beeps speaker) // Uncomment following line to enable wxBell() command (which beeps speaker)
// #include <wx/utils.h> // #include <wx/utils.h>
static void Process_Move_Item( PCB_EDIT_FRAME* frame, EDA_ITEM* DrawStruct, wxDC* DC );
/* Handles the selection of command events. */ /* Handles the selection of command events. */
void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
...@@ -142,6 +139,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -142,6 +139,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
case ID_POPUP_PCB_EDIT_DRAWING: case ID_POPUP_PCB_EDIT_DRAWING:
case ID_POPUP_PCB_GETINFO_MARKER: case ID_POPUP_PCB_GETINFO_MARKER:
case ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST:
break; break;
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
...@@ -574,7 +572,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -574,7 +572,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST: case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
Process_Move_Item( this, GetCurItem(), &dc ); StartMoveTextePcb( (TEXTE_PCB*) GetCurItem(), &dc );
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
break; break;
...@@ -938,6 +936,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -938,6 +936,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST:
BeginMoveDimensionText( (DIMENSION*) GetCurItem(), &dc );
break;
case ID_POPUP_PCB_DELETE_DRAWING: case ID_POPUP_PCB_DELETE_DRAWING:
Delete_Segment_Edge( (DRAWSEGMENT*) GetCurItem(), &dc ); Delete_Segment_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
...@@ -1091,27 +1093,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -1091,27 +1093,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
} }
static void Process_Move_Item( PCB_EDIT_FRAME* frame, EDA_ITEM* DrawStruct, wxDC* DC )
{
if( DrawStruct == NULL )
return;
switch( DrawStruct->Type() )
{
case PCB_TEXT_T:
frame->StartMoveTextePcb( (TEXTE_PCB*) DrawStruct, DC );
break;
default:
wxString msg;
msg.Printf( wxT( "PCB_EDIT_FRAME::Move_Item Error: Bad DrawType %d" ),
DrawStruct->Type() );
DisplayError( frame, msg );
break;
}
}
void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
{ {
if( Item == NULL ) if( Item == NULL )
......
...@@ -878,6 +878,11 @@ bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand ) ...@@ -878,6 +878,11 @@ bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
break; break;
case PCB_DIMENSION_T:
if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST;
break;
default: default:
break; break;
} }
......
...@@ -119,7 +119,11 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -119,7 +119,11 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break; break;
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
// see above. if( ! DrawStruct->IsNew() )
{ // We are moving the text of an existing dimension. Place it
PlaceDimensionText( (DIMENSION*) DrawStruct, aDC );
exit = true;
}
break; break;
default: default:
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "fctsys.h" #include "fctsys.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h"
#include "macros.h" #include "macros.h"
#include "class_board.h" #include "class_board.h"
...@@ -223,10 +222,14 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -223,10 +222,14 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
msg = AddHotkeyName( _( "Edit Dimension" ), g_Board_Editor_Hokeys_Descr, msg = AddHotkeyName( _( "Edit Dimension" ), g_Board_Editor_Hokeys_Descr,
HK_EDIT_ITEM ); HK_EDIT_ITEM );
AddMenuItem( aPopMenu, ID_POPUP_PCB_EDIT_DIMENSION, msg, KiBitmap( edit_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_EDIT_DIMENSION, msg, KiBitmap( edit_xpm ) );
msg = AddHotkeyName( _( "Move Dimension Text" ), g_Board_Editor_Hokeys_Descr,
HK_MOVE_ITEM );
AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST,
msg, KiBitmap( move_text_xpm ) );
msg = AddHotkeyName( _( "Delete Dimension" ), g_Board_Editor_Hokeys_Descr, HK_DELETE );
AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DIMENSION, AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DIMENSION,
_( "Delete Dimension" ), KiBitmap( delete_xpm ) ); msg, KiBitmap( delete_xpm ) );
} }
break; break;
case PCB_TARGET_T: case PCB_TARGET_T:
...@@ -238,8 +241,9 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -238,8 +241,9 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
msg = AddHotkeyName( _( "Edit Target" ), g_Board_Editor_Hokeys_Descr, msg = AddHotkeyName( _( "Edit Target" ), g_Board_Editor_Hokeys_Descr,
HK_EDIT_ITEM ); HK_EDIT_ITEM );
AddMenuItem( aPopMenu, ID_POPUP_PCB_EDIT_MIRE, msg, KiBitmap( edit_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_EDIT_MIRE, msg, KiBitmap( edit_xpm ) );
msg = AddHotkeyName( _( "Delete Target" ), g_Board_Editor_Hokeys_Descr, HK_DELETE );
AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_MIRE, AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_MIRE,
_( "Delete Target" ), KiBitmap( delete_xpm ) ); msg, KiBitmap( delete_xpm ) );
} }
break; break;
...@@ -250,14 +254,14 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -250,14 +254,14 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
case PCB_T: case PCB_T:
msg.Printf( wxT( "PCB_EDIT_FRAME::OnRightClick() Error: unexpected DrawType %d" ), msg.Printf( wxT( "PCB_EDIT_FRAME::OnRightClick() Error: unexpected DrawType %d" ),
item->Type() ); item->Type() );
DisplayError( this, msg ); wxMessageBox( msg );
SetCurItem( NULL ); SetCurItem( NULL );
break; break;
default: default:
msg.Printf( wxT( "PCB_EDIT_FRAME::OnRightClick() Error: unknown DrawType %d" ), msg.Printf( wxT( "PCB_EDIT_FRAME::OnRightClick() Error: unknown DrawType %d" ),
item->Type() ); item->Type() );
DisplayError( this, msg ); wxMessageBox( msg );
// Attempt to clear error (but should no occurs ) // Attempt to clear error (but should no occurs )
if( item->Type() >= MAX_STRUCT_TYPE_ID ) if( item->Type() >= MAX_STRUCT_TYPE_ID )
...@@ -277,7 +281,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -277,7 +281,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
msg, KiBitmap( move_module_xpm ) ); msg, KiBitmap( move_module_xpm ) );
} }
/* Display context sensitive comands: */ /* Display context sensitive commands: */
switch( GetToolId() ) switch( GetToolId() )
{ {
case ID_PCB_ZONES_BUTT: case ID_PCB_ZONES_BUTT:
...@@ -655,8 +659,9 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu ...@@ -655,8 +659,9 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu
msg = AddHotkeyName( _( "Edit" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); msg = AddHotkeyName( _( "Edit" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_EDIT_MODULE, msg, KiBitmap( edit_module_xpm ) ); AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_EDIT_MODULE, msg, KiBitmap( edit_module_xpm ) );
sub_menu_footprint->AppendSeparator(); sub_menu_footprint->AppendSeparator();
msg = AddHotkeyName( _( "Delete Module" ), g_Board_Editor_Hokeys_Descr, HK_DELETE );
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_DELETE_MODULE, AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_DELETE_MODULE,
_( "Delete Module" ), KiBitmap( delete_module_xpm ) ); msg, KiBitmap( delete_module_xpm ) );
} }
} }
...@@ -724,9 +729,12 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu ) ...@@ -724,9 +729,12 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
if( flags ) // Currently in edit, no others commands possible if( flags ) // Currently in edit, no others commands possible
return; return;
GetBoard()->SetCurrentNetClass( Pad->GetNetClassName() ); if( GetBoard()->m_CurrentNetClassName != Pad->GetNetClassName() )
updateTraceWidthSelectBox(); {
updateViaSizeSelectBox(); GetBoard()->SetCurrentNetClass( Pad->GetNetClassName() );
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
}
wxString msg = Pad->GetSelectMenuText(); wxString msg = Pad->GetSelectMenuText();
...@@ -798,7 +806,8 @@ void PCB_EDIT_FRAME::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ) ...@@ -798,7 +806,8 @@ void PCB_EDIT_FRAME::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
_( "Reset Size" ), KiBitmap( reset_text_xpm ) ); _( "Reset Size" ), KiBitmap( reset_text_xpm ) );
sub_menu_Text->AppendSeparator(); sub_menu_Text->AppendSeparator();
AddMenuItem( sub_menu_Text, ID_POPUP_PCB_DELETE_TEXTEPCB, _( "Delete" ), KiBitmap( delete_text_xpm ) ); msg = AddHotkeyName( _( "Delete" ), g_Board_Editor_Hokeys_Descr, HK_DELETE );
AddMenuItem( sub_menu_Text, ID_POPUP_PCB_DELETE_TEXTEPCB, msg, KiBitmap( delete_text_xpm ) );
} }
......
...@@ -100,7 +100,9 @@ enum pcbnew_ids ...@@ -100,7 +100,9 @@ enum pcbnew_ids
ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE,
ID_POPUP_PCB_DELETE_MARKER, ID_POPUP_PCB_DELETE_MARKER,
ID_POPUP_PCB_DELETE_DIMENSION, ID_POPUP_PCB_DELETE_DIMENSION,
ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST,
ID_POPUP_PCB_MOVE_MIRE_REQUEST, ID_POPUP_PCB_MOVE_MIRE_REQUEST,
ID_POPUP_PCB_DELETE_MIRE, ID_POPUP_PCB_DELETE_MIRE,
......
...@@ -586,6 +586,7 @@ void PCB_EDIT_FRAME::updateTraceWidthSelectBox() ...@@ -586,6 +586,7 @@ void PCB_EDIT_FRAME::updateTraceWidthSelectBox()
if( GetBoard()->m_TrackWidthSelector >= GetBoard()->m_TrackWidthList.size() ) if( GetBoard()->m_TrackWidthSelector >= GetBoard()->m_TrackWidthList.size() )
GetBoard()->m_TrackWidthSelector = 0; GetBoard()->m_TrackWidthSelector = 0;
m_SelTrackWidthBox->SetSelection( GetBoard()->m_TrackWidthSelector );
} }
...@@ -615,6 +616,7 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox() ...@@ -615,6 +616,7 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox()
if( GetBoard()->m_ViaSizeSelector >= GetBoard()->m_ViasDimensionsList.size() ) if( GetBoard()->m_ViaSizeSelector >= GetBoard()->m_ViasDimensionsList.size() )
GetBoard()->m_ViaSizeSelector = 0; GetBoard()->m_ViaSizeSelector = 0;
m_SelViaSizeBox->SetSelection( GetBoard()->m_ViaSizeSelector );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment