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:
~DialogEditModuleText() {};
private:
void OnInitDialog( wxInitDialogEvent& event );
void Init( );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
};
......@@ -58,20 +58,22 @@ DialogEditModuleText::DialogEditModuleText( WinEDA_BasePcbFrame* parent, TEXTE_
m_Module = NULL;
m_CurrentTextMod = TextMod;
if( m_CurrentTextMod )
{
m_Module = (MODULE*) m_CurrentTextMod->GetParent();
}
Init( );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
}
void DialogEditModuleText::OnCancelClick( wxCommandEvent& event )
{
event.Skip();
EndModal(0);
}
/********************************************************/
void DialogEditModuleText::OnInitDialog( wxInitDialogEvent& event )
void DialogEditModuleText::Init( )
/********************************************************/
{
SetFocus();
......@@ -84,7 +86,7 @@ void DialogEditModuleText::OnInitDialog( wxInitDialogEvent& event )
msg.Printf( format,
m_Module->m_Reference->m_Text.GetData(),
m_Module->m_Value->m_Text.GetData(),
(float) (m_Module->m_Orient / 10) );
(float) m_Module->m_Orient / 10 );
}
else
......@@ -132,8 +134,6 @@ void DialogEditModuleText::OnInitDialog( wxInitDialogEvent& event )
if( m_CurrentTextMod->m_NoShow )
m_Show->SetSelection( 1 );;
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
}
......@@ -184,7 +184,7 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
int maxthickness = Clamp_Text_PenSize(width, m_CurrentTextMod->m_Size );
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;
}
m_CurrentTextMod->SetWidth( width );
......@@ -203,5 +203,5 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
if( m_Module )
m_Module->m_LastEdit_Time = time( NULL );
Close( TRUE );
EndModal(1);
}
......@@ -117,7 +117,6 @@ DialogEditModuleText_base::DialogEditModuleText_base( wxWindow* parent, wxWindow
this->Layout();
// 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_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnCancelClick ), NULL, this );
}
......@@ -125,7 +124,6 @@ DialogEditModuleText_base::DialogEditModuleText_base( wxWindow* parent, wxWindow
DialogEditModuleText_base::~DialogEditModuleText_base()
{
// 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_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnCancelClick ), NULL, this );
}
......@@ -49,7 +49,7 @@
<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>
......
......@@ -55,7 +55,6 @@ class DialogEditModuleText_base : public wxDialog
wxButton* m_buttonCANCEL;
// 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 OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
......
......@@ -90,7 +90,7 @@ static MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
int TstOnly,
bool Select_By_Timestamp,
bool aChangeFootprint );
static void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC );
static void LoadListeModules( WinEDA_PcbFrame* aPcbFrame );
/* Variables locales */
......@@ -230,7 +230,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
/* Load new footprints */
if( s_NbNewModules )
{
LoadListeModules( aFrame, NULL );
LoadListeModules( aFrame );
// Free module list:
MODULEtoLOAD* item, * next_item;
......@@ -340,7 +340,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
if( !IsOK( NULL, _( "Ok to delete footprints not in netlist ?" ) ) )
break;
}
aFrame->Delete_Module( Module, NULL, false );
Module->DeleteStructure();
}
}
}
......@@ -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
......@@ -973,7 +973,7 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC )
MODULEtoLOAD* ref, * cmp;
int ii;
MODULE* Module = NULL;
wxPoint OldPos = aPcbFrame->GetScreen()->m_Curseur;
wxPoint ModuleBestPosition;
if( s_NbNewModules == 0 )
return;
......@@ -984,15 +984,11 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC )
// Calculate the footprint "best" position:
if( aPcbFrame->SetBoardBoundaryBoxFromEdgesOnly() )
{
aPcbFrame->GetScreen()->m_Curseur.x = aPcbFrame->GetBoard()->m_BoundaryBox.GetRight() +
5000;
aPcbFrame->GetScreen()->m_Curseur.y = aPcbFrame->GetBoard()->m_BoundaryBox.GetBottom() +
10000;
ModuleBestPosition.x = aPcbFrame->GetBoard()->m_BoundaryBox.GetRight() + 5000;
ModuleBestPosition.y = aPcbFrame->GetBoard()->m_BoundaryBox.GetBottom() + 10000;
}
else
{
aPcbFrame->GetScreen()->m_Curseur = wxPoint( 0, 0 );
}
ModuleBestPosition = wxPoint( 0, 0 );
for( ii = 0; ii < s_NbNewModules; ii++, cmp = cmp->Next() )
{
......@@ -1009,7 +1005,7 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC )
DisplayError( NULL, msg );
continue;
}
aPcbFrame->Place_Module( Module, DC );
Module->SetPosition( ModuleBestPosition );
/* Update schematic links : reference "Time Stamp" and schematic hierarchical path */
Module->m_Reference->m_Text = cmp->m_CmpName;
......@@ -1034,8 +1030,6 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC )
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