Commit 958e663d authored by charras's avatar charras

pcbnew: bugs 2840153, 2840154 fixed (bug 2840150 already fixed)

parent 4117870f
No preview for this file type
This diff is collapsed.
...@@ -33,7 +33,7 @@ public: ...@@ -33,7 +33,7 @@ public:
~DialogEditModuleText() {}; ~DialogEditModuleText() {};
private: private:
void OnInitDialog( wxInitDialogEvent& event ); void Init( );
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
}; };
...@@ -58,20 +58,22 @@ DialogEditModuleText::DialogEditModuleText( WinEDA_BasePcbFrame* parent, TEXTE_ ...@@ -58,20 +58,22 @@ DialogEditModuleText::DialogEditModuleText( WinEDA_BasePcbFrame* parent, TEXTE_
m_Module = NULL; m_Module = NULL;
m_CurrentTextMod = TextMod; m_CurrentTextMod = TextMod;
if( m_CurrentTextMod ) if( m_CurrentTextMod )
{
m_Module = (MODULE*) m_CurrentTextMod->GetParent(); m_Module = (MODULE*) m_CurrentTextMod->GetParent();
} Init( );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
} }
void DialogEditModuleText::OnCancelClick( wxCommandEvent& event ) void DialogEditModuleText::OnCancelClick( wxCommandEvent& event )
{ {
event.Skip(); EndModal(0);
} }
/********************************************************/ /********************************************************/
void DialogEditModuleText::OnInitDialog( wxInitDialogEvent& event ) void DialogEditModuleText::Init( )
/********************************************************/ /********************************************************/
{ {
SetFocus(); SetFocus();
...@@ -84,7 +86,7 @@ void DialogEditModuleText::OnInitDialog( wxInitDialogEvent& event ) ...@@ -84,7 +86,7 @@ void DialogEditModuleText::OnInitDialog( wxInitDialogEvent& event )
msg.Printf( format, msg.Printf( format,
m_Module->m_Reference->m_Text.GetData(), m_Module->m_Reference->m_Text.GetData(),
m_Module->m_Value->m_Text.GetData(), m_Module->m_Value->m_Text.GetData(),
(float) (m_Module->m_Orient / 10) ); (float) m_Module->m_Orient / 10 );
} }
else else
...@@ -132,8 +134,6 @@ void DialogEditModuleText::OnInitDialog( wxInitDialogEvent& event ) ...@@ -132,8 +134,6 @@ void DialogEditModuleText::OnInitDialog( wxInitDialogEvent& event )
if( m_CurrentTextMod->m_NoShow ) if( m_CurrentTextMod->m_NoShow )
m_Show->SetSelection( 1 );; m_Show->SetSelection( 1 );;
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
} }
...@@ -184,7 +184,7 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) ...@@ -184,7 +184,7 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
int maxthickness = Clamp_Text_PenSize(width, m_CurrentTextMod->m_Size ); int maxthickness = Clamp_Text_PenSize(width, m_CurrentTextMod->m_Size );
if( width > maxthickness ) if( width > maxthickness )
{ {
DisplayError(this, _("The text thickness is too large for the text size. It will be clamped")); DisplayError(NULL, _("The text thickness is too large for the text size. It will be clamped"));
width = maxthickness; width = maxthickness;
} }
m_CurrentTextMod->SetWidth( width ); m_CurrentTextMod->SetWidth( width );
...@@ -203,5 +203,5 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) ...@@ -203,5 +203,5 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
if( m_Module ) if( m_Module )
m_Module->m_LastEdit_Time = time( NULL ); m_Module->m_LastEdit_Time = time( NULL );
Close( TRUE ); EndModal(1);
} }
...@@ -117,7 +117,6 @@ DialogEditModuleText_base::DialogEditModuleText_base( wxWindow* parent, wxWindow ...@@ -117,7 +117,6 @@ DialogEditModuleText_base::DialogEditModuleText_base( wxWindow* parent, wxWindow
this->Layout(); this->Layout();
// Connect Events // Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DialogEditModuleText_base::OnInitDialog ) );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnOkClick ), NULL, this ); m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnOkClick ), NULL, this );
m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnCancelClick ), NULL, this ); m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnCancelClick ), NULL, this );
} }
...@@ -125,7 +124,6 @@ DialogEditModuleText_base::DialogEditModuleText_base( wxWindow* parent, wxWindow ...@@ -125,7 +124,6 @@ DialogEditModuleText_base::DialogEditModuleText_base( wxWindow* parent, wxWindow
DialogEditModuleText_base::~DialogEditModuleText_base() DialogEditModuleText_base::~DialogEditModuleText_base()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DialogEditModuleText_base::OnInitDialog ) );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnOkClick ), NULL, this ); m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnOkClick ), NULL, this );
m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnCancelClick ), NULL, this ); m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnCancelClick ), NULL, this );
} }
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<event name="OnHibernate"></event> <event name="OnHibernate"></event>
<event name="OnIconize"></event> <event name="OnIconize"></event>
<event name="OnIdle"></event> <event name="OnIdle"></event>
<event name="OnInitDialog">OnInitDialog</event> <event name="OnInitDialog"></event>
<event name="OnKeyDown"></event> <event name="OnKeyDown"></event>
<event name="OnKeyUp"></event> <event name="OnKeyUp"></event>
<event name="OnKillFocus"></event> <event name="OnKillFocus"></event>
......
...@@ -55,7 +55,6 @@ class DialogEditModuleText_base : public wxDialog ...@@ -55,7 +55,6 @@ class DialogEditModuleText_base : public wxDialog
wxButton* m_buttonCANCEL; wxButton* m_buttonCANCEL;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
......
...@@ -90,7 +90,7 @@ static MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame, ...@@ -90,7 +90,7 @@ static MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
int TstOnly, int TstOnly,
bool Select_By_Timestamp, bool Select_By_Timestamp,
bool aChangeFootprint ); bool aChangeFootprint );
static void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC ); static void LoadListeModules( WinEDA_PcbFrame* aPcbFrame );
/* Variables locales */ /* Variables locales */
...@@ -230,7 +230,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, ...@@ -230,7 +230,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
/* Load new footprints */ /* Load new footprints */
if( s_NbNewModules ) if( s_NbNewModules )
{ {
LoadListeModules( aFrame, NULL ); LoadListeModules( aFrame );
// Free module list: // Free module list:
MODULEtoLOAD* item, * next_item; MODULEtoLOAD* item, * next_item;
...@@ -340,7 +340,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, ...@@ -340,7 +340,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
if( !IsOK( NULL, _( "Ok to delete footprints not in netlist ?" ) ) ) if( !IsOK( NULL, _( "Ok to delete footprints not in netlist ?" ) ) )
break; break;
} }
aFrame->Delete_Module( Module, NULL, false ); Module->DeleteStructure();
} }
} }
} }
...@@ -961,7 +961,7 @@ void AddToList( const wxString& NameLibCmp, const wxString& CmpName, const wxStr ...@@ -961,7 +961,7 @@ void AddToList( const wxString& NameLibCmp, const wxString& CmpName, const wxStr
/***************************************************************/ /***************************************************************/
void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC ) void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
/***************************************************************/ /***************************************************************/
/* Routine de chargement des nouveaux modules en une seule lecture des /* Routine de chargement des nouveaux modules en une seule lecture des
...@@ -973,7 +973,7 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC ) ...@@ -973,7 +973,7 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC )
MODULEtoLOAD* ref, * cmp; MODULEtoLOAD* ref, * cmp;
int ii; int ii;
MODULE* Module = NULL; MODULE* Module = NULL;
wxPoint OldPos = aPcbFrame->GetScreen()->m_Curseur; wxPoint ModuleBestPosition;
if( s_NbNewModules == 0 ) if( s_NbNewModules == 0 )
return; return;
...@@ -984,15 +984,11 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC ) ...@@ -984,15 +984,11 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC )
// Calculate the footprint "best" position: // Calculate the footprint "best" position:
if( aPcbFrame->SetBoardBoundaryBoxFromEdgesOnly() ) if( aPcbFrame->SetBoardBoundaryBoxFromEdgesOnly() )
{ {
aPcbFrame->GetScreen()->m_Curseur.x = aPcbFrame->GetBoard()->m_BoundaryBox.GetRight() + ModuleBestPosition.x = aPcbFrame->GetBoard()->m_BoundaryBox.GetRight() + 5000;
5000; ModuleBestPosition.y = aPcbFrame->GetBoard()->m_BoundaryBox.GetBottom() + 10000;
aPcbFrame->GetScreen()->m_Curseur.y = aPcbFrame->GetBoard()->m_BoundaryBox.GetBottom() +
10000;
} }
else else
{ ModuleBestPosition = wxPoint( 0, 0 );
aPcbFrame->GetScreen()->m_Curseur = wxPoint( 0, 0 );
}
for( ii = 0; ii < s_NbNewModules; ii++, cmp = cmp->Next() ) for( ii = 0; ii < s_NbNewModules; ii++, cmp = cmp->Next() )
{ {
...@@ -1009,7 +1005,7 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC ) ...@@ -1009,7 +1005,7 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC )
DisplayError( NULL, msg ); DisplayError( NULL, msg );
continue; continue;
} }
aPcbFrame->Place_Module( Module, DC ); Module->SetPosition( ModuleBestPosition );
/* Update schematic links : reference "Time Stamp" and schematic hierarchical path */ /* Update schematic links : reference "Time Stamp" and schematic hierarchical path */
Module->m_Reference->m_Text = cmp->m_CmpName; Module->m_Reference->m_Text = cmp->m_CmpName;
...@@ -1034,8 +1030,6 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC ) ...@@ -1034,8 +1030,6 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC )
Module->m_Path = cmp->m_TimeStampPath; Module->m_Path = cmp->m_TimeStampPath;
} }
} }
aPcbFrame->GetScreen()->m_Curseur = OldPos;
} }
......
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